Skip to main content
POST
/
api
/
v1
/
principals
Create principal
import requests

url = "https://api.example.com/api/v1/principals"

payload = {
    "external_id": "<string>",
    "type": "human",
    "name": "<string>",
    "metadata": {}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "result": {
    "created": true,
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "<string>",
    "type": "human",
    "name": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "metadata": {},
    "is_temporary": false,
    "owner_principal_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "onboarding_session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  },
  "success": true,
  "suggestion": "",
  "message": "",
  "meta": {
    "total": 123,
    "offset": 123,
    "limit": 123,
    "has_more": true,
    "after": "<string>",
    "before": "<string>"
  }
}

Headers

X-Assistant-Service-Key
string | null

Body

application/json

Request payload for creating a principal.

external_id
string
required

Your system's identifier for this principal (for example, a user ID). Must be unique. Max 255 characters.

Required string length: 1 - 255
type
enum<string>
required

The principal type. Possible values: human, agent.

Available options:
human,
agent
name
string
required

The display name for this principal. Max 255 characters.

Required string length: 1 - 255
metadata
Metadata · object

Arbitrary key-value metadata to associate with the principal.

Response

Already exists (idempotent). Successful Response

result
PrincipalCreateResult · object
required

Create principal response payload with idempotency metadata.

success
boolean
default:true
suggestion
string
default:""
message
string
default:""
meta
PaginationMeta · object

Pagination metadata for list responses.

Supports both legacy offset-based and cursor-based pagination. Cursor fields (has_more, after, before) are populated for cursor-paginated endpoints. Legacy fields (offset, limit) are populated when the caller uses the deprecated offset parameter.