mosoodocs

Send user messages, permission decisions, or interrupts to a Thread

Applies a batch of events to the Thread: send user messages, answer pending permission requests, or interrupt the current Run.

POST/threads/{threadId}/events

Applies a batch of events to the Thread: send user messages, answer pending permission requests, or interrupt the current Run. A user message queues a new Run when the Thread is idle.

Authorization

publicApiBearer
AuthorizationBearer <token>

Use Authorization: Bearer mst_... . API tokens identify an account and do not carry scopes.

In: header

Path Parameters

threadId*string

Thread ID returned by create thread. v1 IDs are bare ULIDs.

Match^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$
Formatulid

Header Parameters

Idempotency-Key?string

Optional key for retry-safe create-thread and send-events calls. Reusing the same key with the same request returns the original response. Reusing the key while the original request is still processing returns 409.

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for posting a batch of events to a Thread.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/threads/01J00000000000000000000009/events" \  -H "Idempotency-Key: thread-20260528-linear-eng-123" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "text": "Say hello from the API.",        "type": "user_message"      }    ]  }'
{  "acceptedAt": "2019-08-24T14:15:22Z",  "events": [    {      "clientRequestId": "string",      "run": {        "completedAt": "2019-08-24T14:15:22Z",        "createdAt": "2019-08-24T14:15:22Z",        "error": {          "code": "string",          "message": "string",          "retryable": true        },        "finalOutput": {          "text": "string"        },        "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",        "startedAt": "2019-08-24T14:15:22Z",        "status": "queued",        "trigger": "user_prompt",        "updatedAt": "2019-08-24T14:15:22Z"      },      "type": "permission_decision"    }  ],  "thread": {    "agent_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",    "attributed_user": {      "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV"    },    "client_external_ref": "string",    "created_at": "2019-08-24T14:15:22Z",    "created_by": {      "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",      "kind": "access_token"    },    "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",    "kind": "pet",    "last_run_id": "01ARZ3NDEKTSV4RRFFQ69G5FAV",    "source": "api",    "status": "IDLE",    "title": "string",    "updated_at": "2019-08-24T14:15:22Z"  },  "warnings": [    {      "code": "string",      "message": "string"    }  ]}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}
{  "error": {    "code": "agent_not_published",    "message": "string"  }}