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

# API Reference

> Interactive reference for every Fatorly Integration API endpoint.

This section is a complete, interactive reference for the **Fatorly Integration
API** (v1). Every endpoint is listed in the sidebar under **API Reference**, with
its parameters, request and response schemas, and an in-page **playground** so you
can send live requests and see real responses.

<Note>
  New to the API? Start with the [Overview](/en/developers/overview),
  [Authentication](/en/developers/authentication), and
  [Quickstart](/en/developers/quickstart) guides, then use this reference for the
  full endpoint detail.
</Note>

## Base URL

| Environment | Base URL                                  |
| ----------- | ----------------------------------------- |
| Production  | `https://integration.fatorly.com`         |
| Sandbox     | `https://integration.sandbox.fatorly.com` |

All endpoints are versioned under `/v1` (for example, `POST /v1/invoices`). The
examples in this reference use production — swap the host for sandbox.

## Allowed values

Closed-vocabulary fields accept exactly these values (also declared as enums on
each endpoint's schema below, with an example pre-filled in the playground):

| Field                 | Values                                                                                                                                                                    |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `documentType`        | `Invoice`, `CreditNote`, `SelfBillingInvoice`, `SelfBillingCreditNote` — the `SelfBilling*` variants are issued by the buyer on the supplier's behalf                     |
| `vatCategory`         | `S` (standard 5%), `Z` (zero-rated), `E` (exempt — requires `exemptionReasonCode`), `O` (out of scope), `AE` (reverse charge — requires `goodsNatureCode` on the line)    |
| `status`              | `Draft`, `Pending`, `Sent`, `DeliveryFailed`, `Received`                                                                                                                  |
| `participantDelivery` | `Pending`, `Failed`, `NotApplicable`                                                                                                                                      |
| `direction`           | `Outbound` (sales), `Inbound` (purchases)                                                                                                                                 |
| `itemTypeCode`        | `G` (goods), `S` (services), `B` (both — `S` and `B` require `serviceAccountingCode`)                                                                                     |
| `paymentMode`         | Any UNCL4461 code (`10` cash, `20` cheque, `30` credit transfer, `48` bank card, `49` direct debit, …) or the aliases `cash`, `cheque`, `card`, `debit`; defaults to `30` |

## Authenticate

Every request requires your API key in the `X-Api-Key` header.

<Steps>
  <Step title="Generate an API key">
    In the platform, go to **Settings → API Keys** and create a key. It looks like
    `fat_…` and is shown **only once** — copy it immediately. See
    [API Keys](/en/settings/api-keys).
  </Step>

  <Step title="Add it to the playground">
    In any endpoint page below, open the **Authorization** panel and paste your key
    into the **`X-Api-Key`** field.
  </Step>

  <Step title="Send a request">
    Fill in the parameters and select **Send** to call the live Integration API.
  </Step>
</Steps>

<Warning>
  Treat your API key like a password. Calls run against your real company data.
  If a key is lost or compromised, revoke it under **Settings → API Keys** and
  create a new one.
</Warning>
