Pi Durable Platformdocs
ReferenceAgents, threads and templates

Send a message (creates the thread on first use)

POST
/v1/agents/{agentId}/threads/{threadId}/messages

Accepted, not answered; follow the thread's events for the reply. While the agent is busy the message runs after the current reply. A repeated requestId is not submitted twice.

Path Parameters

agentId*string
Formatuuid
threadId*string

Client-chosen thread ID (1-64 letters, digits, dashes or underscores)

Match^[A-Za-z0-9_-]{1,64}$

Request Body

application/json
  1. body

The platform records the thread (its creator and visibility) before relaying the first message. Another's private thread reads as not found (404 thread_not_found), on this and every thread route.

text*string
Lengthlength <= 32000
requestId?string

Idempotency key; a repeated one is not submitted again

Match^[A-Za-z0-9_-]{1,64}$
mcpServers?array<>

The MCP servers this thread's user enabled in the app (replaces the thread's; [] removes them). For template versions with clientMcp, on hosts the platform allows. Never forwarded to the agent: the platform keeps them.

Itemsitems <= 10
visibility?string

The thread's visibility, chosen with its first message (default shared). On a later message it may be omitted; a different value is refused (409 visibility_fixed). The message's author is always the caller: author fields a client sends are ignored.

Value in"shared""private"

Response Body

Accepted

application/json
  1. response
data*
curl -X POST 'https://agents.example.com/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/threads/string/messages' \  -H 'Content-Type: application/json' \  -d '{  "text": "string"}'
{  "data": {    "submissionId": 0  }}