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

# Booking API (REST lookup)

> equate calls your REST API at match time, by reference and by amount, to bring live booking data without opening a database connection.

The **booking API connector** looks bookings up over REST at the moment an invoice is
matched. Use it when your bookings live behind a service or a platform where a direct
[database connection](https://equatetravel.ai/docs/connectors/database-lookup.md) isn't an option — the behaviour is
the same: live data, no feeds, no sync.

## The endpoints equate calls

Your API offers equate two endpoints. Both return a **JSON array of bookings** (a
wrapper such as `{"bookings": [...]}` is fine: you point equate at the array when you
set the connection up), and you map their fields to equate's in the
[booking-data wizard](https://equatetravel.ai/docs/guides/booking-data.md). They're the same two endpoints as Part 1
of the developer guide we share with your team at onboarding.

### 1. Find bookings by reference (required)

When an invoice arrives, equate substitutes its reference into your **lookup path**
and calls it:

```
GET https://api.youragency.com/bookings?reference=EX-44821
```

* **Filter on the reference only**, and return **every** booking that has it, as an
  array even when there is one: a reference is not always unique. equate reads up to 100.
* **Nothing found**: reply `200` with `[]`, or `404`. Any other error status counts as
  a failed lookup, not "no booking".
* **Ignore case**, and if you can, spaces, hyphens and slashes, so `EX-44821`,
  `ex44821` and `EX 44821` find the same booking.
* **Your own booking ID too**: if the endpoint also finds a booking by your own booking
  ID, your team can type either into **Search booking data** on an invoice. There's no
  need for a separate booking ID endpoint.

### 2. Find bookings by amount and dates (optional, more accurate matching)

This endpoint is optional, but it makes matching more accurate. When an invoice's
reference is missing, or the supplier used one that isn't yours, equate asks your
**search path** for bookings around the invoice's total and travel dates, then checks
each one against the invoice. Without it, those invoices can only wait for a person.
Your team uses it too, to search by amount from an invoice.

```
GET https://api.youragency.com/bookings/search?totalMin=4165.00&totalMax=4335.00&supplier=Example&dateFrom=2027-01-25&dateTo=2027-01-31
```

| Parameter | Sent | Filter |
| - | - | - |
| `totalMin`, `totalMax` | Always | Inclusive range on the booking's total cost (2% either side of the invoice's) |
| `supplier` | When the invoice names one | Partial match, ignoring case |
| `dateFrom`, `dateTo` | When the invoice has a travel date | Inclusive range on the travel start date (3 days either side of the invoice's) |

Return up to 25 bookings, newest first, in the same shape as endpoint 1. Ignore any
parameter you can't filter on: the total range alone works. The more of them you
filter on, the closer the results, and the more often the right booking is found.
Without a search path the connection matches on reference only.

## Configuration

| Setting | What it does |
| - | - |
| **Base URL** | Root of your API, e.g. `https://api.youragency.com`. |
| **Auth** | None, **API-key header** (name + key), **Bearer** token, **Basic**, or **OAuth 2.0 client credentials** (Cognito, Auth0, Entra ID, Okta). Secrets are encrypted at rest. |
| **Method** | `GET` or `POST`. |
| **Find by reference path** | Endpoint 1: a path with a `{reference}` placeholder, e.g. `/bookings?reference={reference}` or `/bookings/{reference}`. |
| **Find by amount and dates path** | Endpoint 2, optional but more accurate matching: a path such as `/bookings/search`. equate adds the query parameters above. |
| **Records path** | Where the booking object(s) sit in the response (e.g. `data.results`) — leave empty when the response *is* the booking. |
| **Field paths** | JSON paths to the **reference**, and optionally the **supplier** and **total**, within each record (e.g. `booking.ref`, `vendor.name`, `pricing.gross`). |

> [!TIP]
>
> The [booking-data wizard](https://equatetravel.ai/docs/guides/booking-data.md) runs a **real lookup** against your
> API as part of setup and shows the parsed result — so a wrong path fails while you're
> looking at it, not silently at match time.

## Designing a good lookup endpoint

* **Fast and cacheable**: equate calls endpoint 1 once per match attempt, and endpoint 2
  only when the reference finds nothing. A P99 under a second keeps the queue moving.
* **Return misses as misses** — a `404` (or an empty record set) is treated as "no
  booking", which routes the invoice to
  [Need Review](https://equatetravel.ai/docs/guides/reviewing-exceptions.md) as **No match** rather than failing the job.
* **Leave unknown values empty** — `null` or a missing field, never a placeholder like
  `N/A` or `TBC`. See [empty and unknown values](https://equatetravel.ai/docs/guides/booking-data-fields.md#empty-and-unknown-values).
* **Include supplier and total** when you can — they upgrade a bare reference hit into
  a confident, auto-completable match. See
  [how matching works](https://equatetravel.ai/docs/platform/matching-engine.md).
* **Scope the credential** — a token that can only read bookings is all equate needs.

## Security

| Control | What it does |
| - | - |
| **OAuth 2.0 client credentials** | Create an app client for equate in your identity provider with a scope that can only read bookings. equate exchanges the client id and secret for a token at your token endpoint before calling (client credentials as HTTP Basic, `client_id` in the body, the scope you give), caches it, and fetches a fresh one about a minute before it expires. For Cognito the token endpoint is your user pool domain followed by `/oauth2/token`. |
| **Static credentials** | An API key, bearer token or basic password is stored encrypted (AES-256-GCM, key held outside the database) and never shown again. Scope it to reading bookings. |
| **Outbound safety** | https only, redirects never followed, a 5-second timeout and a 2 MB response cap on every call; the host must resolve to a public address. |
| **Fixed source address** | If your API is behind an IP allow-list, ask us: equate can call it from a fixed address for your workspace. |

**Rotating**: for a static credential, issue the new one, enter it on the connector and
save. For OAuth, create a new client secret, enter it and save; equate drops the cached
token. See [connector security](https://equatetravel.ai/docs/connectors/security.md).

> [card] [Next: connect it as booking data](https://equatetravel.ai/docs/guides/booking-data.md)
>
> Add the connector under Booking Data, map the response, and run the live test.


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