Reten Docs
Commerces

Commerce Users

Manage users, roles, and contacts for a commerce.

POST /api/commerces/:cId/users

Create a user for a commerce.

Auth: Required — MANAGE_COMMERCES permission

Request Body

FieldTypeRequiredDescription
namestringNoFull name of the commerce user
external_idstringNoExternal system identifier
sourcestringNoContact source: RETEN or INTEGRATION
rolesstring[]NoInitial roles: OWNER, ORDERS, FINANCE, ATTENTION, ADMIN, COMMERCE_REP, OTHER

Example

curl -X POST https://api.reten.ai/api/commerces/<cId>/users \
  -H "Authorization: Bearer <token>" \
  -H "x-tenant-id: <tenant-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Maria Garcia",
    "external_id": "usr-001",
    "source": "RETEN",
    "roles": ["OWNER"]
  }'
import axios from 'axios';

const response = await axios.post(
  'https://api.reten.ai/api/commerces/<cId>/users',
  {
    name: 'Maria Garcia',
    external_id: 'usr-001',
    source: 'RETEN',
    roles: ['OWNER'],
  },
  {
    headers: {
      Authorization: 'Bearer <token>',
      'x-tenant-id': '<tenant-id>',
    },
  }
);

const user = response.data;

Response 201 Created

Returns the created user object.


PATCH /api/commerces/:cId/users/:uId

Update a commerce user.


POST /api/commerces/:cId/users/:uId/roles

Add a role to a commerce user.

Request Body

FieldTypeRequiredDescription
rolestringYesOne of: OWNER, ORDERS, FINANCE, ATTENTION, ADMIN, COMMERCE_REP, OTHER

Response 201 Created


DELETE /api/commerces/:cId/users/:uId/roles/:role

Remove a role from a commerce user.

Response 204 No Content


POST /api/commerces/:cId/users/:uId/contacts

Add a contact to a commerce user.

Request Body

FieldTypeRequiredDescription
contact_typestringYesEMAIL, PHONE, WHATSAPP, or OTHER
valuestringYesContact value (validated by type)
sourcestringYesContact source: RETEN or INTEGRATION
is_primarybooleanNoSet as primary contact for this type

Validation

TypeFormat
EMAILValid email regex
PHONEE.164 format (e.g., +56912345678)
WHATSAPPE.164 format

Response 201 Created


PATCH /api/commerces/:cId/users/:uId/contacts/:contactId

Update a contact.


POST /api/commerces/:cId/users/:uId/contacts/:contactId/set-primary

Set a contact as primary for its type.

Notes

  • Only one primary contact per type per commerce user (among active contacts)
  • Setting a new primary automatically unsets the previous one for that type