Reten Docs

Commerce Addresses

Manage addresses for a commerce.

POST /api/commerces/:cId/addresses

Add a new address to a commerce.

Auth: Required — commerce:manage permission

Request Body

FieldTypeRequiredDescription
sourcestringYesSource of the address: RETEN or INTEGRATION
address_aliasstringNoFriendly name for the address
is_primarybooleanNoSet as primary address
country_codestringNoCountry code (e.g., CL, MX)
regionstringNoRegion or state
communestringNoCommune or municipality
citystringNoCity
streetstringNoStreet name
street_numberstringNoStreet number
unitstringNoApartment, suite, or unit
formatted_addressstringNoFull formatted address string
latitudenumberNoLatitude coordinate
longitudenumberNoLongitude coordinate

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",
    "address_alias": "Main Office",
    "street": "Av. Providencia",
    "street_number": "1234",
    "commune": "Providencia",
    "city": "Santiago",
    "region": "Metropolitana",
    "country_code": "CL",
    "latitude": -33.4500,
    "longitude": -70.6700,
    "is_primary": true
  }'
const commerceId = "<cId>";
const response = await fetch(`https://api.reten.ai/api/commerces/${commerceId}/addresses`, {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "x-tenant-id": "<tenant-id>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    source: "RETEN",
    address_alias: "Main Office",
    street: "Av. Providencia",
    street_number: "1234",
    commune: "Providencia",
    city: "Santiago",
    region: "Metropolitana",
    country_code: "CL",
    latitude: -33.4500,
    longitude: -70.6700,
    is_primary: true,
  }),
});
const address = await response.json();
import requests

commerce_id = "<cId>"
response = requests.post(
    f"https://api.reten.ai/api/commerces/{commerce_id}/addresses",
    headers={
        "Authorization": "Bearer <token>",
        "x-tenant-id": "<tenant-id>",
    },
    json={
        "source": "RETEN",
        "address_alias": "Main Office",
        "street": "Av. Providencia",
        "street_number": "1234",
        "commune": "Providencia",
        "city": "Santiago",
        "region": "Metropolitana",
        "country_code": "CL",
        "latitude": -33.4500,
        "longitude": -70.6700,
        "is_primary": True,
    },
)
address = response.json()

Response 201 Created

Returns the created address object.


PATCH /api/commerces/:cId/addresses/:aId

Update an existing address.

Auth: Required — commerce:manage permission

Request Body

FieldTypeRequiredDescription
address_aliasstringNoFriendly name for the address
country_codestringNoCountry code
regionstringNoRegion or state
communestringNoCommune or municipality
citystringNoCity
streetstringNoStreet name
street_numberstringNoStreet number
unitstringNoApartment, suite, or unit
formatted_addressstringNoFull formatted address string
latitudenumberNoLatitude coordinate
longitudenumberNoLongitude coordinate
is_activebooleanNoWhether the address is active

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