Skip to main content
SONZAI
Api

Generation

Generate a character and create the agent

POST
/agents/generate-and-create
AuthorizationBearer <token>

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

In: header

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/generate-and-create" \  -H "Content-Type: application/json" \  -d '{    "description": "string",    "name": "string"  }'
null
{
  "$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"
}

Generate a character profile from a description

POST
/agents/generate-character
AuthorizationBearer <token>

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

In: header

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/generate-character" \  -H "Content-Type: application/json" \  -d '{    "description": "string",    "name": "string"  }'
null
{
  "$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"
}

Regenerate agent avatar

POST
/agents/{agentId}/avatar/generate
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.

style?string

Avatar art style override

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/agents/string/avatar/generate" \  -H "Content-Type: application/json" \  -d '{}'
{
  "$schema": "/api/v1/schemas/RegenerateAvatarOutputBody.json",
  "avatar_url": "string",
  "generation_time_ms": 0,
  "prompt": "string",
  "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"
}

Generate agent bio

POST
/agents/{agentId}/bio/generate
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/bio/generate" \  -H "Content-Type: application/json" \  -d '{    "description": "string",    "name": "string"  }'
{
  "$schema": "/api/v1/schemas/GenerateBioOutputBody.json",
  "bio": "string",
  "confidence": 0.1,
  "tone": "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"
}

Generate an image

POST
/agents/{agentId}/image/generate
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/image/generate" \  -H "Content-Type: application/json" \  -d '{    "prompt": "string"  }'
{
  "$schema": "/api/v1/schemas/GenerateImageOutputBody.json",
  "gcs_uri": "string",
  "generation_time_ms": 0,
  "image_id": "string",
  "mime_type": "string",
  "public_url": "string",
  "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"
}

Generate seed memories for an agent

POST
/agents/{agentId}/memory/seed
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/memory/seed" \  -H "Content-Type: application/json" \  -d '{    "agentName": "string",    "personalityPrompt": "string",    "speechPatterns": [      "string"    ],    "trueInterests": [      "string"    ]  }'
{
  "$schema": "/api/v1/schemas/GenerateSeedMemoriesOutputBody.json",
  "memories": [
    {
      "content": "string",
      "entities": [
        "string"
      ],
      "factType": "string",
      "importance": 0.1
    }
  ]
}
{
  "$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"
}