Skip to main content

Overview

The Customers API allows you to manage customer (contribuyente) records, including their contact information, tax identification (RUT), and credit account balances. Customers are entities to whom you sell products and services.

Create Customer

Request Body

rut
string
required
Tax identification number (RUT) in format ‘12345678-9’. Must be unique and valid.
razon_social
string
required
Legal or business name of the customer.
giro
string
Business activity or industry.
direccion
string
Physical address.
comuna
string
Municipality or district.
ciudad
string
City.
email
string
Contact email address.

Response

id
integer
Unique customer identifier.
rut
string
Tax identification number.
razon_social
string
Legal or business name.
giro
string
Business activity.
direccion
string
Physical address.
comuna
string
Municipality.
ciudad
string
City.
email
string
Contact email.
current_balance
decimal
Current credit account balance. Positive values indicate customer owes money, negative values indicate credit in favor of customer.
is_active
boolean
Whether the customer is active.
created_at
datetime
Timestamp when the customer was created.
updated_at
datetime
Timestamp of last update.
curl -X POST https://api.example.com/customers/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "rut": "12345678-9",
    "razon_social": "Comercial Los Andes Ltda.",
    "giro": "Venta al por menor",
    "direccion": "Av. Libertador 1234",
    "comuna": "Providencia",
    "ciudad": "Santiago",
    "email": "[email protected]"
  }'
{
  "id": 1,
  "rut": "12345678-9",
  "razon_social": "Comercial Los Andes Ltda.",
  "giro": "Venta al por menor",
  "direccion": "Av. Libertador 1234",
  "comuna": "Providencia",
  "ciudad": "Santiago",
  "email": "[email protected]",
  "current_balance": 0.00,
  "is_active": true,
  "created_at": "2026-03-08T10:30:00Z",
  "updated_at": null
}

List Customers

Response

Returns an array of customer objects.
curl -X GET https://api.example.com/customers/ \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "id": 1,
    "rut": "12345678-9",
    "razon_social": "Comercial Los Andes Ltda.",
    "giro": "Venta al por menor",
    "direccion": "Av. Libertador 1234",
    "comuna": "Providencia",
    "ciudad": "Santiago",
    "email": "[email protected]",
    "current_balance": 150000.00,
    "is_active": true,
    "created_at": "2026-03-08T10:30:00Z",
    "updated_at": null
  },
  {
    "id": 2,
    "rut": "98765432-1",
    "razon_social": "Distribuidora Sur SpA",
    "giro": "Distribución mayorista",
    "direccion": "Calle Principal 567",
    "comuna": "Las Condes",
    "ciudad": "Santiago",
    "email": "[email protected]",
    "current_balance": -50000.00,
    "is_active": true,
    "created_at": "2026-03-07T14:20:00Z",
    "updated_at": "2026-03-08T09:15:00Z"
  }
]

Search Customers

Query Parameters

q
string
Search query. Matches against RUT (with or without dots/dashes) or business name. Returns up to 10 results.

Response

Returns an array of matching customer objects (maximum 10).
curl -X GET "https://api.example.com/customers/search?q=Los%20Andes" \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "id": 1,
    "rut": "12345678-9",
    "razon_social": "Comercial Los Andes Ltda.",
    "giro": "Venta al por menor",
    "direccion": "Av. Libertador 1234",
    "comuna": "Providencia",
    "ciudad": "Santiago",
    "email": "[email protected]",
    "current_balance": 150000.00,
    "is_active": true,
    "created_at": "2026-03-08T10:30:00Z",
    "updated_at": null
  }
]

Get Customer by RUT

Path Parameters

rut
string
required
Customer’s RUT in format ‘12345678-9’.

Response

Returns a single customer object.
curl -X GET https://api.example.com/customers/12345678-9 \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "id": 1,
  "rut": "12345678-9",
  "razon_social": "Comercial Los Andes Ltda.",
  "giro": "Venta al por menor",
  "direccion": "Av. Libertador 1234",
  "comuna": "Providencia",
  "ciudad": "Santiago",
  "email": "[email protected]",
  "current_balance": 150000.00,
  "is_active": true,
  "created_at": "2026-03-08T10:30:00Z",
  "updated_at": null
}

Update Customer

Path Parameters

rut
string
required
Customer’s RUT in format ‘12345678-9’.

Request Body

All fields are optional. Only provided fields will be updated.
rut
string
New RUT value (must be unique and valid).
razon_social
string
Legal or business name.
giro
string
Business activity.
direccion
string
Physical address.
comuna
string
Municipality.
ciudad
string
City.
email
string
Contact email.

Response

Returns the updated customer object.
curl -X PUT https://api.example.com/customers/12345678-9 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "email": "[email protected]",
    "telefono": "+56 2 2345 6789"
  }'
{
  "id": 1,
  "rut": "12345678-9",
  "razon_social": "Comercial Los Andes Ltda.",
  "giro": "Venta al por menor",
  "direccion": "Av. Libertador 1234",
  "comuna": "Providencia",
  "ciudad": "Santiago",
  "email": "[email protected]",
  "current_balance": 150000.00,
  "is_active": true,
  "created_at": "2026-03-08T10:30:00Z",
  "updated_at": "2026-03-08T11:45:00Z"
}

Delete Customer

Path Parameters

rut
string
required
Customer’s RUT in format ‘12345678-9’.

Response

Returns no content on success.
curl -X DELETE https://api.example.com/customers/12345678-9 \
  -H "Authorization: Bearer YOUR_TOKEN"

Credit Account Management

The current_balance field tracks the customer’s credit account:
  • Positive values: Customer owes money to your business
  • Negative values: Customer has credit in their favor
  • Zero: Account is settled
This balance is automatically updated when:
  • Sales are made on credit (increases balance)
  • Payments are received (decreases balance)
  • Credit notes are issued (decreases balance)
You can query customers with outstanding balances for accounts receivable management.

Build docs developers (and LLMs) love