Skip to content

Open a session for a principal

POST
/sessions
curl --request POST \
--url 'https://api.canopyhq.dev/sessions?principal=example' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "executor": { "name": "example", "public_key": "example" }, "inference": "example", "instructions": "example", "params": { "effort": "low", "max_tokens": 1, "stop": [ "example" ], "temperature": 1, "top_p": 1 }, "rounds": 1 }'
principal
required
string

The install’s own name for the user this session is for.

Media typeapplication/json

What the caller supplies for this session: instructions, generation settings, the preset it runs on, and the executor implementing the vendor’s tools.

object
executor
One of:
null
inference
One of:
null
instructions
string
params
object
effort
One of:
null
max_tokens
integer | null format: int64
stop
Array<string>
temperature
number | null format: double
top_p
number | null format: double
rounds
integer format: int32

The new session and a token that attaches to it.

Media typeapplication/json
object
expires
required
integer format: int64
session
required

A stream id: 72 hex chars, the shard then the owner digest.

string
token
required
string
Example
{
"session": "000000000000000000000000000000000000000000000000000000000000000000000000"
}

No principal, or an invalid body; the response names the invalid field when available.

No install key, or one no install answers.

The dial names an inference option the install did not consent to: {"error": "inference_not_allowed", "inference": <id>}. Nothing lands.

The install the key names is gone.

A connected MCP catalog changed.

A connected MCP catalog could not be read.