Skip to main content

Clients — Create & Update

Create new clients and update existing ones with partial updates.


Create Client​

POST/apidev/v1/clients
PermissionAPICLI_CLIENTS_WRITE
Rate Limit10 req/min
Upsert by external_code

Clients are unique by external_code within your company. If a client with the same external_code already exists, this request does not create a duplicate: it returns that existing client, with created: false in the response.

On a match, only name and zip_code are refreshed with the values you sent. Every other field of the existing client is left untouched — to change the rest, follow up with Update Client using the id you got back.

When you omit external_code, the client's name (uppercased) is used as its external code — so re-posting the same name also matches the existing client.

Request Body​

FieldTypeRequiredMaxDescription
namestringYes200Client display name.
external_codestringNo120External system identifier.
statusstringNo10Client status.
documentstringNo60Document number.
document_typenumberNo—Document type identifier.
business_namestringNo200Legal business name.
tax_idstringNo60Tax identification number.
phonestringNo60Phone number.
mobilestringNo60Mobile phone.
emailstringNo200Email address.
notesstringNo1000Free-text notes.
image_urlstringNo500Image URL.
streetstringNo200Street name.
door_numberstringNo20Door number.
apartmentstringNo20Apartment or suite.
cornerstringNo200Cross street.
zip_codestringNo20Postal code.
latitudenumberNo—Latitude coordinate.
longitudenumberNo—Longitude coordinate.
country_idstringNo30Country ID.
department_idstringNo30Department ID.

Code Examples​

curl -s -X POST "https://$TENANT/apidev/v1/clients" \
-H "Authorization: Bearer $TOKEN" \
-H "X-API-Key: $APIKEY" \
-H "tenant: $TENANT" \
-H "Content-Type: application/json" \
-d '{
"name": "Regional Distributors",
"business_name": "Regional Distributors S.A.",
"tax_id": "219900005018",
"email": "info@regionaldist.com",
"phone": "+59821009876",
"street": "Bvar. Artigas",
"door_number": "567",
"country_id": "1",
"department_id": "10"
}'

Response Fields​

FieldTypeDescription
idstringClient unique identifier — the new client's id, or the existing client's id when the request matched one by external_code.
createdbooleantrue when a new client was created; false when an existing client with the same external_code was updated instead.

Example Response​

{
"success": true,
"data": {
"id": "982710394857200005",
"created": true
}
}

Update Client​

Update an existing client. Only included fields are modified; omitted fields remain unchanged. Send null to clear a nullable field.

See Partial Updates for the general pattern.

PUT/apidev/v1/clients/{id}
PermissionAPICLI_CLIENTS_WRITE
Rate Limit10 req/min

Path Parameters​

ParameterTypeRequiredDescription
idstringYesClient unique identifier.

Request Body​

All fields from Create Client are accepted (none required). Only include the fields you want to modify.

Code Examples​

curl -s -X PUT "https://$TENANT/apidev/v1/clients/982710394857200005" \
-H "Authorization: Bearer $TOKEN" \
-H "X-API-Key: $APIKEY" \
-H "tenant: $TENANT" \
-H "Content-Type: application/json" \
-d '{
"email": "new-info@regionaldist.com",
"phone": "+59821005555",
"notes": "Updated primary contact"
}'

Example Response​

{
"success": true,
"data": {
"id": "982710394857200005",
"updated_fields": ["email", "phone", "notes"]
},
"meta": {}
}

Errors​

CodeHTTPDescription
VALIDATION_ERROR400Invalid parameters.
UNAUTHORIZED401Missing, invalid, or expired tenant / Authorization / X-API-Key
FORBIDDEN403User lacks required permission.
NOT_FOUND404Resource not found (update endpoint).
RATE_LIMITED429Exceeded 10 req/min.
INTERNAL_ERROR500Unexpected server error.