Skip to content
Documentation menu

Quickstart

Make your first API calls in about ten minutes: create a key, verify it, list agents, run one and read its receipt.

This walkthrough takes you from an empty terminal to a governed agent run and its receipt. Every call goes to https://centerofagentic.com/api with a workspace API key. The examples use curl, jq and uuidgen.

Before you start

  • A workspace you belong to. A key only ever reaches the workspace it was created in.
  • A workspace admin to create the key. Keys are created in the web workspace; a key cannot create another key.
  • A model key. Runs use your workspace's own OpenRouter key, which a workspace admin adds under Settings → Models → Bring your own model. Without it a run returns 400 no_model_key. GET /api/tenant/settings reports hasOpenRouterKey.
  • An agent with an active version. A workspace admin reviews and activates an agent in the builder before it can run. Over the API such an agent shows grantLifecycle as managed and activeGrant.state as available. These pages call it an activated agent.

If someone else administers your workspace, hand them Prepare a workspace for API runs. It is the checklist for the key, the model key and the activated agent.

1. Create an API key

A workspace admin opens Settings → API access, enters a name, ticks the run scope and selects Create key. The secret starts with ak_ and is shown once. run includes read, which is everything this page needs. Authentication explains the scopes.

Shell
export COA_API_KEY="ak_..."

2. Verify the key

GET /api/me accepts any valid key and returns the identity and workspace the key resolves to.

Shell
curl -s https://centerofagentic.com/api/me \
  -H "Authorization: Bearer $COA_API_KEY"
JSON
{
  "userId": "api-key:5d0e7c2a-41b8-4c6f-9f0a-2b7e6d1c3a90",
  "role": "member",
  "access": { "profile": "admin", "capabilities": ["legacy:app"], "human": false },
  "tenant": {
    "id": "9b2d4c1e-7a3f-4f0b-8c6d-2e5a1b0f9c33",
    "clerkOrgId": "org_2xExampleWorkspace",
    "slug": "example-workspace"
  },
  "accessView": {
    "v": 1,
    "profile": "admin",
    "human": false,
    "capabilities": ["legacy:app"],
    "orgRole": "member",
    "credentialKind": "api_key",
    "permissionRegistryVersion": 1,
    "authorizationRevision": 0,
    "computedAt": "2026-11-28T09:14:02.118Z"
  }
}

tenant is your workspace. userId identifies the key itself, and it is the identity recorded on receipts and audit entries. role is always member for an API key: a key never holds the workspace admin role, whatever its scopes. 401 unauthenticated means the key is wrong or revoked, or the admin who created it is no longer an active member.

3. List agents

GET /api/agents returns every agent in the workspace. The jq filter keeps the fields that show whether an agent can run.

Shell
curl -s https://centerofagentic.com/api/agents \
  -H "Authorization: Bearer $COA_API_KEY" \
  | jq '.agents[] | {id, name, status, grantLifecycle, activeGrant}'
JSON
{
  "id": "3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
  "name": "Renewal brief writer",
  "status": "published",
  "grantLifecycle": "managed",
  "activeGrant": {
    "versionId": "c41a7e0d-2f6b-4d83-b1a9-5e0c7f2d8a64",
    "state": "available"
  }
}

Pick an agent whose activeGrant.state is available and keep its id.

4. Run the agent

An activated agent is started with two calls. First ask for a launch ticket, which binds your key, the agent and the exact request. Then send that same request to POST /api/run with the ticket. A ticket is valid for ten minutes and starts one run.

Shell
AGENT_ID="3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11"

# The run request. The ticket is bound to exactly this JSON object.
REQUEST=$(jq -cn --arg agentId "$AGENT_ID" \
  --arg prompt "List three renewal risks for a mid-market software customer." \
  '{agentId: $agentId, prompt: $prompt}')

# First call: the launch ticket. Returns { "ticketId": "...", "expiresAt": "...", "rootId": null }
TICKET=$(jq -cn --arg agentId "$AGENT_ID" --arg nonce "$(uuidgen)" \
    --argjson request "$REQUEST" \
    '{agentId: $agentId, purpose: "run", nonce: $nonce, request: $request}' \
  | curl -s https://centerofagentic.com/api/agent-runtime/ticket \
      -H "Authorization: Bearer $COA_API_KEY" \
      -H "Content-Type: application/json" \
      -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
      -d @- \
  | tee ticket.json | jq -r .ticketId)

# Second call: the run itself.
curl -s https://centerofagentic.com/api/run \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Model-Request: $(date +%s)000.$(uuidgen)" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -H "X-CoA-Agent-Ticket: $TICKET" \
  -d "$REQUEST" | tee run.json

X-CoA-Model-Request identifies the request for usage accounting: the Unix time in milliseconds, a dot and a UUID. If TICKET comes back as null, the ticket request was refused; ticket.json holds the error.

5. Read the result

The response carries the answer, the verdict and the receipt written for the run. This example leaves out some receipt fields, such as prompt, output and steps.

JSON
{
  "output": "1. Budget pressure at renewal time. 2. Low adoption of paid features. 3. A change of executive sponsor.",
  "reasonCode": "ALLOWED",
  "decision": "allow",
  "receipt": {
    "id": "e7b1c9a4-3d52-4f8e-a6c0-1f9d2b7e5a38",
    "agentId": "3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
    "userId": "api-key:5d0e7c2a-41b8-4c6f-9f0a-2b7e6d1c3a90",
    "model": "openai/gpt-4o-mini",
    "decision": {
      "action": "recommend",
      "object": { "dataClass": "internal" },
      "placement_requested": "cloud_model",
      "decision": "allow",
      "reason_code": "ALLOWED",
      "applicable_allowlist_layers": ["tenant_admin", "package_manifest", "role_team", "user_identity"],
      "allow_rules_matched": ["allow_tenant_admin_1", "allow_package_manifest_2", "allow_role_team_3", "allow_user_identity_4"],
      "allowlist_layers_missing_grant": [],
      "deny_rules_matched": [],
      "obligations": [
        { "kind": "logging", "layer": "law_regulation", "ruleId": "obl_logging_8", "reason": "audit_all_runs" },
        { "kind": "confidence_label", "layer": "package_manifest", "ruleId": "obl_confidence_label_9", "reason": "label_confidence" }
      ],
      "surviving_placements": ["local", "cloud_model", "cloud_connector", "cloud_connector_write"],
      "evaluated_at": "2026-11-28T09:16:40.512Z",
      "policy_bundle_id": "tenant-policy-9b2d4c1e"
    },
    "placements": ["local", "cloud_model", "cloud_connector", "cloud_connector_write"],
    "promptTokens": 412,
    "completionTokens": 96,
    "costUsd": 0.000119,
    "latencyMs": 1840,
    "guardrailsPassed": true,
    "rawUploaded": false,
    "createdAt": "2026-11-28T09:16:42.371Z"
  }
}
FieldWhat it tells you
decisionallow or deny. A refusal by policy, lifecycle or budget is also returned with HTTP 200, so always read this field.
reasonCodeALLOWED, or the reason for a refusal, for example LIMITED_OUTPUT or SPEND_OVER_BUDGET.
outputThe agent's answer. Empty on a refusal.
receipt.decisionThe explained policy decision behind the verdict. Its field names use snake_case. Rule ids such as obl_logging_8 are generated for each evaluation, so do not compare them between runs.
receipt.decision.applicable_allowlist_layersThe layers that had to grant this action. allowlist_layers_missing_grant, next to it, names any that did not; an empty list means all of them granted.
receipt.decision.deny_rules_matchedDeny rules that matched the request. Any match blocks the requested placement.
receipt.decision.obligationsConditions attached to the decision, such as logging or approval.
receipt.decision.surviving_placementsWhere the operation may still execute after deny rules were applied.
receipt.rawUploadedWhether raw documents were uploaded during the run.

6. Fetch the receipt

Fetch the stored receipt by the id in the run response, which step 4 saved as run.json.

Shell
curl -s "https://centerofagentic.com/api/receipts/$(jq -r .receipt.id run.json)" \
  -H "Authorization: Bearer $COA_API_KEY" \
  | jq '{id, agentName, assuranceTier, evidenceClass, rawUploaded}'
JSON
{
  "id": "e7b1c9a4-3d52-4f8e-a6c0-1f9d2b7e5a38",
  "agentName": "Renewal brief writer",
  "assuranceTier": 2,
  "evidenceClass": "enforcement",
  "rawUploaded": false
}

The stored receipt is the record to keep. It adds the agent name and the assurance fields: tier 2 with class enforcement means the server decided and dispatched the run. The copy inside the run response is produced before those two fields are set, so they are null there.

If a call is refused

ResponseCause
400 no_model_keyThe workspace has no model key.
400 no_modelNo model is named in the request, in the agent's active version or as the workspace default. For an activated agent, setting a default model now is not enough: an active version keeps the model it was captured with. A workspace admin sets a model on the agent, or a default model under Settings → Models → Bring your own model, then prepares and activates the agent's draft again. See Prepare a workspace for API runs.
200 with replayed set to trueThe ticket was already used, so no new run started and the response has no output, decision or receipt. The first run request uses up its ticket even when it fails, for example with 400 no_model_key. If root.status is failed, fix the cause and run the whole block in step 4 again; it requests a new ticket. With any other status, look for the first request's receipt with GET /api/receipts before you run again.
403 insufficient_scopeThe key does not have the run scope.
409 agent_admission_unavailableThe agent has no active version, is paused or revoked, the ticket expired, or the run body differs from the ticket's request.
426 agent_protocol_requiredAn activated agent was called without the protocol header.
428 agent_launch_requiredThe X-CoA-Agent-Ticket header is missing.
429 rate_limitedToo many runs. Wait for the number of seconds in Retry-After, then request a new ticket.
503 model_usage_request_identity_requiredThe X-CoA-Model-Request header is missing. The model was not called, but the ticket was used: add the header and run the whole block in step 4 again. A malformed value does not give this error; the run then ends with HTTP 200 and decision set to deny. See Troubleshooting.

Next steps

Something missing or unclear? Tell us and we will improve this page.