Update Commerce
Update a commerce's fields and metadata.
PATCH /api/commerces/:id
Update a commerce's fields.
Metadata is merged, not replaced: keys sent overwrite keys with the same name, keys not sent are kept, and sending a key with null removes it. The merge is recursive (RFC 7386 JSON Merge Patch): nested objects are merged level by level, so you can update one key inside a nested object without resending its siblings. Any other value replaces the previous one wholesale — arrays included, which are never merged element by element. Sending metadata: null empties the whole bag.
Auth: Required — commerce:manage permission
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | UUID | Commerce ID |
Request Body
All fields are optional:
| Field | Type | Description |
|---|---|---|
name | string | Commerce name |
tax_id | string | Tax ID (unique per tenant) |
global_external_id | string | Global external identifier |
is_active | boolean | Active status |
metadata | object | Arbitrary JSON, merged recursively; null empties it |
Example
curl -X PATCH https://api.reten.ai/api/commerces/880e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer <token>" \
-H "x-tenant-id: <tenant-id>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Store Name",
"metadata": { "region": "north", "priority": "high" }
}'const commerceId = "880e8400-e29b-41d4-a716-446655440000";
const response = await fetch(`https://api.reten.ai/api/commerces/${commerceId}`, {
method: "PATCH",
headers: {
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Updated Store Name",
metadata: { region: "north", priority: "high" },
}),
});
const commerce = await response.json();import requests
commerce_id = "880e8400-e29b-41d4-a716-446655440000"
response = requests.patch(
f"https://api.reten.ai/api/commerces/{commerce_id}",
headers={
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
},
json={
"name": "Updated Store Name",
"metadata": {"region": "north", "priority": "high"},
},
)
commerce = response.json()Response 200 OK
Returns the updated commerce object.
Error Responses
| Status | Description |
|---|---|
404 | Commerce not found |
409 | Tax ID already exists |