Skip to main content
SONZAI
Api

Goals

List breakthroughs for an agent

GET
/agents/{agentId}/breakthroughs
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

Query Parameters

user_id?string

Optional user ID to scope breakthroughs

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/agents/string/breakthroughs"
{
  "$schema": "/api/v1/schemas/BreakthroughsResponse.json",
  "breakthroughs": [
    {
      "achieved_goals": [
        "string"
      ],
      "acknowledged": true,
      "agent_id": "string",
      "breakthrough_id": "string",
      "breakthrough_number": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "level_at_breakthrough": 0,
      "narrative": "string",
      "new_goals": [
        "string"
      ],
      "personality_shifts": [
        "string"
      ],
      "skill_points_awarded": 0,
      "trait_evolved": "string",
      "user_id": "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"
}

List goals for an agent

GET
/agents/{agentId}/goals
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

Query Parameters

user_id?string

Optional user ID to scope goals

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/agents/string/goals"
{
  "$schema": "/api/v1/schemas/GoalsResponse.json",
  "goals": [
    {
      "$schema": "/api/v1/schemas/Goal.json",
      "achieved_at": "2019-08-24T14:15:22Z",
      "agent_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "description": "string",
      "goal_id": "string",
      "priority": 0,
      "related_traits": [
        "string"
      ],
      "status": "string",
      "title": "string",
      "type": "string",
      "updated_at": "2019-08-24T14:15:22Z",
      "user_id": "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"
}

Create a goal for an agent

POST
/agents/{agentId}/goals
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

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/goals" \  -H "Content-Type: application/json" \  -d '{}'
{
  "$schema": "/api/v1/schemas/Goal.json",
  "achieved_at": "2019-08-24T14:15:22Z",
  "agent_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "goal_id": "string",
  "priority": 0,
  "related_traits": [
    "string"
  ],
  "status": "string",
  "title": "string",
  "type": "string",
  "updated_at": "2019-08-24T14:15:22Z",
  "user_id": "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"
}

Delete (abandon) a goal

DELETE
/agents/{agentId}/goals/{goalId}
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

goalId*string

Goal identifier

Query Parameters

user_id?string

Optional user ID for per-user goals

Response Body

application/problem+json

curl -X DELETE "https://loading/api/v1/agents/string/goals/string"
Empty
{
  "$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"
}

Update a goal

PUT
/agents/{agentId}/goals/{goalId}
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

goalId*string

Goal identifier

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X PUT "https://loading/api/v1/agents/string/goals/string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "$schema": "/api/v1/schemas/Goal.json",
  "achieved_at": "2019-08-24T14:15:22Z",
  "agent_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "goal_id": "string",
  "priority": 0,
  "related_traits": [
    "string"
  ],
  "status": "string",
  "title": "string",
  "type": "string",
  "updated_at": "2019-08-24T14:15:22Z",
  "user_id": "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"
}