Skip to main content
Use these endpoints to keep Clarity in sync with your CRM or order system, and to move tickets along from your own automations. Every request goes to https://back.leap.onclarity.com with Authorization: Bearer $CLARITY_API_KEY (see Authentication).

Customers

The customer object

attributes is a list of {key, value} pairs. The standard keys are external_id, personal_email, and personal_phone (a list of numbers); Clarity adds others, such as first and last interaction times, as the customer writes in. custom_attributes holds the values of the custom attributes you define.

Create a customer

string
required
The customer’s first name.
object
required
Contact attributes as an object. Values are strings, null, or lists of strings. Send {} when you have none.
string
The customer’s last name.
string
A URL of the customer’s picture.
integer[]
Tag ids from GET /api/tag/list.
The response is the new customer object.

Edit a customer

POST /api/customer/edit changes only the fields you send. Unknown fields are refused with 400.
integer
required
The customer to edit.
string
New first name.
string | null
New last name.
string | null
New picture URL.
object
Attributes to set. They are merged into the existing attributes; keys you leave out are kept.
integer[]
The customer’s tags. Replaces the current list.
string | null
male, female, or null.
string[]
The numbers on which the customer is reachable on WhatsApp. Replaces the current list.
The response is the updated customer object.

List customers

Free-text search.
string[]
Customers who have talked on any of these channels: web, android_sdk, ios_sdk, whatsapp, email, voice, x, instagram, linkedin, social.
integer[]
Tag ids.
string[]
Custom attribute filters as key:value. For numbers, key:gte:10 and key:lte:100 set a range. Repeat the parameter to combine filters.
boolean
Only customers without an email.
boolean
Only customers without a phone number.
integer
Only customers who interacted in the last N days.
string
name:asc, name:desc, last_interaction:asc, or last_interaction:desc. The default is newest first.
integer
default:"50"
Page size.
integer
How many customers to skip.
The response is {"list": [ ...customers ], "total": 1}.

Read, delete, and tag

  • GET /api/customer/{customer_id} returns one customer. When the id belongs to a customer that was merged into another, you get the surviving customer and an X-Contact-Merged-Into header with its id. Replace the id you stored.
  • POST /api/customer/delete with {"id": 67890} deletes the customer. An unknown id answers 404.
  • POST /api/customer/tags_set with {"customer_id": 67890, "tag_ids": [5, 9]} replaces the customer’s tags.

Custom attributes

Custom attributes are fields you define for tickets or for contacts (customers), such as a plan, an order number, or a contract date. Manage the definitions in Settings > Custom attributes or through the API.

Define an attribute

string
required
ticket or contact.
string
required
The name shown in Clarity, 1 to 100 characters. The attribute’s key is generated from it and returned in the response.
string
required
text, multiline, number, decimal, boolean, date, datetime, or list.
object[]
For list: the choices, each with id, label, and position.
object
Optional limits: max_length, pattern and pattern_error_message, min and max, min_date and max_date, min_date_time and max_date_time, max_selections.
string
Help text, up to 65 characters.
boolean
default:"false"
Whether agents must fill it in.
boolean
default:"false"
Whether the AI agent sees the value.
boolean
default:"false"
Whether the AI agent’s code tools can read the value without it appearing in the prompt.
boolean
default:"false"
Keep the attribute off the customer and ticket pages; only admins see it.

Set a value

The value must match the attribute’s type: The response is {"values": {...}, "meta": {...}} with all the object’s current values.

Update a ticket

Tickets are created by customers writing in, by the AI service integration, and by outbound messages. Once a ticket exists, these endpoints change it. Each one records an event in the ticket timeline and fires the matching webhook.

Look up ids first

Change the status

Send exactly one of:
integer
A status id from GET /api/ticket_status/list.
string
open or closed. Clarity uses your organization’s first status with that state.
The response is {"created_at": "...", "internal_id": "..."}. Moving a ticket to a closed status also fires the ticket_closed webhook.

Assign a ticket

POST /api/ticket/assign/v2 sets the team, the agent, or both. The body must contain both team and agent keys; set the one you do not want to change to null. To unassign, send {"value": null}.
The response is {"created_at": "...", "internal_id": {"team": "...", "agent": "..."}}.

Set the category

The response is {"created_at": "...", "internal_id": "..."}.

Tag a ticket

Both answer {}.
Listing and searching tickets is not part of the documented Support API yet. To find a customer’s tickets, use GET /api/integration/ai_service/customer/{customer_id}/tickets from the AI service integration, or keep the ticket ids you receive in webhooks.