Diska
Chat

Create a chat

Opens a chat with a published prompt-mode agent.
POST https://api.diska.ai/v1/chats

Scope: chats:write

If the agent speaks first and has a greeting, the response already carries that message. The chat also shows in GET /v1/calls, with channel web_chat. metadata is yours: it is stored and returned, but the agent never sees it. Send Idempotency-Key to retry the request without opening two chats.

Request body

application/json

FieldTypeRequiredDescription
agent_idstringYesPublished prompt-mode agent. Up to 64 characters.
variablesobjectNoChat variables (up to 20), as on calls.
metadataobjectNoUp to 20 text → text pairs (500 characters per value), for you only.
contactstring | nullNoWho is chatting: phone, email or your own ID. Up to 120 characters.
{
  "agent_id": "3f1c2a7e-5b9d-4c1e-8f3a-2d6b7e9c1a40",
  "contact": "+244923000000",
  "variables": {
    "nome": "Ana"
  },
  "metadata": {
    "crm_ticket": "T-1042"
  }
}

Examples

curl -X POST "https://api.diska.ai/v1/chats" \
  -H "Authorization: Bearer $DISKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"3f1c2a7e-5b9d-4c1e-8f3a-2d6b7e9c1a40","contact":"+244923000000","variables":{"nome":"Ana"},"metadata":{"crm_ticket":"T-1042"}}'

Try it

Send the request from this page, with your key. The key stays on this page: it is not stored and is only sent to api.diska.ai. Use a test key with the fewest scopes you need.

POSThttps://api.diska.ai/v1/chats
Starts with dsk_. It stays in this browser tab only.
Enter an API key (dsk_…).

Response 201

FieldTypeDescription
idstringChat ID (the same as GET /v1/calls/{call_id}).
agent_idstringThe agent.
statusstringactive or ended.
contactstring | nullWho is chatting, as you stated it.
metadataobjectYour metadata, returned as sent.
created_atstringCreation date (ISO 8601).
ended_atstring | nullWhen it ended.
end_reasonstring | nullended_by_api, agent_ended or inactivity.
messagesarrayThe messages, in order.
messages[].idstringMessage ID.
messages[].rolestringuser (the person) or assistant (the agent).
messages[].contentstringThe text.
messages[].created_atstring | nullWhen it was written.
{
  "id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
  "agent_id": "3f1c2a7e-5b9d-4c1e-8f3a-2d6b7e9c1a40",
  "status": "active",
  "contact": "+244900000000",
  "metadata": {},
  "created_at": "2026-10-25T18:40:00Z",
  "ended_at": "2026-10-25T18:41:35Z",
  "end_reason": "caller_hangup",
  "messages": [
    {
      "id": "5c2e8a14-7d3b-4f9e-a1c6-0b8d2f4e6a93",
      "role": "user",
      "content": "Bom dia, queria marcar uma consulta.",
      "created_at": "2026-10-25T18:40:00Z"
    }
  ]
}

Errors

CodeWhen
403API chat is not switched on for the organization.
404Agente não encontrado. (agent not found).
409The agent is not published, is inactive or uses the Flow Builder.
422Variables refused or metadata over the limits.

Errors common to every endpoint (401, 403, 422, 429 and 5xx) are in Errors.

Copyright © 2026