Home API and integrations | Keys, endpoints and webhooks How to query contacts, tickets, and messages in real time via API

How to query contacts, tickets, and messages in real time via API

Last updated on Oct 02, 2026

The most up-to-date documentation for the Cloud Humans APIs is at docs.cloudhumans.com/api-reference. If this article and the reference differ, the reference prevails.

When to use

  • You want to read current data from Cloud Chat without changing anything (look up a contact, view a customer's tickets, read the messages of a conversation)

  • You are integrating Cloud Chat with another system (CRM, internal portal) that needs to display live data

  • You want to avoid duplicate contacts before creating a ticket


Prerequisites

If you are not sure yet which type of API to use, start with the Master Guide β€” How to access and operate Cloud Chat data via API.

This page covers real-time reading only.


About this article

The Real-Time Query APIs let you read current data from Cloud Chat, straight from the production database, without changing anything. They are ideal for integrations, automations, and internal screens that need to answer questions like:

  • "Does this contact already exist?"

  • "Which tickets does this customer have?"

  • "What is the current status of this ticket?"

  • "Which messages were exchanged in this conversation?"

About the /api/client/ namespace

The endpoints on this page use /api/client/accounts/... instead of the /api/v1/accounts/... used by other APIs. Both use the same api_access_token for authentication.

The /api/client/ namespace offers simplified read endpoints β€” they are more direct for one-off queries. For write operations (create, update, delete), use the /api/v1/ namespace.


What these APIs are for

Use them when you need to:

  • Read data right now

  • Integrate Cloud Chat data with another system

  • Display information in an application

  • Make decisions based on the current state of the service

What they are not for

Do not use these APIs to:


Authentication

All endpoints require:

  • {CLOUDCHAT_DOMAIN} β€” your account's domain (e.g. cloudchat.cloudhumans.com)

  • {ACCOUNT_ID} β€” account ID

  • api_access_token β€” for the /api/client/ endpoints (sections 1, 2, and 3), the token must belong to an administrator β€” supervisor or agent tokens receive 403 Forbidden. The free-text search (section 1b, /api/v1/ namespace) accepts a token from any agent profile


1. Find a contact by email or phone

When to use

  • Before creating a ticket (to find out whether the contact already exists)

  • To associate external data with a contact

  • To avoid duplication

Endpoint

GET https://{CLOUDCHAT_DOMAIN}/api/client/accounts/{ACCOUNT_ID}/contacts?email=EMAIL&phone_number=PHONE

Rules

  • At least one of the parameters (email or phone_number) is required

  • If both are sent, the API attempts the most precise match possible

What it returns

  • Contact ID, name, email, phone

  • Custom fields

  • Creation and last activity dates


1b. Search contacts by free text (Search)

When to use

To find a contact by any text field (name, email, phone, identifier, company) without knowing exactly which one holds the information.

Unlike the previous endpoint, this one performs an ILIKE search (case-insensitive, partial) across multiple fields simultaneously.

Endpoint

GET /api/v1/accounts/{account_id}/contacts/search?q={termo}

Parameters

Parameter Type Required Description
q string Yes Search term. Minimum of 2 characters when it contains only letters (searches name only); minimum of 3 characters when it contains any digit (searches all fields). Below these limits, it returns HTTP 422
page integer No Results page (default: 1, 15 results per page)

Searched fields

  • name β€” contact name (always searched)

  • email β€” email (from 3 characters with a digit)

  • identifier β€” external identifier (from 3 characters with a digit)

  • phone_number β€” phone, with and without the + prefix (from 3 characters with a digit)

  • company_name β€” company name (from 3 characters with a digit)

Response

  • payload[] β€” array of matching contacts

  • meta β€” contains only the current page

meta.count and meta.total_pages were removed to reduce database cost on repeated queries. To get the absolute total, use the dedicated endpoint GET /api/v1/accounts/{account_id}/contacts/search/count?q={termo} (cached for 30s).

Example

GET /api/v1/accounts/1/contacts/search?q=maria&page=1

Returns every contact whose name, email, phone, identifier, or company contains maria.

Usage limit (rate limit)

40 requests per minute per access token. If you exceed the limit, the API responds with HTTP 429 (Too Many Requests). The same limit applies to /contacts/search/count.

Difference between the two search endpoints

Search by email/phone Free-text search
Namespace /api/client/ /api/v1/
Fields Email or phone only name, email, identifier, phone, company
Match type Exact Partial (ILIKE)
Pagination No Yes (15 per page)
Result total β€” Separate endpoint (/search/count)

2. List a contact's tickets

When to use

You already have the CONTACT_ID and want to list that customer's tickets:

  • Show the service history

  • View open or resolved tickets

  • Integrate with a CRM or internal portal

Endpoint

GET https://{CLOUDCHAT_DOMAIN}/api/client/accounts/{ACCOUNT_ID}/contacts/{CONTACT_ID}/conversations?page=1&limit=10

Parameters

  • page β€” required

  • limit β€” optional (default: 10)

What it returns

  • Ticket IDs

  • Status (open, resolved, etc.)

  • Priority

  • Inbox

  • Creation dates

  • Whether it was started by a campaign


3. List a ticket's messages

When to use

To retrieve the message history of a ticket:

  • Real-time auditing

  • Display the conversation in another interface

  • Debug integrations

Endpoint

GET https://{CLOUDCHAT_DOMAIN}/api/client/accounts/{ACCOUNT_ID}/conversations/{CONVERSATION_ID}/messages?page=1&limit=10

What it returns

  • Message content

  • Type (incoming / outgoing)

  • Public or private

  • Creation date

  • Message status

  • Attachment links (if any)


How these APIs connect (typical flow)

  1. Find the contact by email or phone

  2. Get the CONTACT_ID

  3. List that contact's tickets

  4. Pick a ticket

  5. List the ticket's messages

All of this without changing any data.


Risk level

Medium risk β€” they do not change data, but they query the production database in real time.

Best practices:

  • Avoid aggressive loops

  • Use caching whenever possible

  • Do not use for bulk exports


Common mistakes

  • Using these APIs for historical reports

  • Forgetting the page parameter

  • Mixing up CONTACT_ID and CONVERSATION_ID

  • Trying to create or update data with GET


Conversation tags (labels) and how to find the contact_id

Tags applied to a conversation have their own endpoint (in Chatwoot, the base of Cloud Chat, they are called labels):

GET https://{CLOUDCHAT_DOMAIN}/api/v1/accounts/{ACCOUNT_ID}/conversations/{CONVERSATION_ID}/labels

To find the contact_id from the CONVERSATION_ID you don't need a separate endpoint β€” the conversation details already return it:

GET https://{CLOUDCHAT_DOMAIN}/api/v1/accounts/{ACCOUNT_ID}/conversations/{CONVERSATION_ID}

In the response, meta.sender.id is the contact_id of the contact who owns the conversation. The same meta.sender object includes the name, email, phone, and other identifiers.

Both endpoints require an api_access_token from a user with the appropriate permission.


Notes