Aex Brain
ReferenceAPI

Create a session

Create a conversation using the harness supplied at Brain startup. Supply the model credential and the tools this session may use.

POST/v1/sessions

Authorization

serverToken
AuthorizationBearer <token>

The server's BRAIN_API_TOKEN, sent as Authorization: Bearer . Required for application API calls when configured; optional only on a loopback server started without a token.

In: header

Header Parameters

Idempotency-Key*string
Length1 <= length <= 256

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/sessions" \  -H "Idempotency-Key: string" \  -H "Authorization: Bearer YOUR_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "agentloop": {      "configuration": {},      "name": "pi"    },    "environments": [      {        "configuration": {},        "driver": "brain",        "lifecycle": "automatic",        "name": "brain"      }    ],    "model": {      "api_key": "YOUR_MODEL_API_KEY",      "name": "gpt-4.1-mini",      "provider": "openai"    },    "tools": []  }'
{  "last_sequence": 0,  "session_id": "string",  "status": "creating"}