Skip to content
Conversation API

Conversation API

The full endpoint reference is generated from the OpenAPI definition at /conversation-api/index.html. This guide covers the parts that the reference does not explain: authentication, starting a conversation, waiting and streaming, tags, files, notification channels, tracing and routes.

Authentication

Send the API key token as a bearer token. The token is shown once, when you create the key. The API key needs the scope Converse with meshes. Every example in this guide uses this form:

curl -H "Authorization: Bearer <API_KEY_TOKEN>" https://api.partite.ai/conversations/<CONVERSATION_ID>

Start a conversation

Send POST /conversations with a JSON body. The mesh object names the mesh and exactly one of its versions:

  • "version": 3 uses version 3.
  • "version_label": "prod" uses the version with the label prod.
  • "draft": true uses the draft. The draft is never used by default.

With input, the same call also sends the first message. Name the intent when the mesh has more than one.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -X POST https://api.partite.ai/conversations \
  -H "Content-Type: application/json" \
  -d '{
    "mesh": {"id": "<MESH_ID>", "version_label": "prod"},
    "intent": "AnalyzeIssue",
    "input": {"issueText": "App crashes when saving after upgrade to v2.3"}
  }'

The response is 201. It has the conversation: id, external_id, mesh (id and version_id), tags, created_at and updated_at. When you sent input, it also has the request that the message started. The Location header points to the conversation.

To list the intents of a conversation, with the schemas of their inputs and responses, send GET /conversations/{conversation_id}/intents.

Send a message

Send POST /conversations/{conversation_id}/requests. The body has input, and optionally intent and tags.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -X POST https://api.partite.ai/conversations/<CONVERSATION_ID>/requests \
  -H "Content-Type: application/json" \
  -d '{"input": {"issueText": "It also crashes on export"}}'

The response is 201 with the request. A request has these fields: id, status, input, tags and created_at. It also has one of these fields, depending on the status:

StatusField
runningnone
waitingtasks: the open tasks. See Client tasks.
completedresponse
failederror
cancellednone

GET /conversations/{conversation_id}/requests/{request_id} returns a request. GET /conversations/{conversation_id}/requests returns all requests of the conversation, oldest first.

To cancel a request, send POST .../requests/{request_id}/cancel.

Conversation identity

Set external_id when you start a conversation. Use your own ticket ID or thread ID. The external ID follows these rules:

  • It has 1 to 255 bytes.
  • It is immutable.
  • It is unique in your organization. A duplicate returns 409.

Every path that takes {conversation_id} also takes extid= followed by the percent-encoded external ID.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  https://api.partite.ai/conversations/extid=ticket-4821

Waiting and streaming

By default, the POSTs and GET on a request return JSON at once. A new request is usually still running.

To wait for the result, add ?wait=N. The call returns when the request leaves running, or after N seconds. The maximum is 50 seconds. wait works on POST /conversations, on POST .../requests and on GET .../requests/{request_id}.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  "https://api.partite.ai/conversations/<CONVERSATION_ID>/requests/<REQUEST_ID>?wait=30"

To stream the events of a request, send GET .../requests/{request_id}/events. You can also stream from the POST that starts the request: send a streaming Accept header on it. The Accept header sets the format:

AcceptResult
text/event-streamServer-sent events (SSE). This is the default for GET .../events.
application/jsonlJSON lines. application/x-ndjson also works.
curl -N -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -H "Accept: application/jsonl" \
  https://api.partite.ai/conversations/<CONVERSATION_ID>/requests/<REQUEST_ID>/events

Every stream starts with a started event. It has the conversation_id and the request_id. The other event types are thinking, message, task, task_response, response, error, cancelled and server_error.

The events response, error and cancelled end the request and the stream. A stream stays open while the request waits on a task.

In SSE, the event name is the event type. The exception is error, which is named request_error, because a browser’s EventSource fires error when the connection fails.

A server_error event means the server could not read the stream further. To resume a stream, send GET .../events again with Last-Event-ID set to the last event ID that you received. Never repeat the POST to resume.

Tags

Tags are name and value pairs. Set them in the body:

  • tags on POST /conversations sets the conversation tags.
  • tags on POST .../requests sets the request tags. Every request also carries the conversation tags.
"tags": [{"name": "env", "value": "dev"}, {"name": "developer", "value": "bob"}]

Tags are immutable. Tags drive these features:

  • Conversation tags route MCP tunnel subscriptions.
  • Request tags select memory slices and identify speakers.
  • Schedules stamp the tags schedule_id and scheduled_for.

Files

To attach files to one message, send multipart/form-data. Put the JSON body in a part named params. Put each file in a part named attachments. The input refers to a file as {"$ref": "attachment://<filename>"}.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -X POST https://api.partite.ai/conversations/<CONVERSATION_ID>/requests \
  -F 'params={"input": {"report": {"$ref": "attachment://crash.log"}}};type=application/json' \
  -F 'attachments=@crash.log'

To give the conversation files that later messages can use, send them to POST /conversations/{conversation_id}/resources in parts named files. GET .../resources lists everything the conversation holds, including what MCP servers added. Each entry has a reference, such as {"$ref": "resource://r1"}. Put the reference in an input to refer to the resource.

A JSON body can be at most 4 MiB. A multipart body can be at most 32 MiB, files included.

Notification channels

A notification channel is one feed for many conversations. Every request output of every conversation that is bound to the channel appears in the channel. The outputs appear in one ordered sequence.

To create a channel, use one of these methods:

  • Send PUT /notification-channels/{id}. The response is 201 for a new channel and 200 if the channel existed.
  • Set notification_channel in the body when you start a conversation.
curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -X PUT https://api.partite.ai/notification-channels/support-inbox

To read a channel, send GET /notification-channels/{id}/events. The Accept header sets the format:

AcceptResult
text/event-streamStreams server-sent events (SSE). This is the default.
application/jsonlStreams JSON lines. application/x-ndjson also works.
application/jsonReturns one page. Use limit (default 100, maximum 1000). The response has a next cursor.

If the Accept header allows none of these formats, the response is 406.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -H "Accept: application/json" \
  "https://api.partite.ai/notification-channels/support-inbox/events?limit=100"

To resume a stream, set Last-Event-ID to an event ID from the channel.

Tracing

Set "tracing": false when you start a conversation to turn tracing off for the whole conversation. Tracing is on by default. You cannot change the setting later.

curl -H "Authorization: Bearer <API_KEY_TOKEN>" \
  -X POST https://api.partite.ai/conversations \
  -H "Content-Type: application/json" \
  -d '{"mesh": {"id": "<MESH_ID>", "version_label": "prod"}, "tracing": false}'

Routes

A Route picks a Mesh version for a new conversation. To use a Route, set route_id instead of mesh when you start a conversation.

{"route_id": "<ROUTE_ID>", "input": {"issueText": "..."}}

The Route picks a version at random, by weight. For the Route settings, see Routes.

Errors

Errors are application/problem+json documents (RFC 9457). The param field names the input that the problem is with. A body field that the API does not know is an error.

Related