Skip to content

Create Customers

Request

Crea un nuevo cliente

Security
api-key
Bodyapplication/jsonrequired
customerobject

Datos del cliente

agent_idinteger

ID del agente asignado al cliente (puede estar en nivel raíz o dentro de customer)

Example:1
tagsArray of objects

Array de etiquetas del cliente (puede estar en nivel raíz o dentro de customer)

custom_fieldsArray of objects

Array de campos personalizados del cliente (puede estar en nivel raíz o dentro de customer)

curl -i -X POST \
  https://app.mercately.com/retailers/api/v1/customers \
  -H 'Content-Type: application/json' \
  -H 'api-key: YOUR_API_KEY_HERE' \
  -d '{
    "customer": {
      "first_name": "Juan",
      "last_name": "Pérez",
      "email": "juan@example.com",
      "phone": "+593999999999",
      "id_type": "cedula",
      "id_number": "1234567890",
      "address": "Av. Principal 123",
      "city": "Quito",
      "state": "Pichincha",
      "zip_code": "170101",
      "customer_addresses_attributes": [
        {
          "address": "Calle Secundaria 456",
          "city": "Guayaquil",
          "state": "Guayas",
          "zip_code": "090101",
          "country_id": 1,
          "latitude": "-2.1894",
          "longitude": "-79.8891",
          "description": "Oficina principal",
          "main": true
        }
      ],
      "notes": "Cliente VIP"
    },
    "agent_id": 1,
    "tags": [
      {
        "name": "VIP",
        "value": true
      }
    ],
    "custom_fields": [
      {
        "field_name": "preferencia_contacto",
        "field_content": "WhatsApp"
      }
    ]
  }'

Responses

OK - Cliente creado con éxito

Bodyapplication/json
messagestring
Example:"Customer created successfully"
customerobject
Response
{ "message": "Customer created successfully", "customer": { "id": 12345, "first_name": "Juan", "last_name": "Pérez", "email": "juan@example.com", "phone": "+593999999999", "id_type": "cedula", "id_number": "1234567890", "address": "Av. Principal 123", "city": "Quito", "state": "Pichincha", "zip_code": "170101", "notes": "Cliente VIP", "created_at": "2024-01-15T10:30:00.000Z" } }