Commerces
Update Commerce
Update a commerce's fields and metadata.
PATCH /api/commerces/:id
Update a commerce's fields. Metadata uses merge semantics — new keys are added, existing keys are updated, missing keys are preserved.
Auth: Required — MANAGE_COMMERCES 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 (merge semantics) |
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" }
}'import axios from 'axios';
const response = await axios.patch(
'https://api.reten.ai/api/commerces/880e8400-e29b-41d4-a716-446655440000',
{
name: 'Updated Store Name',
metadata: { region: 'north', priority: 'high' },
},
{
headers: {
Authorization: 'Bearer <token>',
'x-tenant-id': '<tenant-id>',
},
}
);
const updatedCommerce = response.data;Response 200 OK
Returns the updated commerce object.
Error Responses
| Status | Description |
|---|---|
404 | Commerce not found |
409 | Tax ID already exists |