API access
By the end of this page you will have created an API key and know how to call a deployed agent from your own code.
Prerequisites
- Admin role.
- A deployment with at least one agent. See Managing agents.
API keys
Programmatic access to a deployment uses API keys. A key is a secret token (prefixed qr_) that you send with each request. Keys are:
- Scoped — each key grants only the actions you choose.
- Shown once — the full key is displayed only at creation. Store it securely; you can’t view it again.
- Expirable and revocable — set an expiry, and rotate or revoke at any time.
The API Keys tab
Open a deployment and select API Keys to see active keys — each with its name, prefix, scopes, expiry, and last-used time.
Creating a key
Open the create dialog
Click Create Key and give it a descriptive name (for example, bi-dashboard).
Choose a scope and expiry
Pick the scope the key needs and how long it should live.
Copy the key
The full key is shown once. Copy it now and store it in your secret manager — you won’t be able to see it again.
Scopes
| Scope | Grants |
|---|---|
invoke | Trigger agent runs |
runs:read | View runs and logs |
runs:write | Manage runs |
hil:resume | Resume a human-in-the-loop step |
info:read | View deployment info |
a2a | Agent-to-agent protocol — the JSON-RPC endpoint and the legacy task endpoints |
Grant the narrowest scope that works. Each key you create here holds one scope — a dashboard that only triggers an agent needs invoke; if it also displays results, create a second key with runs:read. Use a2a for other agents calling yours — see agent-to-agent access and A2A integration.
The a2a scope covers the whole JSON-RPC endpoint rather than individual methods: the method name travels in the request body, so it cannot be scoped per call. Card discovery needs no key at all.
Calling a deployment
Send requests to the deployment’s base URL with your key in the Authorization header:
# AI Agent — the conversation endpoint returns the reply directly
curl https://your-deployment.qraptor.app/agents/{agentId}/conversation \
-H "Authorization: Bearer qr_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "message": "What was total revenue on 2026-07-20?" }'The exact endpoints depend on the agent type — open an agent’s Endpoints panel in the Agents tab to copy its URLs.
AI Agent endpoints
| Endpoint | Method | What it does | Scope |
|---|---|---|---|
/agents/{id}/run | POST | Single invocation — matches a skill, runs the reasoning loop, returns one complete response. Stateless. | invoke |
/agents/{id}/conversation | POST | Multi-turn chat — like run, but keeps session memory across turns (pass a session id). | invoke |
/agents/{id}/stream | POST | Streaming — streams the reply as live events over SSE. Use it for chat UIs. | invoke |
/agents/{id}/runs | GET | List this agent’s past runs. | runs:read |
run, conversation, and stream all return the reply directly — pick stream when you want tokens as they generate, conversation when you need memory across turns, run for a one-shot call.
Task Agent endpoints
A Task Agent runs a graph, which is asynchronous — you trigger it, then read the result:
| Endpoint | Method | What it does | Scope |
|---|---|---|---|
/agents/{id}/run | POST | Trigger a graph run. Returns a run_id immediately — not the output. | invoke |
/agents/{id}/runs/{run_id} | GET | Get a run’s status and output. | runs:read |
/agents/{id}/runs | GET | List this agent’s runs. | runs:read |
/agents/{id}/runs/{run_id}/stream | GET | Stream a run’s live execution events over SSE. | runs:read |
Agent-to-agent (A2A) endpoints
Available only when A2A is enabled on an AI Agent. qRaptor implements the A2A protocol over JSON-RPC 2.0 — the message/send generation, which covers A2A 0.2.x and 0.3.0. Any compliant A2A client works, including agent frameworks such as Google ADK and LangGraph.
Discovery is public; the JSON-RPC endpoint needs an API key with the a2a scope — a separate key from invoke, since the Create Key dialog gives each key one scope.
| Endpoint | Method | What it does | Scope |
|---|---|---|---|
/agents/{id}/.well-known/agent-card.json | GET | The agent’s card (A2A 0.3.0+) — capabilities, for discovery. | public |
/agents/{id}/.well-known/agent.json | GET | The agent’s card for A2A 0.2.x clients. | public |
/agents/{id}/a2a | POST | JSON-RPC endpoint — message/send, message/stream, tasks/get, tasks/cancel. | a2a |
/agents/{id}/a2a/v0.2 · /v0.3 | POST | Same, with the protocol version pinned. | a2a |
Flow: a calling agent fetches the card, then POSTs message/send to the url the card advertises. The reply is a Task carrying the agent’s answer in result.artifacts:
curl -X POST https://your-deployment.qraptor.app/agents/{agentId}/a2a \
-H "Authorization: Bearer qr_your_a2a_key" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "req-001",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{ "kind": "text", "text": "What was total revenue on 2026-07-20?" }],
"messageId": "msg-0001"
}
}
}'See A2A integration for the full reference: version support, streaming, long-running tasks, error codes and client walkthroughs.
Legacy REST task endpoints (deprecated). Before JSON-RPC support, qRaptor exposed a REST task API at /agents/{id}/tasks. It still works and still uses the a2a scope, but it is not the A2A protocol and will be removed after two release notices. Migrate to /agents/{id}/a2a.
| Legacy endpoint | Method | Replacement |
|---|---|---|
/agents/{id}/tasks | POST | message/send |
/agents/{id}/tasks/{taskId} | GET | tasks/get |
/agents/{id}/tasks/{taskId}/events | GET | message/stream |
/agents/{id}/tasks/{taskId}/cancel | POST | tasks/cancel |
Multi-agent systems
A deployed system is called at its own endpoint — /mas/{systemId}/conversation/stream (POST, SSE). The router dispatches to the right member internally.
Triggering a Task Agent, then reading the result
A Task Agent’s POST /run is asynchronous — it starts the run and returns a run id immediately, not the final output:
# 1. Trigger — needs the `invoke` scope
curl -X POST https://your-deployment.qraptor.app/agents/{agentId}/run \
-H "Authorization: Bearer qr_invoke_key" \
-H "Content-Type: application/json" \
-d '{ "execution_mode": "production" }'
# → { "run_id": "…", "status": "queued" }
# 2. Poll the result — needs the `runs:read` scope
curl https://your-deployment.qraptor.app/agents/{agentId}/runs/{run_id} \
-H "Authorization: Bearer qr_runs_read_key"The Create Key dialog assigns one scope per key, so triggering (invoke) and reading results (runs:read) need two keys — or use the deploy wizard’s generated key, which carries both. In the Studio you can also just open the run in Executions.
Rotating and revoking
- Rotate — issues a new key and revokes the old one. Update your integrations with the new key.
- Revoke — disables a key immediately. Any request using it starts failing.
Deleting a deployment revokes all of its API keys. Integrations using those keys stop working.
Common issues
- 401 Unauthorized — the key is missing, revoked, expired, or for a different deployment.
- 403 Forbidden — the key’s scope doesn’t cover the action. Create a key with the right scope.
- 429 Too Many Requests — you hit a rate limit.