Send a message

Sends an actor-attributed model request through a mind. Every request requires the project bearer key and the `x-mind-actor-token` header issued for the same `mind_id` and `actor_id`. Call this operation only from a trusted backend.

POST/v1/messages

Authorization

bearerAuth
AuthorizationBearer <token>

A project-scoped API key. Store it only on a trusted backend.

In: header

Header Parameters

Idempotency-Key?string

Stable key for safely retrying one logical non-streaming operation. The idempotency_key body field is equivalent; send only one form.

x-mind-actor-token*string

Mind-scoped actor authorization token returned by POST /v1/actor-tokens. It must correspond to the request's mind_id and actor_id.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "Idempotency-Key: 0195cfc0-dabe-7c6f-bb2f-971c749d929a" \  -H "x-mind-actor-token: actor_token_example" \  -H "Content-Type: application/json" \  -d '{    "mind_id": "mind_example",    "actor_id": "user_123",    "idempotency_key": "0195cfc0-dabe-7c6f-bb2f-971c749d929a",    "mind_consistency": "required",    "model": "sonnet",    "max_tokens": 256,    "messages": [      {        "role": "user",        "content": "How should you format my update?"      }    ]  }'
{  "id": "string",  "type": "message",  "role": "assistant",  "content": [    {}  ],  "model": "string",  "stop_reason": "string",  "usage": {},  "mind": {    "influenced_by": [      "string"    ],    "influence_trace": {      "asOf": "2019-08-24T14:15:22Z",      "understandings": [        {          "id": "string",          "statement": "string",          "statementAvailable": true        }      ]    }  }}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "string",    "message": "string"  },  "request_id": "string"}
{  "type": "error",  "error": {    "type": "mind_consistency_error",    "message": "The response was generated, but its mind update is still processing."  },  "request_id": "req_example"}