Skip to main content
POST
/
api
/
v1
/
text-chat
/
completion
Run one stateless text-chat completion turn.
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    agent: {id: '<string>'},
    messages: [
      {
        role: '<string>',
        content: '<string>',
        tool_calls: [
          {
            id: '<string>',
            name: '<string>',
            arguments: '<unknown>',
            response: '<unknown>'
          }
        ],
        time: '2023-11-07T05:31:56Z'
      }
    ],
    state: '<string>',
    additional_data: {},
    finish: true
  })
};

fetch('https://blackbox.dasha.ai/api/v1/text-chat/completion', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "messages": [
    {
      "role": "<string>",
      "content": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "name": "<string>",
          "arguments": "<unknown>",
          "response": "<unknown>"
        }
      ],
      "time": "2023-11-07T05:31:56Z"
    }
  ],
  "state": "<string>",
  "is_final": true,
  "chat_id": "<string>",
  "call_id": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.blackbox.dasha.ai/llms.txt

Use this file to discover all available pages before exploring further.

Body

Completion request with the agent reference, conversation, and prior state.

Stateless text-chat completion request. Carries the full conversation history (client-owned) plus the encrypted server-issued DashaAI.BlackBox.AgentAPI.TextChat.Dtos.TextChatCompletionRequest.State from the previous turn.

agent
object
required

Agent to drive the completion — by id or by inline config.

messages
object[]
required

Complete conversation history including the new user message at the end. Tool calls are bundled in the previous assistant turn(s).

state
string | null

Opaque encrypted state from the previous turn. Null/omitted on the first turn.

additional_data
object

Free-form variable bag merged into agent prompt template variables (e.g. {{customerName}}). Matches the project-wide AdditionalData convention.

finish
boolean | null

Client/user signal to end the conversation. When true, this turn still produces an assistant reply (if any) and then runs the same finish pipeline as the agent's finishTheConversation built-in: post-call analysis + completion webhook + persistence + audit events.

Response

Completion succeeded.

Result of a single stateless text-chat completion turn.

messages
object[] | null

New messages produced during this turn. Ordered: any assistant tool-turns first (each bundling its tool calls with their executed responses), followed by the final plain-text assistant reply.

state
string | null

Opaque encrypted state to carry forward to the next turn.

is_final
boolean

True when the agent has signalled end-of-conversation (e.g. finishTheConversation).

chat_id
string | null

Server-issued correlation id. Stable across turns. Surfaced for logging.

call_id
string | null

Internal Blackbox call id for this conversation. Stable across turns. Referenced in completion webhooks, the persisted call result, and audit events.