# 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](https://centerofagentic.com/docs/guides/prepare-an-agent). 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](https://centerofagentic.com/docs/authentication) explains the scopes.

```bash
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.

```bash
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.

```bash
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.

```bash
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.

Agents created before activation

An agent created before activation was introduced shows `grantLifecycle` as `legacy_unadopted`. It runs with a plain `POST /api/run`, without a ticket and without the `X-CoA-Agent-Protocol` header, unless your workspace requires activated agents. Sending the header for such an agent returns `409 agent_adoption_required`.

## 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"
  }
}
```

| Field | What it tells you |
| --- | --- |
| `decision` | `allow` or `deny`. A refusal by policy, lifecycle or budget is also returned with HTTP `200`, so always read this field. |
| `reasonCode` | `ALLOWED`, or the reason for a refusal, for example `LIMITED_OUTPUT` or `SPEND_OVER_BUDGET`. |
| `output` | The agent's answer. Empty on a refusal. |
| `receipt.decision` | The 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_layers` | The 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_matched` | Deny rules that matched the request. Any match blocks the requested placement. |
| `receipt.decision.obligations` | Conditions attached to the decision, such as `logging` or `approval`. |
| `receipt.decision.surviving_placements` | Where the operation may still execute after deny rules were applied. |
| `receipt.rawUploaded` | Whether 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`.

```bash
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

| Response | Cause |
| --- | --- |
| `400 no_model_key` | The workspace has no model key. |
| `400 no_model` | No 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](https://centerofagentic.com/docs/guides/prepare-an-agent#activate-an-agent). |
| `200` with `replayed` set to `true` | The 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_scope` | The key does not have the `run` scope. |
| `409 agent_admission_unavailable` | The 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_required` | An activated agent was called without the protocol header. |
| `428 agent_launch_required` | The `X-CoA-Agent-Ticket` header is missing. |
| `429 rate_limited` | Too many runs. Wait for the number of seconds in `Retry-After`, then request a new ticket. |
| `503 model_usage_request_identity_required` | The `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](https://centerofagentic.com/docs/guides/troubleshooting#usage-request-header). |

## Next steps

- [**Run an agent** Streaming, background jobs, outcomes and budgets.](https://centerofagentic.com/docs/guides/run-an-agent)

- [**Core concepts** Agents, authority, runs and receipts in API terms.](https://centerofagentic.com/docs/concepts)

- [**Export evidence** Page through receipts and read the audit log.](https://centerofagentic.com/docs/guides/audit-evidence)

- [**Troubleshooting** Start from the status and error code you see.](https://centerofagentic.com/docs/guides/troubleshooting)

- [**Python** The same calls from Python with the standard library.](https://centerofagentic.com/docs/guides/python)

Source: https://centerofagentic.com/docs/quickstart

## Related pages

- [Prepare a workspace for API runs](https://centerofagentic.com/docs/guides/prepare-an-agent)
- [Authentication](https://centerofagentic.com/docs/authentication)
- [Prepare a workspace for API runs](https://centerofagentic.com/docs/guides/prepare-an-agent#activate-an-agent)
- [Troubleshooting](https://centerofagentic.com/docs/guides/troubleshooting#usage-request-header)
- [Run an agent Streaming, background jobs, outcomes and budgets.](https://centerofagentic.com/docs/guides/run-an-agent)
- [Core concepts Agents, authority, runs and receipts in API terms.](https://centerofagentic.com/docs/concepts)
- [Export evidence Page through receipts and read the audit log.](https://centerofagentic.com/docs/guides/audit-evidence)
- [Troubleshooting Start from the status and error code you see.](https://centerofagentic.com/docs/guides/troubleshooting)
- [Python The same calls from Python with the standard library.](https://centerofagentic.com/docs/guides/python)
