> ## 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.

# Transactions

> Why the unit of account is a business task, not a tool call.

Cost per call is hard to act on. "You made 190,000 model calls" does not tell a finance team much. "Resolving one support ticket costs \$0.41" tells them whether the work is worth doing, whether it got more expensive this month, and what to compare it against.

In Navige the unit of account is the **transaction**: one business task, made of however many model calls, tool calls and retries it took.

## Opening one

Correlation is opt-in. If you send none of these headers, everything behaves as it would have; send one and the calls are grouped.

* `x-navige-workflow`: the stable name for this *kind* of task, such as `support.ticket.triage`. Baselines and per-task costs key on this.
* `x-navige-transaction`: your own id for this *specific* run, used to make retries idempotent rather than counting them twice.
* `traceparent`: a standard W3C trace header. If your stack already emits one, you get correlation with no Navige-specific configuration.

```bash bash theme={null}
curl https://api.navige.ai/proxy/openai/v1/chat/completions \
  -H "x-navige-key: $NAVIGE_KEY" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "x-navige-workflow: support.ticket.triage" \
  -H "x-navige-transaction: ticket-88412" \
  -H "Content-Type: application/json" \
  -d @request.json
```

```powershell Windows PowerShell theme={null}
Invoke-RestMethod -Method Post -Uri https://api.navige.ai/proxy/openai/v1/chat/completions `
  -Headers @{
    "x-navige-key"         = $env:NAVIGE_KEY
    "Authorization"        = "Bearer $env:OPENAI_API_KEY"
    "x-navige-workflow"    = "support.ticket.triage"
    "x-navige-transaction" = "ticket-88412"
  } `
  -ContentType "application/json" -Body (Get-Content request.json -Raw)
```

`x-navige-workflow` and `x-navige-transaction` are each cut to 200 characters. Keep them shorter than that: two longer names that share their first 200 characters are recorded as one task.

## Status and outcome are different questions

* Status is lifecycle: is this task open, closed or abandoned. Navige knows this on its own.
* Outcome is judgement: did the task achieve what it was for. Navige cannot know this, and does not guess.

An unjudged transaction has a `null` outcome, which is not the same as failed. Report how it went to get cost-per-successful-task figures:

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

If you group calls with `x-navige-workflow` and `x-navige-transaction`, you do not need Navige's id: report the outcome under the same two names you sent. This endpoint refuses a name longer than 200 characters rather than cutting it, so keep both names within 200.

```bash bash theme={null}
curl -X POST https://api.navige.ai/v1/transactions/by-ref/outcome \
  -H "x-navige-key: $NAVIGE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflowKey": "support.ticket.triage", "externalRef": "ticket-88412", "succeeded": false, "errorClass": "wrong_category"}'
```

```powershell Windows PowerShell theme={null}
$body = @'
{"workflowKey": "support.ticket.triage", "externalRef": "ticket-88412", "succeeded": false, "errorClass": "wrong_category"}
'@
Invoke-RestMethod -Method Post -Uri https://api.navige.ai/v1/transactions/by-ref/outcome `
  -Headers @{ "x-navige-key" = $env:NAVIGE_KEY } `
  -ContentType "application/json" -Body $body
```

Or judge them by hand: **Performance → Judge tasks** lists finished tasks nobody has judged yet, a few per workflow, with Correct and Wrong beside each, and shows how much of each workflow's work carries a label.

> [!NOTE]
>
> Navige does not infer outcomes. A task whose last model call returned HTTP 200 can still have produced a wrong answer, refunded the wrong customer, or closed a ticket that then reopened. Treating 200 as success would overstate every success rate in the product by an unknown amount.

## What a task will cost, before it runs

`GET /v1/workflows/:workflowKey/estimate`

With your agent's key, this returns the range a task of that workflow usually costs (the 50th, 90th and 99th percentile in micro-USD), learned from your own finished tasks of that workflow over the last 30 days. The range is wide while there are few tasks: five tasks give a wide one, five hundred a narrow one. Only API spend counts; tasks with an unpriced step or no metered cost are counted under `leftOut` rather than read as cheap. With fewer than two priced tasks there is no range yet, and `expected` is `null`, not zero.

```bash bash theme={null}
curl https://api.navige.ai/v1/workflows/support.ticket.triage/estimate \
  -H "x-navige-key: $NAVIGE_KEY"
```

```powershell Windows PowerShell theme={null}
Invoke-RestMethod -Uri https://api.navige.ai/v1/workflows/support.ticket.triage/estimate `
  -Headers @{ "x-navige-key" = $env:NAVIGE_KEY }
```

## What you get from it

* Cost per task, and the spread across runs of the same task.
* The most expensive workflow you run.
* Cost per *successful* task, once outcomes are reported.
* A baseline, so a change that doubles the cost of a task shows up as a change rather than noise.


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