v2 is generally available. See what changed
Skip to content
Acme Commerce API Menu

Update a customer

PATCH /api/v2/customers/{customer} Requires authentication v2

Send a bearer token in the Authorization header.

Partial update — omitted fields are left untouched.

Full URL: https://api.acme.example/api/v2/customers/{customer}

Path parameters

Name Type Required Description
customer integer yes The customer id.

Body parameters

Name Type Required Description
name string, maxLength 255 no
status string, one of active, archived no Archiving hides the customer from list endpoints.

Responses

200 The updated customer.

Field Type Description
id integer
email string<email>
name string
status string, one of active, invited, archived
created_at string<date-time>

422 Validation failed.

Example request

cURL
curl -X PATCH 'https://api.acme.example/api/v2/customers/1' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Jane Doe",
    "status": "active"
}'
JavaScript
const response = await fetch('https://api.acme.example/api/v2/customers/1', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "name": "Jane Doe",
      "status": "active"
  })
});

const data = await response.json();
PHP (Laravel)
use Illuminate\Support\Facades\Http;

$response = Http::withHeaders([
    'Authorization' => 'Bearer YOUR_TOKEN',
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
])->patch('https://api.acme.example/api/v2/customers/1', [
    'name' => 'Jane Doe',
    'status' => 'active',
]);

$data = $response->json();
PHP (Guzzle)
use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('PATCH', 'https://api.acme.example/api/v2/customers/1', [
    'headers' => [
        'Authorization' => 'Bearer YOUR_TOKEN',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
        'name' => 'Jane Doe',
        'status' => 'active',
    ],
]);

$data = json_decode((string) $response->getBody(), true);

Free while you are building.

Get an API key

This page as Markdown, or the whole API as OpenAPI. Ask ChatGPT Ask Claude