Clients
The Clients API provides CRUD access to clients, plus ancillary actions for setting tags, changing the status, and changing the account owner.New to the API? Start with Getting started (base URL, response envelope, errors, pagination) and Authentication (API keys). Those conventions apply to every endpoint below and are not repeated here.
Identifier note: unlike most resources, clients are addressed by their numericclient_id(the clients table has no unique-id column). Wherever{id}appears below it is theclient_id.
The client object
All endpoints that return a client use this shape:| Field | Type | Notes |
|---|---|---|
id | integer | Client id. Used in all URLs. |
company_name | string | Client company name. |
description | string|null | Client description. |
status | string | active or suspended. |
phone | string|null | |
website | string|null | |
vat | string|null | VAT / tax number. |
category | object | { id, name }. |
owner | object | Primary account owner { id, name } — set via the owner action. |
billing | object | Billing address + invoice_due_days. |
shipping | object | Shipping address. |
dates | object | created, updated. |
tags | array | Tag titles. |
List / search clients
Query parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by client status (active|suspended). |
category_id | integer | Filter by category id. |
search | string | Free-text search on the company name. |
sort | string | client_company_name, client_status, client_created, client_updated. |
order | string | asc or desc (default desc). |
limit | integer | Results per page (max 100). |
page | integer | Page number. |
Example request
Example response — 200 OK
Get a client
Example request
200) with message “Client retrieved successfully.”
Create a client
first_name,
last_name and email (these are required). If a contact-type user already exists with that
email, it is promoted to the client’s primary user. A welcome email is not sent unless you
pass send_email=yes. The account owner can later be changed with the owner action.
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
first_name | string | yes | Primary user’s first name. |
last_name | string | yes | Primary user’s last name. |
email | string | yes | Primary user’s email. Must be unique among client/team users. |
client_company_name | string | no | Defaults to “first_name last_name” if omitted. |
client_categoryid | integer | no | Existing category id. Defaults to the system default category. |
client_description | string | no | |
client_phone | string | no | |
client_website | string | no | |
client_vat | string | no | |
client_billing_street | string | no | |
client_billing_city | string | no | |
client_billing_state | string | no | |
client_billing_zip | string | no | |
client_billing_country | string | no | |
client_billing_invoice_due_days | integer | no | |
tags | array of strings | no | Tag titles to attach on create. |
send_email | string | no | yes to send the welcome email. Default no. |
Required custom fields configured for clients must also be supplied (using their field
name). Missing required custom fields return a 422.
Example request
Example response — 201 Created
Update a client
client_company_name is required. The primary user / account owner is not changed here —
use the owner action.
Body parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
client_company_name | string | yes | |
client_categoryid | integer | no | Existing category id. |
client_description | string | no | |
client_phone | string | no | |
client_website | string | no | |
client_vat | string | no | |
client_billing_street | string | no | |
client_billing_city | string | no | |
client_billing_state | string | no | |
client_billing_zip | string | no | |
client_billing_country | string | no | |
client_billing_invoice_due_days | integer | no |
As with create, required client custom fields must be supplied.
Example request
Example response — 200 OK
Delete a client
Example request
Example response — 200 OK
Set tags
tags array is the full set — it replaces existing tags; an
empty array clears them.
| Parameter | Type | Required | Notes |
|---|---|---|---|
tags | array of strings | yes | Tag titles. Empty array clears all. |
200) with message “Client tags updated successfully.”
Change status
| Parameter | Type | Required | Notes |
|---|---|---|---|
status | string | yes | active or suspended. |
200) with message “Client status updated successfully.”
Change account owner
owner must be the id of a user that already
belongs to this client; it replaces the previous account owner.
| Parameter | Type | Required | Notes |
|---|---|---|---|
owner | integer | yes | Id of a user belonging to this client. |
200) with message “Client account owner updated successfully.”
Errors
See Getting started for the shared error format. Client-specific:| Status | Meaning |
|---|---|
404 Not Found | The client id does not exist. |
422 Unprocessable Entity | Validation failed (see below). |