---
schema_version: "1"
id: 112277026f4dfb84b44373a29b35258c21f211587eeea091f47e32fd7cacbcc0
title: Profile
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/salesforce-commerce/guides/d2c-commerce/b2b-comm-headless-profile.md
canonical_url: https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-comm-headless-profile.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1894e070b858e9bb1a1febaaa1ef62905683c02d043ca2fa6c5750f71c7d74ac
products:
  - B2B Commerce Developer Guide
  - Salesforce APIs
---
# Profile

### Overview

The Profile page allows authenticated buyers to view and update their account profile information. The page reads from and updates the underlying Salesforce User record, including fields such as:

- First name
- Last name
- Phone number
- Primary address information

The buyer’s email address is displayed as a read-only field and cannot be modified through the storefront profile experience.

This flow demonstrates how a headless storefront can render buyer profile experiences, including account information and profile management workflows.

![Profile Buyer Journey](https://developer.salesforce.com/media/d2c-commerce/b2b-headless-b2b-commerce-headless-flow-orchestration-profile-buyer-journey-37-1.png '{"class": "image-lg", "title": "Profile Buyer Journey"}')

### B2B Commerce APIs Used in the Flow

| Operation      | HTTP Method | Endpoint                                                                                                                                            |
| -------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| Get profile    | GET         | [`/services/data/v68.0/sobjects/User/{userId}`](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_retrieve.htm) |
| Update profile | PATCH       | [`/services/data/v68.0/sobjects/User/{userId}`](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)    |

### Buyer Journey

**Load the Buyer Profile**

1. Call the following endpoint when the profile page loads:

   GET `/services/data/v68.0/sobjects/User/{userId}?fields=FirstName,LastName,Email,Phone,Street,City,State,PostalCode,Country`

2. Use the response to populate the buyer profile form.

3. Handle missing fields gracefully. Some fields can be omitted from the response because of field-level security (FLS). Default missing values to empty strings or null values instead of treating them as application errors.

4. Use the retrieved profile data to render:
   - First name
   - Last name
   - Email address
   - Phone number
   - Address information

**Save Profile Changes**

1. Update the editable profile fields.

2. Submit the profile update request by calling:

   PATCH `/services/data/v68.0/sobjects/User/{userId}`

3. Include only modified fields in the request body.

4. After the update succeeds, merge the submitted field values with the response payload. Some fields can be omitted from the response because of field-level security (FLS). Merging the submitted values prevents masked or restricted fields from disappearing from the profile form after the update.

5. Refresh the profile state using the merged field values.

6. Display a confirmation message indicating that the profile was updated successfully.

**Choose a Profile API Approach**

The storefront can retrieve and update buyer profile information using either SObject REST APIs or Commerce Connect APIs.

- Use SObject REST APIs when the storefront requires access to a broader set of User fields. <!--The reference React storefront uses SObject REST APIs directly to read and update the User record while respecting buyer field-level security (FLS).-->
- Use Connect REST APIs with GET [`/commerce/webstores/{webstoreId}/myprofile`](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_myprofile.htm) when the available Commerce profile fields satisfy your storefront requirements.

### Extend the Flow

- To add support for additional buyer profile attributes, integrate with the Salesforce Contact record instead of the User record. This pattern is commonly used for B2C storefront implementations where customer profile data is primarily managed on the Contact object.

## See Also

- [_REST API Developer Guide_: Get Field Values from a Standard Object Record](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)
- [_REST API Developer Guide_: Working with Records](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/using_resources_working_with_records.htm)
- [_Connect REST API Developer Guide_: When to Use Connect REST API](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/intro_using_chatter_connect.htm)
