Skip to content
Developer documentationView Markdown

Create an agent (a project key may also grant defaults) ​

POST /v1/agents

See https://ordan.io/docs/authentication and https://ordan.io/docs/errors for authority, scopes and retries. Paid usage reports customer charges; preview usage reports provider-cost allowance consumption. Money fields use the units specified in their schemas.

Operation ID: post__v1_agents.

Authentication ​

Use one of these authentication alternatives. Schemes on the same line are required together:

  • sessionCookie (cookie: ordan_session)
  • bearerAgent (bearer token)
  • bearerKey (bearer token)

Organization roles, key scopes, grant capabilities, policy and spend limits still apply. See Authentication.

Request ​

Header parameters ​

ParameterTypeRequiredDescription / constraints
Idempotency-KeystringNoOne key per logical operation; reuse only with identical body. Retrieve committed resources after ambiguous outcomes.

Body (required) ​

Content type: application/json

Type: object

Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.

FieldTypePresenceDescription / constraints
capabilitiesArray of voice.outbound, voice.inbound, sms.send, sms.receive, numbers.provision, numbers.release, calls.transfer, calls.hangup, calls.record, calls.dtmf, purchases, policy.check, usage.read, events.readOptionalminItems: 1
descriptionstringOptionalmaxLength: 2000
namestringRequiredminLength: 1. maxLength: 120
orgstringOptionalPublic org_… reference (not a UUID). pattern: ^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$
policystringOptionalPublic pol_… reference (not a UUID). pattern: ^pol_[0-7][0-9A-HJKMNP-TV-Z]{25}$
projectstringOptionalPublic proj_… reference (not a UUID). pattern: ^proj_[0-7][0-9A-HJKMNP-TV-Z]{25}$
runtimeexternal, ordan_managed, vapiOptionalA label only; it does not change what ORDan does. external (the default): you run the agent's runtime. The other values are reserved and select nothing today. default: external
spend_limit_centsintegerOptionalminimum: 1. maximum: 100000000
JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "capabilities": {
      "items": {
        "enum": [
          "voice.outbound",
          "voice.inbound",
          "sms.send",
          "sms.receive",
          "numbers.provision",
          "numbers.release",
          "calls.transfer",
          "calls.hangup",
          "calls.record",
          "calls.dtmf",
          "purchases",
          "policy.check",
          "usage.read",
          "events.read"
        ],
        "type": "string"
      },
      "minItems": 1,
      "type": "array"
    },
    "description": {
      "maxLength": 2000,
      "type": "string"
    },
    "name": {
      "maxLength": 120,
      "minLength": 1,
      "type": "string"
    },
    "org": {
      "description": "Public org_… reference (not a UUID)",
      "pattern": "^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
      "type": "string"
    },
    "policy": {
      "description": "Public pol_… reference (not a UUID)",
      "pattern": "^pol_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
      "type": "string"
    },
    "project": {
      "description": "Public proj_… reference (not a UUID)",
      "pattern": "^proj_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
      "type": "string"
    },
    "runtime": {
      "default": "external",
      "description": "A label only; it does not change what ORDan does. external (the default): you run the agent's runtime. The other values are reserved and select nothing today",
      "enum": [
        "external",
        "ordan_managed",
        "vapi"
      ],
      "type": "string"
    },
    "spend_limit_cents": {
      "maximum": 100000000,
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "name"
  ],
  "type": "object"
}

Request examples ​

These are request templates, not executed requests. Replace REPLACE_… and <…> placeholders, set the credential environment variables, and supply any conditional fields your action needs. JSON values are illustrative, not live records. Use a stable idempotency key per logical operation.

bash
curl --request POST --url 'https://api.ordan.io/v1/agents' \
  --header "Authorization: Bearer $ORDAN_AGENT_TOKEN" \
  --header "Idempotency-Key: $ORDAN_IDEMPOTENCY_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "name": "<name>"
}'
js
const response = await fetch("https://api.ordan.io/v1/agents", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.ORDAN_AGENT_TOKEN,
    "Idempotency-Key": "" + process.env.ORDAN_IDEMPOTENCY_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "name": "<name>"
}),
});
const text = await response.text();
if (!response.ok) throw new Error(`${response.status}: ${text}`);
const result = text ? JSON.parse(text) : null;
python
import json
import os
from urllib.request import Request, urlopen

request = Request("https://api.ordan.io/v1/agents",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["ORDAN_AGENT_TOKEN"],
        "Idempotency-Key": "" + os.environ["ORDAN_IDEMPOTENCY_KEY"],
        "Content-Type": "application/json",
    },
    data="{\n  \"name\": \"<name>\"\n}".encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
    text = response.read().decode("utf-8")
    result = json.loads(text) if text else None

Responses ​

StatusMeaning
400Invalid request; device token polling uses RFC 8628 string errors
402spend_limit_exceeded: inspect details.scope (org/grant/line) and outstanding_micros
403Missing authority, policy_violation, approval_required (details.approval_request), limit_reached, destination_not_supported or feature_disabled (details.feature)
409Conflict, idempotency in progress, or a2p_registration_pending; retrieve state instead of duplicating work
422validation_error: the request is not valid; details name each field
429Rate limited; back off and retain the same idempotency key
502provider_error: unknown routes need verified quotes; ambiguous operations retain resource references and cost holds
2XXSuccess (created objects use 201)
defaultError

Status ranges such as 2XX are retained exactly as declared. See Errors and recovery for retries and pending outcomes.

400 response ​

Content type: application/json

Type: Error

Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.

FieldTypePresenceDescription / constraints
errorobjectRequiredAdditional properties allowed
error.codestringRequired—
error.detailsobjectOptionalAdditional properties allowed
error.messagestringRequired—
JSON Schema
json
{
  "$ref": "#/components/schemas/Error"
}

2XX response ​

Content type: application/json

Type: Agent

Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.

FieldTypePresenceDescription / constraints
created_atstring (date-time)Optional—
grantstringOptionalPublic grant_… reference (not a UUID). pattern: ^grant_[0-7][0-9A-HJKMNP-TV-Z]{25}$
grantsArray of GrantOptionalGET /v1/agents/{id} only: the agent's grants, newest first, each with its bound Lines
idstringRequiredPublic agent_… reference (not a UUID). pattern: ^agent_[0-7][0-9A-HJKMNP-TV-Z]{25}$
namestringRequiredminLength: 1. maxLength: 120
orgstringOptionalPublic org_… reference (not a UUID). pattern: ^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$
projectstringOptionalPublic proj_… reference (not a UUID). pattern: ^proj_[0-7][0-9A-HJKMNP-TV-Z]{25}$
runtimeexternal, ordan_managed, vapiOptionalA label only; it does not change what ORDan does. external (the default): you run the agent's runtime. The other values are reserved and select nothing today. default: external
statusactive, suspendedOptional—
JSON Schema
json
{
  "$ref": "#/components/schemas/Agent"
}
Illustrative response template

Placeholder values show the shape, not a live response. Nullable costs remain null rather than implying zero usage.

json
{
  "created_at": "<created_at>",
  "grant": "<grant>",
  "grants": [
    {
      "agent": "<agent>",
      "capabilities": [
        "voice.outbound"
      ],
      "expires_at": null,
      "id": "<id>",
      "lines": [
        "<lines>"
      ],
      "org": "<org>",
      "policy_version": "<policy_version>",
      "revoked_at": null,
      "spend_limit_cents": 0
    }
  ],
  "id": "<id>",
  "name": "<name>",
  "org": "<org>",
  "project": "<project>",
  "runtime": "external",
  "status": "active"
}

default response ​

Content type: application/json

Type: Error

Required means required within its containing object, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.

FieldTypePresenceDescription / constraints
errorobjectRequiredAdditional properties allowed
error.codestringRequired—
error.detailsobjectOptionalAdditional properties allowed
error.messagestringRequired—
JSON Schema
json
{
  "$ref": "#/components/schemas/Error"
}