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

# Creating an invoice

Create an invoice for an existing client with one manually entered line item, then download its PDF. The examples use illustrative data and IDs.

## 1. Prepare the client and bank account

You need an [API token](https://docs.fintoro.sk/en/authentication.md) with `write` permission and a company with a configured primary invoice numbering series. You can use a [sandbox](https://docs.fintoro.sk/en/sandbox-testing.md) for testing.

Select a client through `GET /clients` and a bank account through `GET /bank-accounts`. Both must belong to the company assigned to the token. Replace `clientId: 101` and `bankAccountId: 201` in the example with their actual IDs.

If the client does not exist yet, create it through `POST /clients`. The [API reference](https://docs.fintoro.sk/en/api-reference.md) documents the parameters for these endpoints.

## 2. Create the invoice

```bash theme={null}
curl --request POST \
  --url https://app.fintoro.sk/api/public/v1/invoices \
  --header 'Authorization: Bearer <company-token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: invoice-example-001' \
  --data '{
    "clientId": 101,
    "bankAccountId": 201,
    "currencyId": 1,
    "currencyRate": 1,
    "dueDateDays": 14,
    "items": [
      {
        "name": "Consulting",
        "quantity": 1,
        "unitId": 1,
        "unitPrice": 100,
        "vatRate": 23
      }
    ]
  }'
```

`unitPrice` is the unit price excluding VAT, and `vatRate` is the VAT percentage. `currencyId: 1` and `unitId: 1` identify the euro and piece unit; see [reference tables](https://docs.fintoro.sk/en/reference-tables.md) for other values.

The invoice number is generated from the primary numbering series. Both the issue and delivery dates default to today, with payment due 14 days after issue.

When retrying the same request, keep `Idempotency-Key` and the body unchanged. Use a new key for another invoice; see the [idempotency rules](https://docs.fintoro.sk/en/errors-and-idempotency.md).

The `201 Created` response contains the invoice directly, without a `data` wrapper. Abbreviated illustrative example:

```json theme={null}
{
  "id": 301,
  "number": "20260001",
  "pdfDownloadUrl": "https://app.fintoro.sk/api/public/v1/invoices/301/pdf"
}
```

Store the returned `id` alongside your local record. Fetch the current details through `GET /invoices/{id}`.

## 3. Download the PDF

Replace `301` in the following request with the ID from the response:

```bash theme={null}
curl --fail \
  --url https://app.fintoro.sk/api/public/v1/invoices/301/pdf \
  --header 'Authorization: Bearer <company-token>' \
  --header 'Accept: application/pdf' \
  --output invoice.pdf
```

The PDF is saved as `invoice.pdf` in the current directory. You can also use the response's `pdfDownloadUrl` to access the same endpoint; it requires the same API token.


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