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

# Report an outcome by your reference

> Tell Navige whether a task did what it was for, using the workflow and reference you grouped it under.

The same as [Report a task's outcome](https://docs.navige.ai/reference/outcome.md), but you name the task by the workflow and reference you grouped its calls under, so you do not need Navige's `transactionId`. These are the values you sent as the `x-navige-workflow` and `x-navige-transaction` headers, or as `transaction.workflowKey` and `transaction.externalRef` to [Ask for a decision](https://docs.navige.ai/reference/enforce.md). [Transactions](https://docs.navige.ai/concepts/transactions.md#status-and-outcome-are-different-questions) explains how outcomes are used.

> [!NOTE]
>
> The key field is filled with a public demo key, so you can send a request without signing up. It reaches a shared demo workspace that resets every night, so do not send anything private. To call your own workspace, replace it with your key from Agents in the console.

You can report an outcome again to correct it. Each report replaces the last one, including `errorClass`: a report without it clears an earlier one.

## What to send

When Navige records a call, it keeps only the first 200 characters of a longer workflow key or reference. This endpoint does not cut them: it refuses a value longer than 200. If you sent a longer one, send its first 200 characters here, or report by `transactionId`.

## Status codes

`200` with the fields described below. A missing or too-long `workflowKey` or `externalRef`, or a refused `succeeded` or `errorClass`, gets `400` with `{ "error": "…" }`. No task with that workflow and reference in your key's organisation gets `404` with `{ "error": "no such transaction" }`; a task in another organisation reads the same. A key that is missing or not valid gets `401`, and an agent that is inactive or expired gets `403`.

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

```python Python theme={null}
import os, requests

r = requests.post(
    "https://api.navige.ai/v1/transactions/by-ref/outcome",
    headers={"x-navige-key": os.environ["NAVIGE_KEY"]},
    json={
        "workflowKey": "support.ticket.triage",
        "externalRef": "ticket-88412",
        "succeeded": False,
        "errorClass": "wrong_category",
    },
)
print(r.json())
```

```json Recorded theme={null}
{ "ok": true, "transactionId": "01937c4e-9d1e-7a2b-8c3d-4e5f6a7b8c9d", "succeeded": false }
```

```json Missing reference theme={null}
{ "error": "`workflowKey` and `externalRef` are required, each at most 200 characters" }
```

```json Not found theme={null}
{ "error": "no such transaction" }
```


## OpenAPI

````yaml POST /v1/transactions/by-ref/outcome
openapi: 3.1.0
info:
  title: Navige API
  version: 1.0.0
  description: >-
    The gateway's public API: ask for a decision before an agent acts, report
    usage and outcomes, and read what a task usually costs.
servers:
  - url: https://api.navige.ai
security:
  - navigeKey: []
  - bearer: []
tags:
  - name: Decisions
    description: Ask before an agent acts, and read what applies to your calls.
  - name: Usage and tasks
    description: Report what happened, and read what a task costs.
paths:
  /v1/transactions/by-ref/outcome:
    post:
      tags:
        - Usage and tasks
      summary: Report an outcome by your reference
      description: >-
        Record whether a task did what it was for, by the workflow key and
        reference you sent with its calls. Neither value is cut: one longer than
        200 characters is refused.
      operationId: reportOutcomeByRef
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workflowKey
                - externalRef
                - succeeded
              properties:
                workflowKey:
                  type: string
                  maxLength: 200
                  examples:
                    - support.ticket.triage
                  description: The kind of task, as you sent it. Matched exactly.
                externalRef:
                  type: string
                  maxLength: 200
                  examples:
                    - ticket-88412
                  description: >-
                    Your reference for this task, as you sent it. Matched
                    exactly.
                succeeded:
                  type: boolean
                  description: >-
                    true if the task did what it was for, false if not. Must be
                    a JSON boolean: the string "false" or the number 0 is
                    refused.
                errorClass:
                  type: string
                  maxLength: 64
                  examples:
                    - wrong_category
                  description: >-
                    With a failure, a short class for what went wrong, such as
                    `wrong_category`. Up to 64 characters after leading and
                    trailing spaces are removed; an empty value is treated as
                    not sent. Send a class, not an error message.
            example:
              workflowKey: support.ticket.triage
              externalRef: ticket-88412
              succeeded: false
              errorClass: wrong_category
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - transactionId
                  - succeeded
                additionalProperties: false
                properties:
                  ok:
                    type: boolean
                    description: Always true on a 200.
                    enum:
                      - true
                  transactionId:
                    type: string
                    format: uuid
                    description: The task the outcome was recorded on.
                  succeeded:
                    type: boolean
                    description: The outcome recorded.
        '400':
          description: >-
            A missing or too-long field, or a refused `succeeded` or
            `errorClass`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                additionalProperties: false
                properties:
                  error:
                    type: string
                    description: What was wrong, in words.
        '401':
          description: The key is missing (`missing`) or not valid (`invalid_key`).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                additionalProperties: false
                properties:
                  error:
                    type: string
                    description: What was wrong, in words.
        '403':
          description: >-
            The key's agent is inactive (`agent_inactive`) or expired
            (`agent_expired`).
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                additionalProperties: false
                properties:
                  error:
                    type: string
                    description: What was wrong, in words.
        '404':
          description: >-
            No task with that workflow and reference in your organisation: `no
            such transaction`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                additionalProperties: false
                properties:
                  error:
                    type: string
                    description: What was wrong, in words.
components:
  securitySchemes:
    navigeKey:
      type: apiKey
      in: header
      name: x-navige-key
      description: >-
        Your agent's Navige key, from Agents in the console. The docs fill in a
        public demo key that reaches a shared demo workspace, reset every night;
        paste your own to call your workspace.
      x-default: nv_docs_demo_nuJM-1NFjNqDKAeGoZ5-QaAfFAdVXv79
    bearer:
      type: http
      scheme: bearer
      description: >-
        The same key as `Authorization: Bearer <key>`. Used only when
        `x-navige-key` is absent.

````

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