Customer REST API

Learn to use new customer REST APIs in Adobe Commerce as a Cloud Service. This tutorial is perfect for architects and developers looking to integrate and optimize API solutions effectively.

Who is this video for?

  • Backend developers responsible for building integrations with Adobe Commerce
  • Technical architects designing customer management workflows for headless commerce implementations

Video content

  • Authenticate with Adobe IMS using server-to-server credentials to obtain an access token for API requests
  • Use the correct REST API endpoint format for Commerce as a Cloud Service
  • Create and update customer accounts programmatically using POST and PUT requests with proper JSON payloads
Transcript

This is Russell with Adobe. In this session, we’re going to learn how to create and update customer accounts using the REST API in Adobe Commerce as a cloud service. By the end, you’ll know how to authenticate with Adobe IMS, make API calls to the customer endpoints, and understand one critical URL difference that’s unique to ACCS. Before we dive in, we need to gather some information from two different places. First, we’re going to head over to experience.adobe.com, and once you’re here, you’re going to click on Commerce, and we’re going to filter if you have multiple projects.

And for the one that we want, we’re going to click on this little circle icon, and this is where we’re going to find our instance ID, and this is also where we’re going to find our REST endpoint.

Next, we’re going to head over to the Adobe Developer Console, and that can be found at developer.adobe.com slash console, and this is where we’re going to get the client ID and the client secret from a server-to-server credential. So, we’re going to find the recent project or one that we’re interested in, and then under credentials, either create or use an existing one. Since I have one already, we’re just going to use it, and this is where our client ID and then our client secret. If you want a shortcut to getting the access token, you can click on this view curl command, and it will give you the output that you need. One critical thing to note is that both on experience.adobe.com and the Developer Console, make sure that you’re in the right organization. If you’re in a different organization, there’s a really good chance you’re not going to see the screens I just showed. Make sure that you’re in this organization that’s been provided by the client, and then provision the access. Now we’re going to get started, and we’re going to generate this access token using this curl command that we just copied. When it’s successful, we receive a JSON response containing your access token. This token is valid for 24 hours, so you don’t need to refresh it frequently. We’re just going to copy that token, and we’re going to use it for our next few requests. And this is where I’d like to bring up that unique difference between the original Adobe Commerce application REST endpoints and this one. In the original, you would have the word REST in the URL structure, as well as the store view code. For Adobe Commerce as a cloud service, it’s a little bit different. You actually just have the base URL, and then you have your tenant ID, and then the endpoint. Do not include the word REST or the store view code, or you’ll probably get a 404. So now we’re going to go ahead and create this first account. When successful, we get a newly returned customer object, and it includes the customer ID. You do need to make note of that because we’re going to use that to update the customer. So updating the customer, it’s just as straightforward as creating one, except we’re going to use a put command. In the request body, we need to make sure that we have the customer ID and any of the fields that we want to update. So we’re going to do something. We’re going to change the last name to dough updated, and there we have it. The last name has been updated, and the updated timestamp has also been changed. Well, that’s it for this session on creating and updating a customer using the REST API for Adobe Commerce as a cloud service. Please continue to visit Experience League to learn more about Adobe Commerce, as well as all of the other Adobe products.

Code samples

Before starting, gather all the required values from Experience Cloud and the Adobe Developer Console. Having these values ready ensures a smooth setup process.

NOTE
Make sure you are working in the correct organization. Your organization selection affects which instances and environments are visible in both Experience Cloud and the Developer Console.

Instance details - experience.adobe.com

The instance details contain things like your Instance ID, GraphQL endpoints, credentials.

Developer details - https://developer.adobe.com/console/

The Developer Console is where you manage your API credentials, including client IDs, client secrets, and access tokens. You can also create new credential types, such as Server-to-Server or Native App authentication.

Prerequisites

Item
Value
Where is this value
Instance ID
<instance_id>
experience.adobe.com
REST Endpoint
<rest_endpoint>
experience.adobe.com
Client ID
<client_id>
developer.adobe.com/console
Client Secret
<client_secret>
developer.adobe.com/console

Step 1: Get Access Token (Server-to-Server Authentication)

IMPORTANT
The variables shown in this sample are not valid. Use the <client_id> and <client_secret> from your project credentials.
curl -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>&scope=openid,AdobeID,email,additional_info.projectedProductContext,profile,commerce.aco.ingestion,commerce.accs,org.read,additional_info.roles'

Sample Response:

{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "token_type": "bearer",
  "expires_in": 86399
}

Step 2: Create a Customer

IMPORTANT
The URL provided in this sample is not valid. Use your REST base url. Exchange ‘<rest_endpoint>’ with your URL. It looks similar to this https://na1-sandbox.api.commerce.adobe.com/AbCYab34cdEfGHiJ27123.
This endpoint does not have /rest/ as part of the URL. Including that leads to an error.

Endpoint: POST /V1/customers

curl -X POST \
  "<rest_endpoint>/V1/customers" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
    "customer": {
      "email": "john.doe@example.com",
      "firstname": "John",
      "lastname": "Doe",
      "store_id": 1,
      "website_id": 1
    },
    "password": "TempPa55word!"
  }'

Response:

{
  "id": 5,
  "group_id": 1,
  "created_at": "2026-01-23 20:40:15",
  "updated_at": "2026-01-23 20:40:15",
  "created_in": "Default Store View",
  "email": "john.doe@example.com",
  "firstname": "John",
  "lastname": "Doe",
  "store_id": 1,
  "website_id": 1,
  "addresses": [],
  "disable_auto_group_change": 0
}

Step 3: Update a Customer

IMPORTANT
The URL provided in this sample is not valid. Use your REST base url. Exchange ‘<rest_endpoint>’ with your URL. It looks similar to this https://na1-sandbox.api.commerce.adobe.com/AbCYab34cdEfGHiJ27123.

The number 5 in the following example is the ID from the previously created customer using POST "id": 5,. Be sure to change5 to whatever id was returned in your request.

Endpoint: PUT /V1/customers/{customerId}

curl -X PUT \
  "<rest_endpoint>/V1/customers/5" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
    "customer": {
      "id": 5,
      "email": "john.doe@example.com",
      "firstname": "John",
      "lastname": "Doe-Updated"
    }
  }'

Response:

{
  "id": 5,
  "group_id": 1,
  "created_at": "2026-01-23 20:40:15",
  "updated_at": "2026-01-23 20:40:30",
  "created_in": "Default Store View",
  "email": "john.doe@example.com",
  "firstname": "John",
  "lastname": "Doe-Updated",
  "store_id": 1,
  "website_id": 1,
  "addresses": []
}

Complete script (all-in-one)

IMPORTANT
The variables shown in this sample are not valid. Use the client ID and client secret from your project credentials. Use your REST base url. Exchange ‘<rest_endpoint>’ with your REST endpoint URL from experience.adobe.com. It looks similar to this https://na1-sandbox.api.commerce.adobe.com/AbCDefGHiJ1234567.
#!/bin/bash

# Configuration be sure to update these with your projects unique values
CLIENT_ID="<client_id>"
CLIENT_SECRET="<client_secret>"
REST_ENDPOINT="<rest_endpoint>"

# Step 1: Get Access Token
echo "Getting access token..."
ACCESS_TOKEN=$(curl -s -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&scope=openid,AdobeID,email,additional_info.projectedProductContext,profile,commerce.aco.ingestion,commerce.accs,org.read,additional_info.roles" | jq -r '.access_token')

echo "Token obtained: ${ACCESS_TOKEN:0:50}..."

# Step 2: Create Customer
echo ""
echo "Creating customer..."
CREATE_RESPONSE=$(curl -s -X POST \
  "${REST_ENDPOINT}/V1/customers" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -d '{
    "customer": {
      "email": "john.doe@example.com",
      "firstname": "John",
      "lastname": "Doe",
      "store_id": 1,
      "website_id": 1
    },
    "password": "TempPa55word!"
  }')

echo "Create Response:"
echo "$CREATE_RESPONSE" | jq .

# Extract customer ID
CUSTOMER_ID=$(echo "$CREATE_RESPONSE" | jq -r '.id')
echo "Customer ID: $CUSTOMER_ID"

# Step 3: Update Customer
echo ""
echo "Updating customer..."
curl -s -X PUT \
  "${REST_ENDPOINT}/V1/customers/${CUSTOMER_ID}" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -d "{
    \"customer\": {
      \"id\": ${CUSTOMER_ID},
      \"email\": \"john.doe@example.com\",
      \"firstname\": \"john\",
      \"lastname\": \"Doe-Updated\"
    }
  }" | jq .

Important notes about this tutorial

  1. URL Path: Use https://<server>.api.commerce.adobe.com/<tenant-id>/V1/customersNOT https://<host>/rest/<store-view-code>/V1/customers
  2. Authentication: This tutorial used Server-to-Server (client_credentials grant type)
  3. Required Scope: commerce.accs
  4. Token Expiry: 86400 seconds (24 hours)

References

recommendation-more-help
3a5f7e19-f383-4af8-8983-d01154c1402f