> ## Documentation Index
> Fetch the complete documentation index at: https://docs.navige.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Decision API

> Ask before you act: POST /enforce, and how to handle each answer.

The proxy covers model calls. The Decision API covers everything else your agent does, such as issuing a refund, deleting a record or sending a message to a customer. You describe the action, Navige decides, and your code acts on the answer.

`POST /enforce`

The full field list, with a request you can send from the page, is in [Ask for a decision](https://docs.navige.ai/reference/enforce.md).

## Request

| Field | Type | What it does |
| - | - | - |
| `tool` (required) | `string` | What the agent wants to do, such as `issue_refund`. Up to 200 characters; longer is rejected, not truncated. |
| `system` | `string` | Which system it acts on, such as `stripe` or `salesforce`. Lets one policy cover a tool name that exists in several places. |
| `classification` | `string` | One of `read`, `write`, `destructive`, `financial`, `unknown`. |
| `arguments` | `object` | What it would be called with. Policies can read these; secrets are redacted before anything is stored. |
| `transaction` | `object` | `{ workflowKey, externalRef }`: the business task this belongs to. |
| `workflow` | `object` | `{ key, runId }`: tags the call for the workflow view. Without `transaction`, it also names the task, so per-workflow budgets apply. |
| `wait` | `boolean` | Default `true`. Set `false` to get an immediate `pending` instead of blocking on an approval. |
| `onBehalfOf` | `object` | The person the agent is acting for: `{ memberId }`, or an identity a workspace admin linked in Settings → Members, such as `{ provider: "lark", externalId: "ou_…" }`. Navige works out who that is, records it, lets guardrails match on their role, and refuses a person it cannot establish. With it, guardrail verdicts are real on every plan. |

```bash bash theme={null}
curl -X POST https://api.navige.ai/enforce \
  -H "x-navige-key: $NAVIGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "issue_refund",
    "system": "stripe",
    "classification": "financial",
    "arguments": { "amount_usd": 1240, "customer": "cus_PZ8" },
    "transaction": { "workflowKey": "billing.refund", "externalRef": "ticket-88412" }
  }'
```

```powershell Windows PowerShell theme={null}
$body = @'
{
    "tool": "issue_refund",
    "system": "stripe",
    "classification": "financial",
    "arguments": { "amount_usd": 1240, "customer": "cus_PZ8" },
    "transaction": { "workflowKey": "billing.refund", "externalRef": "ticket-88412" }
  }
'@
Invoke-RestMethod -Method Post -Uri https://api.navige.ai/enforce `
  -Headers @{ "x-navige-key" = $env:NAVIGE_KEY } `
  -ContentType "application/json" -Body $body
```

One optional header sits beside `x-navige-key`: `x-navige-client` names which app on a connected computer is asking, so its calls land on its own agent. You will rarely send either by hand: `navige connect` sets up hooks that call this endpoint for every tool call Claude Code, Codex, Cursor and GitHub Copilot CLI make, sending the shape of the arguments (sizes and fingerprints), never their content. With each call it sends the name of the git repository and branch the chat is working in (`github.com/acme/api`, `main`), so spend can be shown by repository; run `connect --no-repo` to keep those on the computer. In the body these are the optional fields `transaction.repo` and `transaction.branch`.

## Answers

Every response carries a `decision`, and most carry a `transactionId` so you can report the outcome later.

```json theme={null}
{ "decision": "allow", "transactionId": "01937c4f-…" }

{ "decision": "deny", "reason": "Refunds over $500 require a human", "transactionId": "01937c4f-…" }

{ "decision": "pending", "approvalId": "01937c4e-…", "expiresAt": "2026-10-14T09:12:00Z" }

{ "decision": "approved" }
{ "decision": "rejected", "reason": "denied by approver" }
{ "decision": "expired",  "reason": "approval request timed out" }

{ "decision": "error", "reason": "approval required, but recording the request failed", "unavailable": true }
```

A refusal carries a `code` as well as a reason, so you can tell the person something useful: `policy` (a guardrail), `kill_switch`, `spend_cap`, and, when you sent `onBehalfOf`, `unknown_requester` (nobody has linked this person; ask an admin), `inactive_requester` or `requester_unavailable`. A request with `onBehalfOf` also gets back `requester`: who Navige took it to be, never what they may do.

> [!WARNING]
>
> On Watchtower, or in shadow mode, a guardrail's verdict is recorded but not enforced, and the answer is `allow` with `"enforced": false`, `wouldHaveBeen` and the `code` beside it. Read those fields if you want to act on what Navige would have done. A request carrying `onBehalfOf` never gets this kind of allow from a guardrail, except in shadow mode: when the agent acts for a person, the verdict is the real one.

## Handling them

Two of these mean go, three mean stop, `pending` means wait, and `error` means Navige could not say. Do not treat the decision as a boolean.

```python theme={null}
r = enforce(tool="issue_refund", ...)

if r["decision"] in ("allow", "approved"):
    do_the_thing()
elif r["decision"] in ("deny", "rejected", "expired"):
    stop(r.get("reason"))
elif r["decision"] == "pending":
    # Only when you sent wait=false.
    park_and_poll(r["approvalId"])
elif r["decision"] == "error":
    # unavailable=True is Navige being down, not your request being wrong.
    # Your own fail-open or fail-closed choice decides this branch.
    handle_unavailable(r)
```

> [!WARNING]
>
> Do not handle `error` as `deny`. A malformed request and an unreachable Navige both come back as `error`, told apart by `unavailable`. If you map either one to denied, an outage stops your agents without warning. If you map both to allowed, a typo in your payload leaves them ungoverned without warning.

## Long holds

`GET /enforce/status/:approvalId`

With `wait` left at its default, the call blocks up to five minutes waiting for a human. If your caller cannot hold a request open that long (Salesforce Apex caps around 120 seconds), send `"wait": false` and poll this instead. It answers `pending` until someone decides, then `approved`, `rejected` or `expired`. An approval id it does not know gets `404`. See [Check a held decision](https://docs.navige.ai/reference/enforce-status.md).

Once settled, `approved` and `rejected` carry `decidedBy`: `{ "channel": "console", "memberId": "…", "role": "admin" }` when a member decided in the console, or `{ "channel": "link", "memberId": null }` when the decision came from an email or Slack link. Those links need no sign-in, so Navige does not know who clicked, and the response says so instead of guessing.

## Reporting the outcome

Navige knows whether the call was allowed. It does not know whether the work succeeded, and will not infer it from an HTTP 200.

```bash bash theme={null}
curl -X POST https://api.navige.ai/v1/transactions/$TX_ID/outcome \
  -H "x-navige-key: $NAVIGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"succeeded": true}'
```

```powershell Windows PowerShell theme={null}
$body = @'
{"succeeded": true}
'@
Invoke-RestMethod -Method Post -Uri "https://api.navige.ai/v1/transactions/$env:TX_ID/outcome" `
  -Headers @{ "x-navige-key" = $env:NAVIGE_KEY } `
  -ContentType "application/json" -Body $body
```

Until you report it, the outcome is **unjudged**. Unjudged is not the same as failed, and it is counted as neither a success nor a failure.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.