Skip to main content
Api

Turn

Submit a conversation turn

POST
/agents/{agentId}/sessions/{sessionId}/turn
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

agentId*string

Agent UUID or URL-encoded agent name

sessionId*string

Session identifier

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/agents/string/sessions/string/turn" \  -H "Content-Type: application/json" \  -d '{    "messages": [      {        "role": "user"      }    ],    "userId": "string"  }'
{
  "$schema": "/api/v1/schemas/TurnResponseBody.json",
  "extraction_id": "string",
  "extraction_status": "string",
  "mood": {
    "affiliation": 0.1,
    "arousal": 0.1,
    "reason": "string",
    "tension": 0.1,
    "trigger_type": "string",
    "valence": 0.1
  },
  "next_context": null,
  "success": true
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Poll deferred-turn processing status

GET
/agents/{agentId}/turns/{extractionId}/status
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

agentId*string

Agent UUID or URL-encoded agent name

extractionId*string

Extraction ID returned by POST /turn

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/agents/string/turns/string/status"
{
  "$schema": "/api/v1/schemas/TurnStatusOutputBody.json",
  "error": "string",
  "extraction_id": "string",
  "state": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}