# Operations reference

---

## Overview

This page lists every operation of the Fr8Labs API, grouped by module, with the scope each one needs. It is generated from the live API reference.

* **Base URL**: `https://notification-hub.fr8labs.co/api/v1`. Every path below is relative to it.
* **Full details** (every parameter, field, response and error code of each operation): <https://notification-hub.fr8labs.co/api-docs>.
* **Machine-readable reference** (OpenAPI 3.1, public, no key needed): `GET https://notification-hub.fr8labs.co/api/v1/openapi.json`. Use it to generate a client in your own language.

**Every write has a preview.** Each write below has a dry run at `POST <path>/dry-runs`, shown in the **Preview** column. It checks the request against your live data and writes nothing. The **Dry run** column says whether the write refuses to run without one. **If-Match** shows which writes change an existing record, and which version they need. See [Writes: send, or preview first](https://docs.fr8labs.co/doc/writes-send-or-preview-first-H7lfnbJ63u).

**Every write needs an** `**Idempotency-Key**` **header.**


---

## Path parameters

| Parameter | Meaning |
|-----------|---------|
| `{name}` on CRM paths | The record's id, as the API returns it in `name` |
| `{form}`  | `lead`, `deal`, `organization` or `contact` |
| `{ref}` on quotations | The quotation's numeric id or its quotation number |
| `{id}` on quotations, jobs and invoices | The numeric id |
| `{side}`  | `sales` or `purchase` |
| `{hblId}` | The house bill's id, as `GET /jobs/{id}` returns it |
| `{doctype}` | `sales-invoice`, `purchase-invoice`, `journal-entry` or `payment-entry` |
| `{name}` on accounting paths | The document's or asset's name in your ledger |
| `{id}` on `/operations` | The id in a write's `checkUrl` |


---

## Account

Any valid key can call these. No scope is needed.

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/me` | Who is this key? (company, environment, scopes) | — (any valid key) |
| `GET`  | `/operations/{id}` | The outcome of a write whose result was not known when it was sent | — (any valid key) |


---

## CRM

Needs the **CRM** module on. Reads need `crm:read`; writes need `crm:write`.

### Reads

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/crm/attachments` | List CRM attachments (metadata) | `crm:read` |
| `GET`  | `/crm/contacts` | List CRM contacts | `crm:read` |
| `GET`  | `/crm/contacts/{name}` | Get one CRM contact | `crm:read` |
| `GET`  | `/crm/counts` | Count CRM leads and deals | `crm:read` |
| `GET`  | `/crm/deals` | List CRM deals | `crm:read` |
| `GET`  | `/crm/deals/{name}` | Get one CRM deal | `crm:read` |
| `GET`  | `/crm/forms/{form}` | Describe a CRM form | `crm:read` |
| `GET`  | `/crm/leads` | List CRM leads | `crm:read` |
| `GET`  | `/crm/leads/{name}` | Get one CRM lead | `crm:read` |
| `GET`  | `/crm/organizations` | List CRM organizations | `crm:read` |
| `GET`  | `/crm/organizations/{name}` | Get one CRM organization | `crm:read` |
| `GET`  | `/crm/search` | Search the CRM | `crm:read` |
| `GET`  | `/crm/site` | Your CRM site | `crm:read` |

* `GET /crm/search` takes `q` (at least 2 characters) and has its own limit of 20 calls a minute per key.
* Attachments are listed as details only (name, size, what they are attached to). Files cannot be downloaded through the API.

### Writes

| Method | Path | What it does | Scope | Preview (dry run) | Dry run | If-Match |
|--------|------|--------------|-------|-------------------|---------|----------|
| `POST` | `/crm/contacts` | Add a CRM contact | `crm:write` | `POST /crm/contacts/dry-runs` | Optional | —        |
| `PATCH` | `/crm/contacts/{name}` | Edit a CRM contact | `crm:write` | `POST /crm/contacts/{name}/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/deals` | Open a CRM deal | `crm:write` | `POST /crm/deals/dry-runs` | Optional | —        |
| `PATCH` | `/crm/deals/{name}` | Edit a CRM deal | `crm:write` | `POST /crm/deals/{name}/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/deals/{name}/owner` | Reassign a deal | `crm:write` | `POST /crm/deals/{name}/owner/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/deals/{name}/status` | Set a deal's status | `crm:write` | `POST /crm/deals/{name}/status/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/leads` | Create a CRM lead | `crm:write` | `POST /crm/leads/dry-runs` | Optional | —        |
| `PATCH` | `/crm/leads/{name}` | Edit a CRM lead | `crm:write` | `POST /crm/leads/{name}/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/leads/{name}/owner` | Reassign a lead | `crm:write` | `POST /crm/leads/{name}/owner/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/leads/{name}/status` | Set a lead's status | `crm:write` | `POST /crm/leads/{name}/status/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/crm/notes` | Log a call or visit note | `crm:write` | `POST /crm/notes/dry-runs` | Optional | —        |
| `POST` | `/crm/tasks` | Create a follow-up task | `crm:write` | `POST /crm/tasks/dry-runs` | Optional | —        |
| `PATCH` | `/crm/tasks/{name}` | Edit a task  | `crm:write` | `POST /crm/tasks/{name}/dry-runs` | Optional | Yes (`modified`) |


---

## Freight operations

Needs the **Freight operations** module on. Reads need `actions:read`; writes need `actions:write`. Buy-side data (buy amounts, costs, profit, markup, vendors) needs `margin` as well. See [Authentication and keys](https://docs.fr8labs.co/doc/authentication-and-keys-8dWXbqtO2l#the-margin-scope).

### Reads

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/charge-codes` | Look up your charge codes | `actions:read` |
| `GET`  | `/invoices/{side}/{id}` | Get one invoice | `actions:read` |
| `GET`  | `/jobs/{id}` | Get one job  | `actions:read` |
| `GET`  | `/jobs/{id}/costing` | Get a job's costing lines | `actions:read` |
| `GET`  | `/jobs/{id}/documents` | List a job's documents (metadata) | `actions:read` |
| `GET`  | `/living-rates` | List living rates (vendor rate sheets) | `actions:read` |
| `GET`  | `/partners` | Look up your partners (codes) | `actions:read` |
| `GET`  | `/quotation-templates` | List quotation templates | `actions:read` |
| `GET`  | `/quotations` | List quotations | `actions:read` |
| `GET`  | `/quotations/{ref}` | Get one quotation | `actions:read` |
| `GET`  | `/tasks` | List tasks across jobs | `actions:read` |

* `GET /jobs/{id}/documents` lists document details only. Files cannot be downloaded through the API.
* `GET /living-rates` lists vendor rate sheets without prices. The vendor is shown only with `margin`.
* `GET /partners` and `GET /charge-codes` return the exact codes the writes take (`partnerCode`, `chargeCode`). Search by part of a code or name, or look up one `code`. Partners show identity details only: no credit, bank or contact data.

### Writes

| Method | Path | What it does | Scope | Preview (dry run) | Dry run | If-Match |
|--------|------|--------------|-------|-------------------|---------|----------|
| `POST` | `/invoices/purchase/{id}/credit-notes` | Record a vendor's credit note against a job purchase invoice | `actions:write` | `POST /invoices/purchase/{id}/credit-notes/dry-runs` | Optional | —        |
| `POST` | `/invoices/purchase/{id}/debit-notes` | Record a vendor's debit note against a job purchase invoice | `actions:write` | `POST /invoices/purchase/{id}/debit-notes/dry-runs` | Optional | —        |
| `POST` | `/invoices/sales/{id}/credit-notes` | Credit a job sales invoice | `actions:write` | `POST /invoices/sales/{id}/credit-notes/dry-runs` | Optional | —        |
| `POST` | `/invoices/sales/{id}/debit-notes` | Debit a job sales invoice | `actions:write` | `POST /invoices/sales/{id}/debit-notes/dry-runs` | Optional | —        |
| `POST` | `/jobs` | Create an ocean or air job | `actions:write` | `POST /jobs/dry-runs` | Optional | —        |
| `POST` | `/jobs/{id}/hbls` | Add a house bill to a job | `actions:write` | `POST /jobs/{id}/hbls/dry-runs` | Optional | —        |
| `PATCH` | `/jobs/{id}/hbls/{hblId}` | Edit a house bill | `actions:write` | `POST /jobs/{id}/hbls/{hblId}/dry-runs` | Optional | Yes (`version`) |
| `POST` | `/jobs/{id}/invoices/purchase` | Create a purchase invoice (vendor bill) draft on a job | `actions:write` | `POST /jobs/{id}/invoices/purchase/dry-runs` | Optional | —        |
| `POST` | `/jobs/{id}/invoices/purchase/convert-costing` | Create a purchase invoice (vendor bill) draft from the job's costing | `actions:write`, `margin` | `POST /jobs/{id}/invoices/purchase/convert-costing/dry-runs` | Optional | —        |
| `POST` | `/jobs/{id}/invoices/sales` | Create a sales invoice draft on a job | `actions:write` | `POST /jobs/{id}/invoices/sales/dry-runs` | Optional | —        |
| `POST` | `/jobs/{id}/invoices/sales/convert-costing` | Create a sales invoice draft from the job's costing | `actions:write` | `POST /jobs/{id}/invoices/sales/convert-costing/dry-runs` | Optional | —        |
| `PATCH` | `/jobs/{id}/mbl` | Edit a job's master bill | `actions:write` | `POST /jobs/{id}/mbl/dry-runs` | Optional | Yes (`version`) |
| `POST` | `/jobs/generic` | Create a warehouse, trucking or other non-ocean / non-air job | `actions:write` | `POST /jobs/generic/dry-runs` | Optional | —        |
| `POST` | `/quotations` | Create a draft quotation | `actions:write` | `POST /quotations/dry-runs` | Optional | —        |
| `POST` | `/quotations/{id}/accept` | Mark a quotation accepted | `actions:write` | `POST /quotations/{id}/accept/dry-runs` | Optional | —        |
| `POST` | `/quotations/{id}/cancel` | Withdraw or decline a quotation | `actions:write` | `POST /quotations/{id}/cancel/dry-runs` | Optional | —        |
| `POST` | `/quotations/{id}/convert` | Convert an accepted quotation into a job | `actions:write` | `POST /quotations/{id}/convert/dry-runs` | Optional | —        |
| `POST` | `/quotations/{id}/mark-sent` | Mark a quotation as sent (no email) | `actions:write` | `POST /quotations/{id}/mark-sent/dry-runs` | Optional | —        |
| `PATCH` | `/quotations/{ref}` | Edit a quotation | `actions:write` | `POST /quotations/{ref}/dry-runs` | Optional | Yes (`version`) |

* Invoices created here are **drafts** on a job. Posting a job invoice is done in FMS.
* **Credit and debit notes** go against a **posted** job invoice that **this API created** (`{id}` = its `invoiceId`). See [Credit and debit notes](#credit-and-debit-notes) below.
* A quotation goes through `create` (draft) → `mark-sent` → `accept` → `convert` (to a job). `mark-sent` sends no email.


---

## Accounting

Needs the **Accounting** module on, for the companies (legal entities) you picked. Reads need `accounting:read`; writes need `accounting:write`. Every accounting call names one of those companies in `company`: its name as it appears in your accounting system.

### Reads

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/accounting/assets` | Read the asset register | `accounting:read` |
| `GET`  | `/accounting/assets/{name}` | Read one asset and its schedule | `accounting:read` |
| `GET`  | `/accounting/bank-accounts` | List bank and cash accounts | `accounting:read` |
| `GET`  | `/accounting/bank-reconciliation` | Where bank reconciliation stands | `accounting:read` |
| `GET`  | `/accounting/cost-centers` | List postable cost centers | `accounting:read` |
| `GET`  | `/accounting/documents` | List ledger documents by state | `accounting:read` |
| `GET`  | `/accounting/documents/{doctype}/{name}` | Read one ledger document | `accounting:read` |
| `GET`  | `/accounting/gl-accounts` | List postable GL accounts | `accounting:read` |
| `GET`  | `/accounting/invoices-to-post` | List freight invoices waiting to post to your ledger | `accounting:read` |
| `GET`  | `/accounting/item-tax-templates` | List item tax templates | `accounting:read` |
| `GET`  | `/accounting/items` | List ledger items | `accounting:read` |
| `GET`  | `/accounting/outstanding-invoices` | List a party's open invoices | `accounting:read` |
| `GET`  | `/accounting/parties` | List ledger customers or suppliers | `accounting:read` |
| `GET`  | `/accounting/period-status` | Is a date open for posting? | `accounting:read` |

### Writes

| Method | Path | What it does | Scope | Preview (dry run) | Dry run | If-Match |
|--------|------|--------------|-------|-------------------|---------|----------|
| `POST` | `/accounting/documents/{doctype}/{name}/cancel` | Cancel a posted document this API created | `accounting:write` | `POST /accounting/documents/{doctype}/{name}/cancel/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/accounting/documents/{doctype}/{name}/delete` | Delete a draft this API created | `accounting:write` | `POST /accounting/documents/{doctype}/{name}/delete/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/accounting/documents/{doctype}/{name}/submit` | Post a draft this API created | `accounting:write` | `POST /accounting/documents/{doctype}/{name}/submit/dry-runs` | Optional | Yes (`modified`) |
| `POST` | `/accounting/journal-entries` | Create a journal entry draft | `accounting:write` | `POST /accounting/journal-entries/dry-runs` | Optional | —        |
| `POST` | `/accounting/payments` | Create a payment entry draft (one currency) | `accounting:write` | `POST /accounting/payments/dry-runs` | Optional | —        |
| `POST` | `/accounting/purchase-invoices` | Create a non-job purchase invoice draft | `accounting:write` | `POST /accounting/purchase-invoices/dry-runs` | Optional | —        |
| `POST` | `/accounting/purchase-invoices/{name}/credit-notes` | Record a supplier's credit note against a non-job purchase invoice | `accounting:write` | `POST /accounting/purchase-invoices/{name}/credit-notes/dry-runs` | Optional | —        |
| `POST` | `/accounting/purchase-invoices/{name}/debit-notes` | Record a supplier's debit note against a non-job purchase invoice | `accounting:write` | `POST /accounting/purchase-invoices/{name}/debit-notes/dry-runs` | Optional | —        |
| `POST` | `/accounting/sales-invoices` | Create a non-job sales invoice draft | `accounting:write` | `POST /accounting/sales-invoices/dry-runs` | Optional | —        |
| `POST` | `/accounting/sales-invoices/{name}/credit-notes` | Credit a non-job sales invoice | `accounting:write` | `POST /accounting/sales-invoices/{name}/credit-notes/dry-runs` | Optional | —        |
| `POST` | `/accounting/sales-invoices/{name}/debit-notes` | Debit a non-job sales invoice | `accounting:write` | `POST /accounting/sales-invoices/{name}/debit-notes/dry-runs` | Optional | —        |
| `POST` | `/partners` | Create a customer or supplier (non-job) | `accounting:write` | `POST /partners/dry-runs` | Optional | —        |

* Invoices, journal entries and payments created here are **drafts** with no job behind them. Invoices for a job are created under Freight operations.
* `…/submit` posts a draft that **this API created**. It does not post documents created anywhere else.
* `…/cancel` cancels a **posted** document this API created; `…/delete` deletes a **draft** this API created. Once a payment or journal is applied to an invoice it is not cancelled through the API (`MONEY_APPLIED`): issue a credit note instead. A cancel needs your ledger to let the API user cancel that kind of document (`PERMISSION_MISSING` otherwise; Fr8Labs sets this up).
* The answer to every accounting create carries `document.modified`. Send it as `If-Match` on `…/submit` to post the draft: create, then post, is two calls.
* `POST /partners` adds a customer or supplier for your ledger alone. If one already matches, it returns that one instead. See [Partners and codes](#partners-and-codes) below.

### Credit and debit notes

Corrections are new documents: a credit note lowers what is owed on an invoice, a debit note raises it. The original is never edited.

* **Only against a posted invoice this API created.** Job invoices under Freight operations (`/invoices/{side}/{id}/…`), non-job invoices under Accounting (`/accounting/{sales|purchase}-invoices/{name}/…`).
* **Each line names a line of the original** (`line`, 1 = the first) or its charge, and what to credit or debit, **before tax**, in the invoice's currency:
  * **Job invoices** (`/invoices/{side}/{id}/…`): name the charge with `chargeCode`. Send `quantity` and `unitPrice`, exactly as on an invoice — the unit price may not be above the original's, and on a sales invoice the quantity may not be more than is left on the line; `quantity × unitPrice` must be whole cents. Or send `amount`, and the API works out an exact quantity and unit price; when the original price cannot write the amount exactly in one line, the note gets two lines on that charge (the original price, and the few cents left over).
  * **Non-job invoices** (`/accounting/…`): name the item with `itemCode`, and send `amount`.
* **Never more than is left.** Earlier credit notes on the same charge count, drafts included (`NOTE_EXCEEDS_REMAINING`). If a credit would leave part of a line impossible to credit later, the dry run warns `NOTE_STRANDS_REMAINDER`.
* The note takes the original's customer or supplier, currency, exchange rate and tax. It is dated on or after the original, in the current month or later: `invoiceDate` on a job note, `postingDate` (with `company`) on a non-job note.
* A vendor's note against a job purchase invoice needs `vendorInvoiceNo`: the vendor's own number for it. A job sales note may carry `referenceNo`. A supplier's note against a non-job purchase invoice may carry `billNo` and `billDate`.
* The note is a **draft**. A job note is posted in FMS; a non-job note with `…/submit`.

### Your own system's numbers

A non-job sales or purchase invoice can carry your own system's numbers for it: `externalInvoiceNo` (your invoice number) and `externalJobNo` (your job, booking or bill of lading number). Your accountants see them on the invoice in your ledger, can filter by them, and they come back on `GET /accounting/documents/…` and on every [event](https://docs.fr8labs.co/doc/events-and-webhooks-j2Abl5y9BX) for the invoice.

* **Set up at onboarding.** Your ledger needs two fields for them, which Fr8Labs adds. Until then, a request that sends them is refused (`EXTERNAL_REFS_NOT_SET_UP`): send the invoice without them, or ask support.
* **One invoice of yours, once.** A second invoice with the same `externalInvoiceNo` for the same company is refused (`DUPLICATE_EXTERNAL_INVOICE`, with ours in `meta.existing`). This is on top of `Idempotency-Key`, which only covers retries of one request. Cancelled invoices and credit notes do not count.
* These are never Fr8Labs job numbers. A job invoice is created on its job (`/invoices/…`), not here.

### Partners and codes

**Customers and suppliers are sent through the API, as they are created in your other system. Charge codes, accounts and taxes are set up with Fr8Labs once, at onboarding.**

* **Charge codes are agreed before you go live.** Map each of your own charges to one of your Fr8Labs charge codes, once. Then send our code on every line (`chargeCode` on freight, `itemCode` on a non-job invoice). `GET /charge-codes` lists them. A new charge of yours needs a new mapping first. Until then, lines using it are refused as an unknown code. On your ledger, each charge code has an item with the same code, so the code from `GET /charge-codes` also works as `itemCode` on a non-job invoice. If no item has that code, the dry run refuses the line and suggests close matches.
* `**POST /partners**` **needs** `**use: "non-job"**`**.** That is a customer or supplier for your ledger alone, used on invoices with no freight job. A partner that appears on freight jobs is created in FMS instead.
* **Send your own code as** `**externalRef**`**.** Sending it again returns the same party, however long after, even if you renamed it.
* **It never creates a duplicate by accident.** Before creating, it looks for a party with the same `externalRef`, the same tax id (`taxId`, for example a UEN), or the same name. Case, spacing and stray tabs are ignored, and parties that came from FMS are included.
  * By default, one match is returned instead (`200`, `created: false`, with `matchedBy`).
  * Several matches block the request (`PARTY_MATCH_AMBIGUOUS`, with the candidates).
  * A disabled match blocks too (`MATCHED_PARTY_DISABLED`).
  * To create a new party anyway, send `onMatch: "create"` and acknowledge the `DUPLICATE_RECORD` warning.
* **Use the returned** `**party.name**` as `customer`, `supplier` or `party` on accounting documents.
* **New parties use the same groups as FMS.** A new customer is filed under customer group "Commercial" and territory "All Territories", and a new supplier under supplier group "Services". The dry run's preview shows them (`customerGroup`, `territory`, `supplierGroup`).

Example body:

```json
{
  "use": "non-job",
  "company": "Example Logistics Pte Ltd",
  "partyType": "customer",
  "name": "Example Trading Pte Ltd",
  "taxId": "201912345K",
  "externalRef": "PTY-000123"
}
```


---

## Events

Needs the **Accounting** module. See [Events and webhooks](https://docs.fr8labs.co/doc/events-and-webhooks-j2Abl5y9BX).

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/events` | What changed on your invoices (payments, credits, cancellations) | `accounting:read` |

Webhooks deliver the same events to your own address; you set it in the portal (**API access** → **Webhooks**).


---

## Reference

| Method | Path | What it does | Scope |
|--------|------|--------------|-------|
| `GET`  | `/openapi.json` | This reference, as OpenAPI 3.1 | None: public, no key needed |


---

Documentation owner: Fr8Labs Customer Success. Text reviewed: 18 October 2026.