Commerces
Commerce Addresses
Manage addresses for a commerce.
POST /api/commerces/:cId/addresses
Add a new address to a commerce.
Auth: Required — MANAGE_COMMERCES permission
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Contact source: RETEN or INTEGRATION |
address_alias | string | No | Alias or label for this address |
street | string | No | Street name |
street_number | string | No | Street number |
unit | string | No | Apartment, suite, or unit |
city | string | No | City |
commune | string | No | Commune or district |
region | string | No | State or region |
country_code | string | No | Country code |
formatted_address | string | No | Full formatted address string |
latitude | number | No | Latitude coordinate |
longitude | number | No | Longitude coordinate |
is_primary | boolean | No | Set as primary address |
source_ref | string | No | External reference from the source system |
Example
curl -X POST https://api.reten.ai/api/commerces/<cId>/addresses \
-H "Authorization: Bearer <token>" \
-H "x-tenant-id: <tenant-id>" \
-H "Content-Type: application/json" \
-d '{
"source": "RETEN",
"street": "456 Oak Avenue",
"street_number": "456",
"city": "Santiago",
"commune": "Providencia",
"region": "Metropolitana",
"country_code": "CL",
"latitude": -33.4500,
"longitude": -70.6700,
"is_primary": false
}'import axios from 'axios';
const response = await axios.post(
'https://api.reten.ai/api/commerces/<cId>/addresses',
{
source: 'RETEN',
street: '456 Oak Avenue',
street_number: '456',
city: 'Santiago',
commune: 'Providencia',
region: 'Metropolitana',
country_code: 'CL',
latitude: -33.45,
longitude: -70.67,
is_primary: false,
},
{
headers: {
Authorization: 'Bearer <token>',
'x-tenant-id': '<tenant-id>',
},
}
);
const address = response.data;Response 201 Created
Returns the created address object.
PATCH /api/commerces/:cId/addresses/:aId
Update an existing address.
Request Body
All fields are optional (same as create, except source and source_ref which are not updatable). Additionally accepts is_active (boolean) to activate or deactivate the address.
POST /api/commerces/:cId/addresses/:aId/set-primary
Set an address as the primary address for the commerce. Automatically unsets the previous primary address.
Response 200 OK
Returns the updated address.
Notes
- Only one address can be primary per commerce (among active addresses)
- Setting a new primary automatically unsets the previous one