API for agents’ own code
For agents that write their own code instead of using MCP tools. The code calls a system's ordinary REST API through Backa, and every change it makes lands in your audit log with Rollback.
Address
https://api.backa.ai/v1/<system>/<the system's own path>
Send exactly the request you would send to the system, with the same method, query and JSON body. You get the system's own answer back. For example, HubSpot's /crm/v3/objects/contacts becomes:
GET https://api.backa.ai/v1/hubspot/crm/v3/objects/contacts?limit=10
Authorization: Bearer <token>
Systems
| System | Id | The path after the id |
|---|---|---|
| GitHub | github | REST API paths, such as /repos/acme/web/issues |
| HubSpot | hubspot | Paths on api.hubapi.com, such as /crm/v3/objects/deals |
| Salesforce | salesforce | Paths on your instance, such as /services/data/v62.0/sobjects/Account |
| Notion | notion | Paths on api.notion.com, such as /v1/pages |
| Slack | slack | Web API methods, such as /chat.postMessage |
| Jira | jira | Paths on your Jira site, such as /rest/api/3/issue |
| Stripe | stripe | Paths on api.stripe.com, such as /v1/coupons |
The system has to be connected in Backa first. Backa adds the system's sign-in on the way out, so the agent never has it. The rest of Backa's systems work over MCP.
Sign in with a code
The agent signs itself in. It asks for a code, you approve it in Backa, and it gets a token. Nobody copies a key.
- Ask for a code.
client_nameis the name you will see in Backa.
The answer hasPOST https://api.backa.ai/oauth/device Content-Type: application/x-www-form-urlencoded client_name=Sales sync scriptdevice_code,user_code,verification_uri_complete,expires_in(600 seconds) andinterval(5 seconds). - Show the person
user_codeand the linkverification_uri_complete. They sign in to Backa, check that the code matches, pick a workspace and slide to allow. - Meanwhile, ask for the token every 5 seconds:
Until the person has answered, this returnsPOST https://api.backa.ai/oauth/token Content-Type: application/x-www-form-urlencoded grant_type=urn:ietf:params:oauth:grant-type:device_code&device_code=<device_code>&client_id=<client_id>authorization_pending.slow_downmeans ask less often,access_deniedthat they said no, andexpired_tokenthat the code ran out and you start again. - The answer has
access_token, valid for an hour, andrefresh_token. SendAuthorization: Bearer <access_token>on every call. When it runs out, get a new one withgrant_type=refresh_token.
The agent then shows up under Agents in Backa with the name it gave. Remove it there and its tokens stop working at once.
Reads
GET calls pass straight through and answer exactly what the system answers. Nothing is written to the audit log.
Changes
Every change goes through the same steps as over MCP: your policies, the outbound queue and the anomaly detection. What happens depends on the change:
| The change | What happens | Answer |
|---|---|---|
| One Backa knows how to roll back | Runs at once, with Rollback in the audit log | The system's own status and body |
| An email, message or comment | Waits in the outbound queue for a short while, then goes out | 202 with an actionId |
| One Backa doesn't know yet | Waits for a person to approve it in the audit log | 202 with an actionId |
| Blocked by a rule | Doesn't run | 403 |
A change that ran carries these headers next to the system's answer:
Backa-Action: the change's id in the audit log.Backa-Status:applied,held,awaiting-approvaland so on (see Answers).Backa-Undo-Until: when the rollback window closes.Backa-Status-Url: where to ask how it went.
Waiting for a decision
When a change answers 202, nothing has happened yet. Don't send it again. Ask what became of it instead:
GET https://api.backa.ai/v1/actions/<actionId>?wait=30
wait holds the answer open for up to 40 seconds, until something happens. Then status tells you whether it was applied, rejected or expired, and result carries the system's answer, such as the new record's id. A change waiting for approval lapses after a while if nobody decides.
Retries
Send an Idempotency-Key header with each change, any unique string. If the network drops and you send the same call again with the same key, Backa returns the first answer with Backa-Replayed: true and writes nothing twice. Keys are kept for 24 hours. The same key with a different body answers idempotency_conflict.
POST https://api.backa.ai/v1/github/repos/acme/web/issues
Authorization: Bearer <token>
Idempotency-Key: 7f3a9c2e-issue-login-bug
Content-Type: application/json
{ "title": "Login button does nothing on Safari" }
Dry run
Add Backa-Dry-Run: true to a change to see what it would do, without doing it. Nothing is sent to the system or written to the audit log. The answer is a preview:
{ "preview": {
"wouldRun": "runs",
"summary": "Change deal 9182 in HubSpot",
"fields": [{ "name": "amount", "before": "4200", "after": "5100" }],
"undoable": true,
"undoWindowDays": 30,
"warnings": []
} }
wouldRun is runs, needs-approval, held or blocked. To make the change, send the same call again without the header.
Answers
Backa's own answers, for a change that waits or when you ask about one, look like this:
{ "backa": {
"actionId": "act_…",
"status": "held",
"system": "slack",
"summary": "Post a message in #sales",
"undoable": true,
"heldUntil": "2026-11-23T10:14:00Z",
"journal": "https://app.backa.ai/w/…",
"statusUrl": "https://api.backa.ai/v1/actions/act_…"
} }
status is one of applied, held (in the outbound queue), awaiting-approval, blocked, failed, undone, rejected, expired or canceled. These are the same answers agents get over MCP.
Errors
When Backa itself says no, the answer is:
{ "error": {
"code": "not_connected",
"message": "Jira isn't connected in this workspace.",
"retryable": false,
"fix": "Ask the person to connect Jira under Systems in Backa."
} }
Try again only when retryable is true, after retryAfterSeconds. fix says what has to change first, often something to tell the person. Errors from the system itself come back as the system sent them.
| Code | Means |
|---|---|
invalid_token | The token is missing, expired or removed. Refresh it, or sign in again. |
unknown_system | The id after /v1/ isn't one of the systems above. |
not_connected | The system isn't connected in this workspace. |
blocked, paused | A policy blocks it, or the agent is suspended. That is the person's choice: tell them, don't work around it. |
app_not_allowed, system_not_allowed | The workspace only allows certain agents or systems. |
rate_limited | More than 600 calls a minute. Retryable. |
unavailable | Backa or the system can't be reached right now. Retryable. |
idempotency_conflict, in_progress | The key was used with another body, or its first call is still running (retryable). |
bad_path, bad_body | Backa couldn't read the path or the body. |
Roll back
Changes made through the API are rolled back like any other: from the audit log, with Point-in-time rollback, or by an agent over MCP with backa_undo. Rollback checks that nobody has changed the thing since, and stops if they have.