Customers¶
Endpoints for listing, creating, and updating customer records.
GET /customers¶
List customers with optional filtering and pagination.
Request¶
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
nonce |
query | integer (int64) | No | Client-generated unique sequential number |
searchString |
query | string | No | Search by customer code or number |
searchColumn |
query | string | No | Column to search instead of the default code/number field, for example code, vat_id, email or name. The match is exact by default: name finds only the exact full name. From 7.2.03, add searchOperator=contains to match part of the name |
searchOperator |
query | string | No | Comparison operator: lt, lte, gt, gte, ne; from 7.2.03 also contains |
skip |
query | integer | No | Number of records to skip (pagination) |
limit |
query | integer | No | Max records to return. Max: 1000, default: 50 |
Responses¶
200 — Success¶
Returns an array of thirdParty objects (empty array if none found).
[
{
"id": 1,
"code": "C0001",
"name": "Acme Corp",
"vat_id": "PT123456789",
"email": "billing@acme.com",
"phone": "+351211234567",
"billing_address": {
"postal_address": "Rua da Liberdade 1",
"city": "Lisboa",
"zip_code": "1250-001",
"country": "PT"
}
}
]
400 — Invalid input parameters¶
POST /customers¶
Add a new customer to the system.
Request¶
POST /api/{account}/v4.0.0/customers?nonce={nonce}
Authorization: Bearer <xa-token>
Content-Type: application/json
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
nonce |
query | integer (int64) | Yes | Client-generated unique sequential number |
Request Body¶
Creation requires sufficient identifying data under the applicable entity/tenant validation rules: provide vat_id or email in the workflow where either is accepted. Email is not universally mandatory. Name alone is not a reliable unique identifier because different real entities may share the same name. See third-party creation requirements for identification, additional validation and the supplier routing caveat.
A thirdParty object. Required on creation: name and country_iso (two-letter ISO country code, such as PT). For foreign customers, send code, vat_id or email. You may supply code; otherwise Gestix assigns one. Omitting country_iso fails validation with Especifique por favor País (CEF).
{
"code": "C0042",
"name": "New Customer Ltd",
"country_iso": "PT",
"vat_id": "PT987654321",
"email": "contact@newcustomer.com",
"phone": "+351211234567",
"billing_address": {
"postal_address": "Av. da República 45",
"city": "Porto",
"zip_code": "4000-001",
"country": "PT"
}
}
Responses¶
201 — Customer created¶
The response has no ID or code. Before 7.2.03 the body is empty; from 7.2.03 it is {"status":201,"error":false,"message":"Gestix: resource created"}. Read the customer back by code, vat_id or email to get its id. When code is omitted, Gestix assigns the next code after the last one. From 7.2.03, a new customer (also one created by POST /invoices) gets the default invoicing class.
400 — Invalid input¶
Nothing is stored. Before 7.2.03, a customer that already exists (same identifier) is also refused with 400 Customer exists.
409 — Customer exists¶
From 7.2.03, a customer that already exists (same identifier) is refused with 409 Customer exists. See Error Handling for how to read the reason.
PUT /customers¶
Update an existing customer record.
Request¶
PUT /api/{account}/v4.0.0/customers?nonce={nonce}
Authorization: Bearer <xa-token>
Content-Type: application/json
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
nonce |
query | integer (int64) | Yes | Client-generated unique sequential number |
Request Body¶
A thirdParty object. Identify the customer with vat_id or email. Before 7.2.03, an id alone is refused with 409 (Please specify VATID or email to identify the customer). From 7.2.03, id alone or code alone also identifies the customer; id takes precedence over the other keys, and an unknown id answers 409 (record not found).
Fields not sent
Before 7.2.03, an update replaces the whole customer record: fields the request does not send are cleared (invoicing class, price list, salesperson, terms), and an update identified by vat_id or email can give the customer a new code. Send code, and send every field you want to keep. From 7.2.03, PUT and POST /customers change only the fields sent.