API reference
Leads
Leads are the visitors of the business's customer chat, the chat on its website, as the Leads tab shows them. Read who wrote and what they said, post the team's answer in a visitor's chat, or choose whether Okaymate answers on its own, writes drafts or lets the team answer.
The lead object
A visitor of the business's customer chat, as the Leads tab shows them. A visitor becomes a lead with their first message.
Attributes
- objectstringAlways
lead. - idstringThe visitor's ID, the same in every event about them.
- namestring or nullThe visitor's name, once they gave it.
- message_countintegerMessages in the conversation, the visitor's and the answers.
- last_messageobject or nullThe conversation's last message.
- last_message_atstring or nullWhen the last message was sent, ISO 8601.
- ai_modestringWho answers the visitor.
autowhen Okaymate answers,draftwhen Okaymate writes a draft and the team sends it, Semi-auto in the app,offwhen the team answers. Only when you retrieve or update one lead.autodraftoff
{
"object": "lead",
"id": "k3v9q2m7x4w8n1p6",
"name": "Emma",
"message_count": 2,
"last_message": {
"object": "message",
"id": "b2n7x4w8p5",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Lumen Studio",
"text": "Yes, Beginners Flow runs every Saturday at 10am. Want me to save you a spot?",
"files": [],
"created_at": "2026-11-24T09:12:51.000Z"
},
"last_message_at": "2026-11-24T09:12:51.000Z",
"ai_mode": "auto"
}List leads
Returns the customer chat's leads, the latest activity first.
Query parameters
- limitintegerHow many objects to return, from 1 to 100. Defaults to 20.
- cursorstringThe
next_cursorof the previous page, to get the page after it. See Pagination.
Returns
A list of lead objects, without ai_mode.
Errors
- A parameter has a value the API does not accept.
paramnames it. - The business's Okaymate server is not set up yet.
curl -G https://okaymate.ai/api/v1/leads \
-H "Authorization: Bearer $OKAYMATE_API_KEY" \
-d limit=20{
"object": "list",
"data": [
{
"object": "lead",
"id": "k3v9q2m7x4w8n1p6",
"name": "Emma",
"message_count": 2,
"last_message": {
"object": "message",
"id": "b2n7x4w8p5",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Lumen Studio",
"text": "Yes, Beginners Flow runs every Saturday at 10am. Want me to save you a spot?",
"files": [],
"created_at": "2026-11-24T09:12:51.000Z"
},
"last_message_at": "2026-11-24T09:12:51.000Z"
}
],
"has_more": true,
"next_cursor": "MjAyNi0xMS0yMlQxNjo0MDoxMi4wMDBa"
}Retrieve a lead
Returns one lead, with who answers them in ai_mode.
Path parameters
- idstringRequiredThe lead's ID.
Returns
A lead object.
Errors
- No lead with this ID in the business's customer chat.
- The business's Okaymate server is not set up yet.
curl https://okaymate.ai/api/v1/leads/k3v9q2m7x4w8n1p6 \
-H "Authorization: Bearer $OKAYMATE_API_KEY"{
"object": "lead",
"id": "k3v9q2m7x4w8n1p6",
"name": "Emma",
"message_count": 2,
"last_message": {
"object": "message",
"id": "b2n7x4w8p5",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Lumen Studio",
"text": "Yes, Beginners Flow runs every Saturday at 10am. Want me to save you a spot?",
"files": [],
"created_at": "2026-11-24T09:12:51.000Z"
},
"last_message_at": "2026-11-24T09:12:51.000Z",
"ai_mode": "auto"
}Update a lead
Chooses who answers the visitor, as the switch of their conversation in the Leads tab.
Path parameters
- idstringRequiredThe lead's ID.
Body parameters
- ai_modestringRequiredWho answers the visitor.
autowhen Okaymate answers,draftwhen Okaymate writes a draft and the team sends it, Semi-auto in the app,offwhen the team answers.autodraftoff
Returns
The updated lead object.
Errors
- No lead with this ID in the business's customer chat.
- A required parameter is missing.
paramnames it. - A parameter has a value the API does not accept.
paramnames it. - The business's Okaymate server is not set up yet.
- Okaymate's router or the business's server did not answer. Try again in a moment.
curl -X PATCH \
https://okaymate.ai/api/v1/leads/k3v9q2m7x4w8n1p6 \
-H "Authorization: Bearer $OKAYMATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ai_mode": "off"
}'{
"object": "lead",
"id": "k3v9q2m7x4w8n1p6",
"name": "Emma",
"message_count": 2,
"last_message": {
"object": "message",
"id": "b2n7x4w8p5",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Lumen Studio",
"text": "Yes, Beginners Flow runs every Saturday at 10am. Want me to save you a spot?",
"files": [],
"created_at": "2026-11-24T09:12:51.000Z"
},
"last_message_at": "2026-11-24T09:12:51.000Z",
"ai_mode": "off"
}The message object
One message of a visitor's conversation, sent by the visitor, by Okaymate or by the team.
Attributes
- objectstringAlways
message. - idstringUnique identifier for the message.
- leadstringThe ID of the lead whose conversation it is in.
- directionstring
inwhen the visitor wrote it,outfor an answer of Okaymate or of the team.inout - authorstring or nullWho wrote it. The visitor's name, the business's name for Okaymate's answers, and for the team's a name followed by
(team), the key's name for an answer posted with the API. - textstringThe message's text.
- filesarray of objectsThe files attached to the message.
- created_atstringWhen it was sent, ISO 8601.
{
"object": "message",
"id": "a8f3k2m9q1",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "in",
"author": "Emma",
"text": "Hi, do you have a class for beginners on Saturday morning?",
"files": [],
"created_at": "2026-11-24T09:12:44.000Z"
}List a lead's messages
Returns the messages of a visitor's conversation, the newest first.
Path parameters
- idstringRequiredThe lead's ID.
Query parameters
- limitintegerHow many objects to return, from 1 to 100. Defaults to 20.
- cursorstringThe
next_cursorof the previous page, to get the page after it. See Pagination.
Returns
A list of message objects.
Errors
- No lead with this ID in the business's customer chat.
- A parameter has a value the API does not accept.
paramnames it. - The business's Okaymate server is not set up yet.
curl -G \
https://okaymate.ai/api/v1/leads/k3v9q2m7x4w8n1p6/messages \
-H "Authorization: Bearer $OKAYMATE_API_KEY" \
-d limit=50{
"object": "list",
"data": [
{
"object": "message",
"id": "b2n7x4w8p5",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Lumen Studio",
"text": "Yes, Beginners Flow runs every Saturday at 10am. Want me to save you a spot?",
"files": [],
"created_at": "2026-11-24T09:12:51.000Z"
},
{
"object": "message",
"id": "a8f3k2m9q1",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "in",
"author": "Emma",
"text": "Hi, do you have a class for beginners on Saturday morning?",
"files": [],
"created_at": "2026-11-24T09:12:44.000Z"
}
],
"has_more": false,
"next_cursor": null
}Send a message
Posts the team's answer in the visitor's chat, under the key's name, as a teammate does from the Leads tab.
Path parameters
- idstringRequiredThe lead's ID.
Body parameters
- textstringRequiredThe answer, from 1 to 4000 characters.
Returns
The new message object, its direction set to out.
Errors
- No lead with this ID in the business's customer chat.
- A required parameter is missing.
paramnames it. - A parameter has a value the API does not accept.
paramnames it. - The business's Okaymate server is not set up yet.
- Okaymate's router or the business's server did not answer. Try again in a moment.
curl -X POST \
https://okaymate.ai/api/v1/leads/k3v9q2m7x4w8n1p6/messages \
-H "Authorization: Bearer $OKAYMATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Your spot is saved, see you Saturday!"
}'{
"object": "message",
"id": "c5q1m8k3v6",
"lead": "k3v9q2m7x4w8n1p6",
"direction": "out",
"author": "Helpdesk (team)",
"text": "Your spot is saved, see you Saturday!",
"files": [],
"created_at": "2026-11-24T09:20:03.000Z"
}