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

# Actions

> Decide what happens to every invoice — when it matches, when it needs a person, when it fails or is flagged, and when someone wants to send it by hand.

Every invoice equate processes ends in one of three **outcomes**. An **action** is what
equate does about it: export the result, email someone, upload it to your server or
POST it to your systems. Where you use an action — a pipeline, or a document handler —
you decide which outcome it runs on, and the same action can run on more than one. The
action itself says how it runs: by itself, by hand from the invoice, or both.

## The three outcomes

> [card] Auto-matched
>
> A booking matched confidently and every check passed. The invoice completes on its
> own and sits in **Processed**.

> [card] Needs review
>
> A person needs to decide: a likely match to confirm, or no matching booking at all.
> It waits in **Need Review**.

> [card] Failed or flagged
>
> The document couldn't be read, or a teammate flagged it. A failed document is listed
> in **Logs → Invoices**; a flagged one waits in **Need Review**.

| Outcome | Job stages it covers | Queue |
| - | - | - |
| **Auto-matched** | `MATCHED` | Processed |
| **Needs review** | `NEEDS_REVIEW`, `NOT_MATCHED`, `DUPLICATE` | Need Review |
| **Failed or flagged** | `FAILED`, and anything a teammate has flagged | Logs → Invoices (failed), Need Review (flagged) |

> [!NOTE]
>
> "No booking found" is a **needs review** outcome: it's a business decision a reviewer
> makes from the data, not a technical failure. See
> [reviewing invoices](https://equatetravel.ai/docs/guides/reviewing-exceptions.md).

## Action types

| Action | What it does | Plans |
| - | - | - |
| **Export JSON** | Writes the result as JSON to equate's private export storage, with 7-day links to the documents it describes. | All |
| **Export XML** | The same, as XML. | All |
| **Email** | Sends to up to 50 recipients (plus CC), with a templated subject and body, and optional attachments: the original documents and a data file. | All |
| **Upload to FTP** | Writes the documents and, optionally, a JSON, XML, CSV or TXT data file to a folder on your [FTP/SFTP server](https://equatetravel.ai/docs/connectors/ftp-sftp.md). | All |
| **Webhook** | POSTs the result to your endpoint as JSON, XML, CSV or TXT, optionally signed with an HMAC secret. | Professional and above ([webhook connector](https://equatetravel.ai/docs/connectors/webhook.md)) |
| **Add a row to Google Sheets** | Appends one row per invoice to a spreadsheet in your Google Drive, with the columns you choose, under a header row. | All ([Google Sheets connector](https://equatetravel.ai/docs/connectors/google-sheets.md)) |

Accounting-system actions (Sage, Xero, QuickBooks) and Slack alerts are on the
[roadmap](https://equatetravel.ai/docs/resources/roadmap.md).

### What each action sends

Every action builds its output from the same set of choices, so the shape is yours to
control:

* **Match data** — the booking it matched, the decision and confidence. Optionally the
  **field-by-field breakdown**: every field, only the ones that agree, or only the ones
  that don't.
* **Invoice fields**: the values read off the invoice, all of them or just the ones you pick.
* **Booking fields**: the values from the booking it was matched to (`bookingData`), all
  of them or just the ones you pick, such as `bookingId`, `isPrincipal` or `exchangeRate`.
  Empty when no booking was found.
* **Static fields** — fixed key/value pairs your receiving system expects (a ledger
  code, a company id).
* **Handling notes** — a block of instructions that travels with the result.
* **Documents** — the agent copy, the client copy and any associated files, sent as
  attachments or as signed links (1 minute to 7 days).

Email subjects and bodies, and FTP file names, take `{{field}}` tokens — for example
`Invoice {{reference}}` or `{{reference}}-{{jobId}}`. A booking value takes a `booking_`
prefix, so it never clashes with the invoice's own field: `{{booking_bookingId}}`,
`{{booking_exchangeRate}}`.

## Automatic, manual, or both

Each action is set off one of three ways:

> [card] Automatically
>
> Runs on its own the moment the pipeline finishes an invoice with a matching outcome.

> [card] Manually
>
> Appears in the invoice's **Actions** menu, for someone to run when they choose.

> [card] Both
>
> Runs on its own, and can be run again by hand — useful for a delivery you sometimes
> need to repeat.

The outcome it's added under scopes manual actions too: an action a pipeline runs on
**failed or flagged** is only offered on that pipeline's invoices that failed or were flagged. Manual actions always use the pipeline's actions as
they are configured *now*, not as they were when the invoice came in.

## Principal and agent&#x20;

On Professional and above, each action on a pipeline (or a document handler) says which
bookings it **runs for**: every booking, **principal bookings only** or **agent bookings
only**. It's read from the matched booking's
[Principal or agent](https://equatetravel.ai/docs/guides/business-rules.md#principal-and-agent) field, so an agent booking
can go to one ledger and a principal booking to another. A booking that doesn't say runs only
the actions for every booking. The `{{booking_basis}}` template token says *Principal* or
*Agent* in an email or a webhook body.

An agent booking's invoice also waits for its guest copy before its auto-matched actions run,
so both copies go out together. See
[guest copies](https://equatetravel.ai/docs/guides/business-rules.md#guest-copies).

## Recipes

> [tab] When it matches
>
> The clean path. Get the result into your finance process with no one touching it.
>
> * **Export JSON or XML** for your finance team or a nightly import.
> * **Upload to FTP** with a data sidecar, so your back office picks up the PDF and
>   the matched fields together.
> * **Webhook** to post straight into your mid-office or AP system (Professional and above).
> * **Add a row to Google Sheets** for a live, shareable log of what went through.
>
> Most teams start here: one automatic action on **Auto-matched**.

> [tab] When it needs review
>
> A person has to look, so tell the right person.
>
> * **Email** the team that owns the supplier, with the field-by-field breakdown set
>   to **mismatched only**, so they see exactly what disagrees.
> * **Webhook** into your own task or review tool.
> * **Add a row to Google Sheets** on a "To review" tab, as a shared to-do list.
> * Add a **manual** export or FTP upload to the same pipeline, so a reviewer can send
>   the invoice on once they've confirmed the match.

> [tab] When it fails or is flagged
>
> Something went wrong, or someone raised a concern — make sure it doesn't sit unnoticed.
>
> * **Email** an alert to whoever owns the inbox or the integration.
> * **Webhook** that raises a support ticket — often best as **manual only**, so a
>   person decides whether it needs one.

> [tab] By hand
>
> Manual actions cover the moments a rule can't predict.
>
> * **Re-send** a delivery that failed, or that the receiving system lost.
> * **Re-export** after a reviewer corrected a field.
> * **Forward** one invoice to a colleague or the supplier by email.

## Batch summary email

Most actions run once per invoice. A **batch summary email** runs once per **batch**
(everything one pipeline run picked up: an upload, an inbound email, a scheduled run).
It sends one email with:

* the pipeline, the batch number and when it started
* counts by status: auto-matched, needs review, not matched, failed and duplicates
* the totals, by currency
* the invoices that need attention, each with a link
* a link to the batch, and (on by default) a **CSV of every invoice** in it, with the
  columns you choose. A CSV too big to attach is sent as a download link instead.

Add it to a pipeline under **Once per batch** in the builder's **Actions** step.

* **Automatically**: it's sent when every document in the batch has settled
  (processed, needs review, not matched, failed). Each batch is summarised once.
* **Manually**: open the batch (**Logs → Batches**, or the pipeline's **Batches**) and
  choose **Send summary**. You can pick one of the pipeline's batch summaries, or send a
  one-off to any address.

Batch summaries are listed under **Logs → Outbound → Per batch**, where a failed one can
be sent again. Test-mode pipelines don't send them automatically.

## Set one up

**1. Create the action**

Under **Actions** in the sidebar, choose a type, give it a name you'll recognise
(handy for telling two webhooks apart), and configure what it sends.

**2. Choose how it runs**

Pick **automatically**, **manually** or both.

**3. Add it to a pipeline, under an outcome**

The pipeline builder's **Actions** step has a group for each outcome —
**Auto-matched**, **Needs review**, **Failed or flagged**, plus **once per batch** for a
batch summary. Add the action under the ones it should run on, switch it on, and set
the order within each. You can create a new one from there too.

**4. Test it**

Run the pipeline in **test mode**: documents are processed end to end, but no
action delivers anything — not automatically, and not by hand.

> [!WARNING]
>
> Actions are **shared**. One action can be used by many pipelines, and editing it
> changes it everywhere it runs — the editor lists every pipeline that uses it. To vary
> it for one pipeline, create a second action instead.

## When a delivery fails

Each action gets **three attempts** with backoff. If any action still fails, the job
moves to `ACTION_FAILED` and the workspace is notified; otherwise it moves to
`ACTIONED`. A failed delivery keeps its match: the invoice sits in **Processed** with a
**Delivery Failed** badge that links to **Logs → Outbound**, and it counts towards the
workspace status in the top bar. Every attempt — success or failure — is listed under
**Logs → Outbound**, and on the invoice's activity timeline, with the action's name.
Fix the cause, then re-send it from there.

> [card] [Pipelines](https://equatetravel.ai/docs/guides/pipelines.md)
>
> Where actions are switched on, alongside inputs, tiers and test mode.

> [card] [Reviewing invoices](https://equatetravel.ai/docs/guides/reviewing-exceptions.md)
>
> Working the Need Review queue your actions point people to.


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