Reten Docs
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

FieldTypeRequiredDescription
sourcestringYesContact source: RETEN or INTEGRATION
address_aliasstringNoAlias or label for this address
streetstringNoStreet name
street_numberstringNoStreet number
unitstringNoApartment, suite, or unit
citystringNoCity
communestringNoCommune or district
regionstringNoState or region
country_codestringNoCountry code
formatted_addressstringNoFull formatted address string
latitudenumberNoLatitude coordinate
longitudenumberNoLongitude coordinate
is_primarybooleanNoSet as primary address
source_refstringNoExternal 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