Skip to main content
SONZAI
Api

Instances

List agent instances

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

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/agents/string/instances"
{
  "$schema": "/api/v1/schemas/ListInstancesOutputBody.json",
  "instances": [
    {
      "$schema": "/api/v1/schemas/AgentInstance.json",
      "agent_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "description": "string",
      "instance_id": "string",
      "is_default": true,
      "name": "string",
      "status": "string",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ]
}
{
  "$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 an agent instance

POST
/agents/{agentId}/instances
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/instances" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{
  "$schema": "/api/v1/schemas/AgentInstance.json",
  "agent_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "instance_id": "string",
  "is_default": true,
  "name": "string",
  "status": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$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"
}

Get a single instance

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

instanceId*string

Instance UUID

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/agents/string/instances/string"
{
  "$schema": "/api/v1/schemas/AgentInstance.json",
  "agent_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "instance_id": "string",
  "is_default": true,
  "name": "string",
  "status": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$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 an instance

PATCH
/agents/{agentId}/instances/{instanceId}
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

instanceId*string

Instance UUID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X PATCH "https://loading/api/v1/agents/string/instances/string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "$schema": "/api/v1/schemas/AgentInstance.json",
  "agent_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "instance_id": "string",
  "is_default": true,
  "name": "string",
  "status": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$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 an instance

DELETE
/agents/{agentId}/instances/{instanceId}
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

instanceId*string

Instance UUID

Response Body

application/json

application/problem+json

curl -X DELETE "https://loading/api/v1/agents/string/instances/string"
{
  "$schema": "/api/v1/schemas/DeleteInstanceOutputBody.json",
  "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"
}

Reset an instance

POST
/agents/{agentId}/instances/{instanceId}/reset
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

instanceId*string

Instance UUID

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/agents/string/instances/string/reset"
{
  "$schema": "/api/v1/schemas/ResetInstanceOutputBody.json",
  "facts_deleted": 0,
  "instance": {
    "$schema": "/api/v1/schemas/AgentInstance.json",
    "agent_id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "description": "string",
    "instance_id": "string",
    "is_default": true,
    "name": "string",
    "status": "string",
    "updated_at": "2019-08-24T14:15:22Z"
  },
  "nodes_deleted": 0
}
{
  "$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"
}