# Recurring invoices

> Markdown edition of https://api.fiz.co/docs/api/recurring-invoices. Português: https://api.fiz.co/docs/api/recurring-invoices.md?lang=pt. Index: https://api.fiz.co/llms.txt

Invoice templates FIZ issues on its own, at the frequency you set. Each document a schedule issues carries its id. 5 operations.

## List recurring invoices

GET `/invoices/scheduled`

Returns the account's recurring-invoice templates, in any schedule status (see schedule.status). For the documents a schedule has already issued use GET /invoices?scheduleTemplateId={id}.

Authentication: an API key (`x-api-key`).

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `offset` | query | number | Number of records to skip (offset) |
| `limit` | query | number | Maximum number of records to return |
| `sort` | query | string | Sort field and order (e.g. createdAt:desc) |
| `customerId` | query | string | Filter by one customer's schedules |

**curl**

```shell
curl 'https://api.fiz.co/invoices/scheduled' \
  --header "x-api-key: $FIZ_API_KEY"
```

**TypeScript**

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.recurringInvoices.list();
```

**Python**

```python
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.recurring_invoices.list()
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->recurringInvoices->list();
```

### Response `200`

List of recurring invoices returned successfully

| Field | Type | Description |
| --- | --- | --- |
| `[].id` | string | Schedule ID. Also the scheduleTemplateId of the documents issued from it. |
| `[].number` | string · can be null | Internal template reference (SCHED-0001, …). Not a fiscal number — each issued document gets its own number in the series. |
| `[].documentType` | string · can be null | Document type to issue |
| `[].status` | string | Template status — always SCHEDULED; the schedule status is in schedule.status |
| `[].notes` | string · can be null | Notes copied to each document |
| `[].cae` | string · can be null | CAE code |
| `[].series` | object · can be null | Series the documents are issued in |
| `[].series.ref` | string · can be null | Series identifier |
| `[].series.name` | string · can be null | Series name |
| `[].customer` | object · can be null | Customer |
| `[].customer.ref` | string · can be null | Customer identifier |
| `[].customer.data` | object · can be null | Customer data |
| `[].customer.data.taxpayerNumber` | string · can be null | Tax number (NIF) |
| `[].customer.data.name` | string · can be null | Customer name |
| `[].customer.data.email` | string · can be null | Customer email |
| `[].customer.data.country` | string · can be null | Customer country |
| `[].customer.data.phone` | string · can be null | Customer phone |
| `[].summary` | object · can be null | Totals of each document to issue |
| `[].summary.amountWithoutTax` | number · can be null | Amount without tax |
| `[].summary.amountWithTax` | number · can be null | Amount with tax |
| `[].summary.amountWithoutTaxWithoutDiscount` | number · can be null | Amount without tax and discount |
| `[].summary.taxAmount` | number · can be null | Tax amount |
| `[].summary.globalDiscountType` | string · can be null | Global discount type — One of: `AMOUNT`, `PERCENT` |
| `[].summary.globalDiscountPercent` | number · can be null | Global discount percentage |
| `[].summary.globalDiscountAmount` | number · can be null | Global discount amount |
| `[].summary.total` | number · can be null | Total |
| `[].summary.totalToPay` | number · can be null | Total payable |
| `[].summary.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `[].summary.creditNotesTotal` | number · can be null | Total of credit notes |
| `[].items` | object\[\] · can be null | Items |
| `[].items[].id` | string | Identifier of the item on the invoice |
| `[].items[].ref` | string · can be null | Item reference |
| `[].items[].meta` | object · can be null | Item metadata |
| `[].items[].meta.quantity` | number · can be null | Item quantity |
| `[].items[].meta.amountWithoutTax` | number · can be null | Amount without tax |
| `[].items[].meta.amountWithTax` | number · can be null | Amount with tax |
| `[].items[].meta.taxAmount` | number · can be null | Tax amount |
| `[].items[].meta.discountAmount` | number · can be null | Discount amount applied to the item |
| `[].items[].meta.unitAmountWithoutTax` | number · can be null | Unit amount without tax |
| `[].items[].meta.unitAmountWithTax` | number · can be null | Unit amount with tax |
| `[].items[].meta.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `[].items[].meta.withholdingTaxEnabled` | boolean · can be null | Withholding tax enabled |
| `[].items[].data` | object · can be null | Item data |
| `[].items[].data.name` | string · can be null | Item name |
| `[].items[].data.description` | string · can be null | Item description |
| `[].items[].data.type` | string | Item type |
| `[].items[].data.unitPrice` | number · can be null | Unit price |
| `[].items[].data.taxRate` | number · can be null | Tax rate |
| `[].items[].data.vatRate` | string · can be null | VAT rate |
| `[].items[].data.vatTerritory` | string · can be null | VAT territory |
| `[].items[].data.vatExemptionReason` | string · can be null | VAT exemption reason |
| `[].items[].data.isAutoVATEnabled` | boolean · can be null | Automatic VAT enabled |
| `[].items[].noteChangeKind` | string · can be null | Only on the lines of partial credit/debit notes: what the line changes on the corrected invoice line — the quantity (QUANTITY) or the unit price (PRICE). Absent on other lines and on older notes. — One of: `QUANTITY`, `PRICE` |
| `[].items[].noteChangeFrom` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line before this note. |
| `[].items[].noteChangeTo` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line after this note. |
| `[].schedule` | object · can be null | Schedule |
| `[].schedule.status` | string · can be null | Schedule status. SCHEDULED issues on the next occurrence; PAUSED is on hold; COMPLETED reached endDate; FAILED stopped on an error (see failReason) and resumes with status=SCHEDULED. — One of: `COMPLETED`, `FAILED`, `PAUSED`, `SCHEDULED`, `STOPPED` |
| `[].schedule.frequency` | string | Frequency. CUSTOM only appears on schedules created in the web app; the API does not accept it on create. — One of: `ANNUALLY`, `CUSTOM`, `DAILY`, `MONTHLY`, `QUARTERLY`, `WEEKLY` |
| `[].schedule.interval` | number · can be null | Interval between occurrences. Only has an effect with frequency=CUSTOM (schedules created in the web app); the API keeps it on update. |
| `[].schedule.name` | string · can be null | Internal schedule name |
| `[].schedule.byDay` | number\[\] · can be null | Weekdays (0 = Monday … 6 = Sunday) |
| `[].schedule.byMonthDay` | number\[\] · can be null | Days of the month (1–31) |
| `[].schedule.timeOfDay` | string | Issuing time (HH:mm, account's timezone) |
| `[].schedule.startDate` | string | Start of the frequency |
| `[].schedule.endDate` | string (date-time) · can be null | End of the frequency |
| `[].schedule.dueDateInDaysRange` | number · can be null | Due term in days |
| `[].schedule.autoSend` | boolean · can be null | Automatic email sending |
| `[].schedule.autoSendEmails` | object · can be null | Recipients of the automatic sending |
| `[].schedule.autoSendEmails.sendToCustomer` | boolean · can be null |  |
| `[].schedule.autoSendEmails.customerEmail` | string · can be null |  |
| `[].schedule.autoSendEmails.sendToIssuer` | boolean · can be null |  |
| `[].schedule.nextRunAt` | string (date-time) · can be null | Next planned issue. Null when there are no more occurrences (COMPLETED) or the schedule is stopped. |
| `[].schedule.failReason` | string · can be null | Reason for the last failure, when status=FAILED |
| `[].createdAt` | string · can be null | Creation date |
| `[].updatedAt` | string · can be null | Last change date |

### Errors

-   `400` Invalid parameters
-   `401` Unauthorized - API key missing or invalid

## Create recurring invoice

POST `/invoices/scheduled`

Creates an invoice template (type INVOICE) that is issued automatically — and reported to the AT — on every occurrence of the given frequency. The issued documents appear in GET /invoices with scheduleTemplateId equal to the id returned here. Requires a plan with recurring invoices.

> Fiscal act: this call creates, settles or cancels fiscal documents, and it cannot be undone. Rehearse it in the sandbox first (`fiz_test_` keys).

Authentication: an API key (`x-api-key`). Send an `Idempotency-Key` to retry this call safely.

### Request body

The document to repeat and its schedule

| Field | Type | Description |
| --- | --- | --- |
| `cae` **required** | string | CAE code (Portuguese classification of economic activities) |
| `customerId` **required** | string | Customer identifier |
| `seriesId` | string | Series identifier (optional). Use the "id" returned by GET /series. If omitted, the account's default series is used. |
| `notes` | string | Invoice notes (optional) |
| `items` **required** | object\[\] | List of invoice items |
| `items[].id` **required** | string | Item identifier |
| `items[].quantity` **required** | number | Item quantity |
| `items[].unitPrice` | number | Unit price before VAT for this line (optional). Overrides the item's price on this document only: the catalogue item keeps its price. Send unitPrice OR unitPriceWithVat, not both. |
| `items[].unitPriceWithVat` | number | Unit price including VAT for this line (optional), instead of unitPrice. Converted to the price before VAT at the item's VAT rate, without rounding, so the VAT-inclusive total matches to the cent. Like unitPrice, it applies to this document only. Cannot be combined with an amount discount (discountType=AMOUNT), which is before VAT: use a percentage discount. |
| `items[].discountType` | string | Discount type for this line (optional). Overrides the discount set on the catalogue item. Applied before the invoice's global discount. — One of: `AMOUNT`, `PERCENT` |
| `items[].discountPercent` | number | Discount percentage for this line (e.g. 10 for 10%). Requires discountType=PERCENT. |
| `items[].discountAmount` | number | Absolute per-unit discount amount for this line, before VAT. Requires discountType=AMOUNT. |
| `items[].withholdingTaxEnabled` | boolean | Apply withholding tax on this line (optional). If omitted, the line follows the item (withholdingTaxAvailable). With true, withholding applies to this document only, at withholdingTaxPercent or, without it, the item's percentage; the type is IRS for a sole trader and IRC for a company. With false, the line has no withholding. The catalogue item is not changed. |
| `items[].withholdingTaxPercent` | number | Withholding tax percentage for this line (optional, e.g. 25). Turns withholding on for the line; cannot be sent with withholdingTaxEnabled=false. Applies to this document only. |
| `summary` | object | Invoice summary with global discount (optional) |
| `summary.globalDiscountType` | string | Global discount type — One of: `AMOUNT`, `PERCENT` |
| `summary.globalDiscountPercent` | number | Global discount percentage (e.g. 10 for 10%) |
| `summary.globalDiscountAmount` | number | Absolute global discount amount |
| `schedule` **required** | object | Frequency and issuing options |
| `schedule.frequency` **required** | string | Frequency. WEEKLY uses byDay; MONTHLY, QUARTERLY and ANNUALLY use byMonthDay. If omitted, the weekday / day of month of startDate applies. — One of: `DAILY`, `WEEKLY`, `MONTHLY`, `QUARTERLY`, `ANNUALLY` |
| `schedule.startDate` **required** | string | First day the frequency is computed from (ISO 8601). The first document is issued on the first occurrence of the frequency from this date. |
| `schedule.endDate` | string | Last day a document may be issued on (ISO 8601). If omitted, issuing repeats until paused or deleted. |
| `schedule.timeOfDay` | string | Issuing time as HH:mm, in the account's timezone. If omitted, 12:00 is used. |
| `schedule.byDay` | number\[\] | Weekdays to issue on (0 = Monday … 6 = Sunday). Only with frequency=WEEKLY. |
| `schedule.byMonthDay` | number\[\] | Days of the month to issue on (1–31). Only with frequency=MONTHLY, QUARTERLY or ANNUALLY. A day the month lacks (31 in April) skips that month — use 28 or less to issue every month. |
| `schedule.dueDateInDaysRange` | number | Due term in days, counted from each document's issue date. 0 (or omitted) = due on the same day. |
| `schedule.autoSend` | boolean | Email each issued document automatically, as set in autoSendEmails |
| `schedule.autoSendEmails` | object | Recipients of the automatic sending (only with autoSend=true) |
| `schedule.autoSendEmails.sendToCustomer` | boolean | Email the issued document to the customer |
| `schedule.autoSendEmails.customerEmail` | string | Alternative customer email for the sending. If omitted, the email on the customer's record is used. |
| `schedule.autoSendEmails.sendToIssuer` | boolean | Send a copy of the issued document to the account's email |
| `schedule.name` | string | Internal schedule name (optional) |

**curl**

```shell
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
```

```shell
curl --request POST 'https://api.fiz.co/invoices/scheduled' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}" \
  --data '{
  "cae": "1234",
  "customerId": "6863b1513117c5892ff55296",
  "items": [
    {
      "id": "68483e978073231c3947077c",
      "quantity": 1,
      "discountType": "PERCENT",
      "discountPercent": 10
    }
  ],
  "schedule": {
    "frequency": "MONTHLY",
    "byMonthDay": [
      1
    ],
    "startDate": "2026-10-01T00:00:00.000Z",
    "timeOfDay": "09:00",
    "dueDateInDaysRange": 30,
    "autoSend": true,
    "autoSendEmails": {
      "sendToCustomer": true
    }
  }
}'
```

**TypeScript**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const idempotencyKey = process.env.IDEMPOTENCY_KEY; // from the step above, the same on every retry
if (!idempotencyKey) throw new Error('Set IDEMPOTENCY_KEY first, in the step above');
const result = await fiz.recurringInvoices.create({
  cae: '1234',
  customerId: '6863b1513117c5892ff55296',
  items: [
    {
      id: '68483e978073231c3947077c',
      quantity: 1,
      discountType: 'PERCENT',
      discountPercent: 10,
    },
  ],
  schedule: {
    frequency: 'MONTHLY',
    byMonthDay: [
      1,
    ],
    startDate: '2026-10-01T00:00:00.000Z',
    timeOfDay: '09:00',
    dueDateInDaysRange: 30,
    autoSend: true,
    autoSendEmails: {
      sendToCustomer: true,
    },
  },
}, { idempotencyKey });
```

**Python**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```python
import os

from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
idempotency_key = os.environ["IDEMPOTENCY_KEY"]  # from the step above, the same on every retry
result = fiz.recurring_invoices.create({
    "cae": "1234",
    "customerId": "6863b1513117c5892ff55296",
    "items": [
        {
            "id": "68483e978073231c3947077c",
            "quantity": 1,
            "discountType": "PERCENT",
            "discountPercent": 10,
        },
    ],
    "schedule": {
        "frequency": "MONTHLY",
        "byMonthDay": [
            1,
        ],
        "startDate": "2026-10-01T00:00:00.000Z",
        "timeOfDay": "09:00",
        "dueDateInDaysRange": 30,
        "autoSend": True,
        "autoSendEmails": {
            "sendToCustomer": True,
        },
    },
}, idempotency_key=idempotency_key)
```

**PHP**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
// from the step above, the same on every retry
$idempotencyKey = getenv('IDEMPOTENCY_KEY') ?: throw new RuntimeException('Set IDEMPOTENCY_KEY first, in the step above');
$result = $fiz->recurringInvoices->create([
    'cae' => '1234',
    'customerId' => '6863b1513117c5892ff55296',
    'items' => [
        [
            'id' => '68483e978073231c3947077c',
            'quantity' => 1,
            'discountType' => 'PERCENT',
            'discountPercent' => 10,
        ],
    ],
    'schedule' => [
        'frequency' => 'MONTHLY',
        'byMonthDay' => [
            1,
        ],
        'startDate' => '2026-10-01T00:00:00.000Z',
        'timeOfDay' => '09:00',
        'dueDateInDaysRange' => 30,
        'autoSend' => true,
        'autoSendEmails' => [
            'sendToCustomer' => true,
        ],
    ],
], ['idempotencyKey' => $idempotencyKey]);
```

### Response `201`

Recurring invoice created successfully

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Schedule ID. Also the scheduleTemplateId of the documents issued from it. |
| `number` | string · can be null | Internal template reference (SCHED-0001, …). Not a fiscal number — each issued document gets its own number in the series. |
| `documentType` | string · can be null | Document type to issue |
| `status` | string | Template status — always SCHEDULED; the schedule status is in schedule.status |
| `notes` | string · can be null | Notes copied to each document |
| `cae` | string · can be null | CAE code |
| `series` | object · can be null | Series the documents are issued in |
| `series.ref` | string · can be null | Series identifier |
| `series.name` | string · can be null | Series name |
| `customer` | object · can be null | Customer |
| `customer.ref` | string · can be null | Customer identifier |
| `customer.data` | object · can be null | Customer data |
| `customer.data.taxpayerNumber` | string · can be null | Tax number (NIF) |
| `customer.data.name` | string · can be null | Customer name |
| `customer.data.email` | string · can be null | Customer email |
| `customer.data.country` | string · can be null | Customer country |
| `customer.data.phone` | string · can be null | Customer phone |
| `summary` | object · can be null | Totals of each document to issue |
| `summary.amountWithoutTax` | number · can be null | Amount without tax |
| `summary.amountWithTax` | number · can be null | Amount with tax |
| `summary.amountWithoutTaxWithoutDiscount` | number · can be null | Amount without tax and discount |
| `summary.taxAmount` | number · can be null | Tax amount |
| `summary.globalDiscountType` | string · can be null | Global discount type — One of: `AMOUNT`, `PERCENT` |
| `summary.globalDiscountPercent` | number · can be null | Global discount percentage |
| `summary.globalDiscountAmount` | number · can be null | Global discount amount |
| `summary.total` | number · can be null | Total |
| `summary.totalToPay` | number · can be null | Total payable |
| `summary.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `summary.creditNotesTotal` | number · can be null | Total of credit notes |
| `items` | object\[\] · can be null | Items |
| `items[].id` | string | Identifier of the item on the invoice |
| `items[].ref` | string · can be null | Item reference |
| `items[].meta` | object · can be null | Item metadata |
| `items[].meta.quantity` | number · can be null | Item quantity |
| `items[].meta.amountWithoutTax` | number · can be null | Amount without tax |
| `items[].meta.amountWithTax` | number · can be null | Amount with tax |
| `items[].meta.taxAmount` | number · can be null | Tax amount |
| `items[].meta.discountAmount` | number · can be null | Discount amount applied to the item |
| `items[].meta.unitAmountWithoutTax` | number · can be null | Unit amount without tax |
| `items[].meta.unitAmountWithTax` | number · can be null | Unit amount with tax |
| `items[].meta.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `items[].meta.withholdingTaxEnabled` | boolean · can be null | Withholding tax enabled |
| `items[].data` | object · can be null | Item data |
| `items[].data.name` | string · can be null | Item name |
| `items[].data.description` | string · can be null | Item description |
| `items[].data.type` | string | Item type |
| `items[].data.unitPrice` | number · can be null | Unit price |
| `items[].data.taxRate` | number · can be null | Tax rate |
| `items[].data.vatRate` | string · can be null | VAT rate |
| `items[].data.vatTerritory` | string · can be null | VAT territory |
| `items[].data.vatExemptionReason` | string · can be null | VAT exemption reason |
| `items[].data.isAutoVATEnabled` | boolean · can be null | Automatic VAT enabled |
| `items[].noteChangeKind` | string · can be null | Only on the lines of partial credit/debit notes: what the line changes on the corrected invoice line — the quantity (QUANTITY) or the unit price (PRICE). Absent on other lines and on older notes. — One of: `QUANTITY`, `PRICE` |
| `items[].noteChangeFrom` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line before this note. |
| `items[].noteChangeTo` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line after this note. |
| `schedule` | object · can be null | Schedule |
| `schedule.status` | string · can be null | Schedule status. SCHEDULED issues on the next occurrence; PAUSED is on hold; COMPLETED reached endDate; FAILED stopped on an error (see failReason) and resumes with status=SCHEDULED. — One of: `COMPLETED`, `FAILED`, `PAUSED`, `SCHEDULED`, `STOPPED` |
| `schedule.frequency` | string | Frequency. CUSTOM only appears on schedules created in the web app; the API does not accept it on create. — One of: `ANNUALLY`, `CUSTOM`, `DAILY`, `MONTHLY`, `QUARTERLY`, `WEEKLY` |
| `schedule.interval` | number · can be null | Interval between occurrences. Only has an effect with frequency=CUSTOM (schedules created in the web app); the API keeps it on update. |
| `schedule.name` | string · can be null | Internal schedule name |
| `schedule.byDay` | number\[\] · can be null | Weekdays (0 = Monday … 6 = Sunday) |
| `schedule.byMonthDay` | number\[\] · can be null | Days of the month (1–31) |
| `schedule.timeOfDay` | string | Issuing time (HH:mm, account's timezone) |
| `schedule.startDate` | string | Start of the frequency |
| `schedule.endDate` | string (date-time) · can be null | End of the frequency |
| `schedule.dueDateInDaysRange` | number · can be null | Due term in days |
| `schedule.autoSend` | boolean · can be null | Automatic email sending |
| `schedule.autoSendEmails` | object · can be null | Recipients of the automatic sending |
| `schedule.autoSendEmails.sendToCustomer` | boolean · can be null |  |
| `schedule.autoSendEmails.customerEmail` | string · can be null |  |
| `schedule.autoSendEmails.sendToIssuer` | boolean · can be null |  |
| `schedule.nextRunAt` | string (date-time) · can be null | Next planned issue. Null when there are no more occurrences (COMPLETED) or the schedule is stopped. |
| `schedule.failReason` | string · can be null | Reason for the last failure, when status=FAILED |
| `createdAt` | string · can be null | Creation date |
| `updatedAt` | string · can be null | Last change date |

### Errors

-   `400` Invalid data, or a schedule with no occurrences (endDate before startDate, say)
-   `401` Unauthorized - API key missing or invalid
-   `403` The account plan does not include recurring invoices
-   `409` A request with this idempotency key is still being processed, or the outcome of the first attempt is unknown
-   `422` The idempotency key was already used with a different request body

## Get recurring invoice by ID

GET `/invoices/scheduled/{id}`

Returns one recurring-invoice template and its schedule

Authentication: an API key (`x-api-key`).

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` **required** | path | string | Recurring invoice ID |

**curl**

```shell
curl 'https://api.fiz.co/invoices/scheduled/ID' \
  --header "x-api-key: $FIZ_API_KEY"
```

**TypeScript**

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.recurringInvoices.retrieve('ID');
```

**Python**

```python
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.recurring_invoices.retrieve("ID")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->recurringInvoices->retrieve('ID');
```

### Response `200`

Recurring invoice found

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Schedule ID. Also the scheduleTemplateId of the documents issued from it. |
| `number` | string · can be null | Internal template reference (SCHED-0001, …). Not a fiscal number — each issued document gets its own number in the series. |
| `documentType` | string · can be null | Document type to issue |
| `status` | string | Template status — always SCHEDULED; the schedule status is in schedule.status |
| `notes` | string · can be null | Notes copied to each document |
| `cae` | string · can be null | CAE code |
| `series` | object · can be null | Series the documents are issued in |
| `series.ref` | string · can be null | Series identifier |
| `series.name` | string · can be null | Series name |
| `customer` | object · can be null | Customer |
| `customer.ref` | string · can be null | Customer identifier |
| `customer.data` | object · can be null | Customer data |
| `customer.data.taxpayerNumber` | string · can be null | Tax number (NIF) |
| `customer.data.name` | string · can be null | Customer name |
| `customer.data.email` | string · can be null | Customer email |
| `customer.data.country` | string · can be null | Customer country |
| `customer.data.phone` | string · can be null | Customer phone |
| `summary` | object · can be null | Totals of each document to issue |
| `summary.amountWithoutTax` | number · can be null | Amount without tax |
| `summary.amountWithTax` | number · can be null | Amount with tax |
| `summary.amountWithoutTaxWithoutDiscount` | number · can be null | Amount without tax and discount |
| `summary.taxAmount` | number · can be null | Tax amount |
| `summary.globalDiscountType` | string · can be null | Global discount type — One of: `AMOUNT`, `PERCENT` |
| `summary.globalDiscountPercent` | number · can be null | Global discount percentage |
| `summary.globalDiscountAmount` | number · can be null | Global discount amount |
| `summary.total` | number · can be null | Total |
| `summary.totalToPay` | number · can be null | Total payable |
| `summary.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `summary.creditNotesTotal` | number · can be null | Total of credit notes |
| `items` | object\[\] · can be null | Items |
| `items[].id` | string | Identifier of the item on the invoice |
| `items[].ref` | string · can be null | Item reference |
| `items[].meta` | object · can be null | Item metadata |
| `items[].meta.quantity` | number · can be null | Item quantity |
| `items[].meta.amountWithoutTax` | number · can be null | Amount without tax |
| `items[].meta.amountWithTax` | number · can be null | Amount with tax |
| `items[].meta.taxAmount` | number · can be null | Tax amount |
| `items[].meta.discountAmount` | number · can be null | Discount amount applied to the item |
| `items[].meta.unitAmountWithoutTax` | number · can be null | Unit amount without tax |
| `items[].meta.unitAmountWithTax` | number · can be null | Unit amount with tax |
| `items[].meta.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `items[].meta.withholdingTaxEnabled` | boolean · can be null | Withholding tax enabled |
| `items[].data` | object · can be null | Item data |
| `items[].data.name` | string · can be null | Item name |
| `items[].data.description` | string · can be null | Item description |
| `items[].data.type` | string | Item type |
| `items[].data.unitPrice` | number · can be null | Unit price |
| `items[].data.taxRate` | number · can be null | Tax rate |
| `items[].data.vatRate` | string · can be null | VAT rate |
| `items[].data.vatTerritory` | string · can be null | VAT territory |
| `items[].data.vatExemptionReason` | string · can be null | VAT exemption reason |
| `items[].data.isAutoVATEnabled` | boolean · can be null | Automatic VAT enabled |
| `items[].noteChangeKind` | string · can be null | Only on the lines of partial credit/debit notes: what the line changes on the corrected invoice line — the quantity (QUANTITY) or the unit price (PRICE). Absent on other lines and on older notes. — One of: `QUANTITY`, `PRICE` |
| `items[].noteChangeFrom` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line before this note. |
| `items[].noteChangeTo` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line after this note. |
| `schedule` | object · can be null | Schedule |
| `schedule.status` | string · can be null | Schedule status. SCHEDULED issues on the next occurrence; PAUSED is on hold; COMPLETED reached endDate; FAILED stopped on an error (see failReason) and resumes with status=SCHEDULED. — One of: `COMPLETED`, `FAILED`, `PAUSED`, `SCHEDULED`, `STOPPED` |
| `schedule.frequency` | string | Frequency. CUSTOM only appears on schedules created in the web app; the API does not accept it on create. — One of: `ANNUALLY`, `CUSTOM`, `DAILY`, `MONTHLY`, `QUARTERLY`, `WEEKLY` |
| `schedule.interval` | number · can be null | Interval between occurrences. Only has an effect with frequency=CUSTOM (schedules created in the web app); the API keeps it on update. |
| `schedule.name` | string · can be null | Internal schedule name |
| `schedule.byDay` | number\[\] · can be null | Weekdays (0 = Monday … 6 = Sunday) |
| `schedule.byMonthDay` | number\[\] · can be null | Days of the month (1–31) |
| `schedule.timeOfDay` | string | Issuing time (HH:mm, account's timezone) |
| `schedule.startDate` | string | Start of the frequency |
| `schedule.endDate` | string (date-time) · can be null | End of the frequency |
| `schedule.dueDateInDaysRange` | number · can be null | Due term in days |
| `schedule.autoSend` | boolean · can be null | Automatic email sending |
| `schedule.autoSendEmails` | object · can be null | Recipients of the automatic sending |
| `schedule.autoSendEmails.sendToCustomer` | boolean · can be null |  |
| `schedule.autoSendEmails.customerEmail` | string · can be null |  |
| `schedule.autoSendEmails.sendToIssuer` | boolean · can be null |  |
| `schedule.nextRunAt` | string (date-time) · can be null | Next planned issue. Null when there are no more occurrences (COMPLETED) or the schedule is stopped. |
| `schedule.failReason` | string · can be null | Reason for the last failure, when status=FAILED |
| `createdAt` | string · can be null | Creation date |
| `updatedAt` | string · can be null | Last change date |

### Errors

-   `401` Unauthorized - API key missing or invalid
-   `404` Recurring invoice not found

## Update recurring invoice

PATCH `/invoices/scheduled/{id}`

Changes the schedule (frequency, dates, time, auto-send) or pauses/resumes issuing. Only the fields sent are changed; null is accepted on endDate only. To change the document itself (items, customer, notes) use PATCH /invoices/{id} with the same id.

> Resuming a schedule (`status: SCHEDULED`) makes FIZ issue documents on its own again, from the next run. Pausing it, or changing other fields, issues nothing.

Authentication: an API key (`x-api-key`). Send an `Idempotency-Key` to retry this call safely.

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` **required** | path | string | Recurring invoice ID |

### Request body

Schedule fields to update

| Field | Type | Description |
| --- | --- | --- |
| `frequency` | string | Frequency. WEEKLY uses byDay; MONTHLY, QUARTERLY and ANNUALLY use byMonthDay. If omitted, the weekday / day of month of startDate applies. — One of: `DAILY`, `WEEKLY`, `MONTHLY`, `QUARTERLY`, `ANNUALLY` |
| `startDate` | string | First day the frequency is computed from (ISO 8601). The first document is issued on the first occurrence of the frequency from this date. |
| `timeOfDay` | string | Issuing time as HH:mm, in the account's timezone. If omitted, 12:00 is used. |
| `byDay` | number\[\] | Weekdays to issue on (0 = Monday … 6 = Sunday). Only with frequency=WEEKLY. |
| `byMonthDay` | number\[\] | Days of the month to issue on (1–31). Only with frequency=MONTHLY, QUARTERLY or ANNUALLY. A day the month lacks (31 in April) skips that month — use 28 or less to issue every month. |
| `dueDateInDaysRange` | number | Due term in days, counted from each document's issue date. 0 (or omitted) = due on the same day. |
| `autoSend` | boolean | Email each issued document automatically, as set in autoSendEmails |
| `autoSendEmails` | object | Recipients of the automatic sending (only with autoSend=true) |
| `autoSendEmails.sendToCustomer` | boolean | Email the issued document to the customer |
| `autoSendEmails.customerEmail` | string | Alternative customer email for the sending. If omitted, the email on the customer's record is used. |
| `autoSendEmails.sendToIssuer` | boolean | Send a copy of the issued document to the account's email |
| `name` | string | Internal schedule name (optional) |
| `status` | string | Pause (PAUSED) or (re)activate (SCHEDULED) the schedule. A FAILED or COMPLETED schedule only issues again after receiving SCHEDULED. — One of: `SCHEDULED`, `PAUSED` |
| `endDate` | string (date-time) · can be null | Last day a document may be issued on (ISO 8601). Send null to remove the end and repeat indefinitely. If omitted, the stored value is kept. |

**curl**

```shell
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
```

```shell
curl --request PATCH 'https://api.fiz.co/invoices/scheduled/ID' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}" \
  --data '{
  "frequency": "MONTHLY",
  "startDate": "2026-10-01T00:00:00.000Z",
  "timeOfDay": "09:00"
}'
```

**TypeScript**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const idempotencyKey = process.env.IDEMPOTENCY_KEY; // from the step above, the same on every retry
if (!idempotencyKey) throw new Error('Set IDEMPOTENCY_KEY first, in the step above');
const result = await fiz.recurringInvoices.update('ID', {
  frequency: 'MONTHLY',
  startDate: '2026-10-01T00:00:00.000Z',
  timeOfDay: '09:00',
}, { idempotencyKey });
```

**Python**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```python
import os

from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
idempotency_key = os.environ["IDEMPOTENCY_KEY"]  # from the step above, the same on every retry
result = fiz.recurring_invoices.update("ID", {
    "frequency": "MONTHLY",
    "startDate": "2026-10-01T00:00:00.000Z",
    "timeOfDay": "09:00",
}, idempotency_key=idempotency_key)
```

**PHP**

```shell
# Once per fiscal operation, before the call. Store it with the document:
# a retry after a lost response reuses it and gets the recorded result, or a 409
# without Retry-After when the outcome is unknown: then check the document first.
export IDEMPOTENCY_KEY=$(uuidgen)
```

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
// from the step above, the same on every retry
$idempotencyKey = getenv('IDEMPOTENCY_KEY') ?: throw new RuntimeException('Set IDEMPOTENCY_KEY first, in the step above');
$result = $fiz->recurringInvoices->update('ID', [
    'frequency' => 'MONTHLY',
    'startDate' => '2026-10-01T00:00:00.000Z',
    'timeOfDay' => '09:00',
], ['idempotencyKey' => $idempotencyKey]);
```

### Response `200`

Recurring invoice updated successfully

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Schedule ID. Also the scheduleTemplateId of the documents issued from it. |
| `number` | string · can be null | Internal template reference (SCHED-0001, …). Not a fiscal number — each issued document gets its own number in the series. |
| `documentType` | string · can be null | Document type to issue |
| `status` | string | Template status — always SCHEDULED; the schedule status is in schedule.status |
| `notes` | string · can be null | Notes copied to each document |
| `cae` | string · can be null | CAE code |
| `series` | object · can be null | Series the documents are issued in |
| `series.ref` | string · can be null | Series identifier |
| `series.name` | string · can be null | Series name |
| `customer` | object · can be null | Customer |
| `customer.ref` | string · can be null | Customer identifier |
| `customer.data` | object · can be null | Customer data |
| `customer.data.taxpayerNumber` | string · can be null | Tax number (NIF) |
| `customer.data.name` | string · can be null | Customer name |
| `customer.data.email` | string · can be null | Customer email |
| `customer.data.country` | string · can be null | Customer country |
| `customer.data.phone` | string · can be null | Customer phone |
| `summary` | object · can be null | Totals of each document to issue |
| `summary.amountWithoutTax` | number · can be null | Amount without tax |
| `summary.amountWithTax` | number · can be null | Amount with tax |
| `summary.amountWithoutTaxWithoutDiscount` | number · can be null | Amount without tax and discount |
| `summary.taxAmount` | number · can be null | Tax amount |
| `summary.globalDiscountType` | string · can be null | Global discount type — One of: `AMOUNT`, `PERCENT` |
| `summary.globalDiscountPercent` | number · can be null | Global discount percentage |
| `summary.globalDiscountAmount` | number · can be null | Global discount amount |
| `summary.total` | number · can be null | Total |
| `summary.totalToPay` | number · can be null | Total payable |
| `summary.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `summary.creditNotesTotal` | number · can be null | Total of credit notes |
| `items` | object\[\] · can be null | Items |
| `items[].id` | string | Identifier of the item on the invoice |
| `items[].ref` | string · can be null | Item reference |
| `items[].meta` | object · can be null | Item metadata |
| `items[].meta.quantity` | number · can be null | Item quantity |
| `items[].meta.amountWithoutTax` | number · can be null | Amount without tax |
| `items[].meta.amountWithTax` | number · can be null | Amount with tax |
| `items[].meta.taxAmount` | number · can be null | Tax amount |
| `items[].meta.discountAmount` | number · can be null | Discount amount applied to the item |
| `items[].meta.unitAmountWithoutTax` | number · can be null | Unit amount without tax |
| `items[].meta.unitAmountWithTax` | number · can be null | Unit amount with tax |
| `items[].meta.withholdingTaxAmount` | number · can be null | Withholding tax amount |
| `items[].meta.withholdingTaxEnabled` | boolean · can be null | Withholding tax enabled |
| `items[].data` | object · can be null | Item data |
| `items[].data.name` | string · can be null | Item name |
| `items[].data.description` | string · can be null | Item description |
| `items[].data.type` | string | Item type |
| `items[].data.unitPrice` | number · can be null | Unit price |
| `items[].data.taxRate` | number · can be null | Tax rate |
| `items[].data.vatRate` | string · can be null | VAT rate |
| `items[].data.vatTerritory` | string · can be null | VAT territory |
| `items[].data.vatExemptionReason` | string · can be null | VAT exemption reason |
| `items[].data.isAutoVATEnabled` | boolean · can be null | Automatic VAT enabled |
| `items[].noteChangeKind` | string · can be null | Only on the lines of partial credit/debit notes: what the line changes on the corrected invoice line — the quantity (QUANTITY) or the unit price (PRICE). Absent on other lines and on older notes. — One of: `QUANTITY`, `PRICE` |
| `items[].noteChangeFrom` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line before this note. |
| `items[].noteChangeTo` | number · can be null | With noteChangeKind: the quantity or unit price of the invoice line after this note. |
| `schedule` | object · can be null | Schedule |
| `schedule.status` | string · can be null | Schedule status. SCHEDULED issues on the next occurrence; PAUSED is on hold; COMPLETED reached endDate; FAILED stopped on an error (see failReason) and resumes with status=SCHEDULED. — One of: `COMPLETED`, `FAILED`, `PAUSED`, `SCHEDULED`, `STOPPED` |
| `schedule.frequency` | string | Frequency. CUSTOM only appears on schedules created in the web app; the API does not accept it on create. — One of: `ANNUALLY`, `CUSTOM`, `DAILY`, `MONTHLY`, `QUARTERLY`, `WEEKLY` |
| `schedule.interval` | number · can be null | Interval between occurrences. Only has an effect with frequency=CUSTOM (schedules created in the web app); the API keeps it on update. |
| `schedule.name` | string · can be null | Internal schedule name |
| `schedule.byDay` | number\[\] · can be null | Weekdays (0 = Monday … 6 = Sunday) |
| `schedule.byMonthDay` | number\[\] · can be null | Days of the month (1–31) |
| `schedule.timeOfDay` | string | Issuing time (HH:mm, account's timezone) |
| `schedule.startDate` | string | Start of the frequency |
| `schedule.endDate` | string (date-time) · can be null | End of the frequency |
| `schedule.dueDateInDaysRange` | number · can be null | Due term in days |
| `schedule.autoSend` | boolean · can be null | Automatic email sending |
| `schedule.autoSendEmails` | object · can be null | Recipients of the automatic sending |
| `schedule.autoSendEmails.sendToCustomer` | boolean · can be null |  |
| `schedule.autoSendEmails.customerEmail` | string · can be null |  |
| `schedule.autoSendEmails.sendToIssuer` | boolean · can be null |  |
| `schedule.nextRunAt` | string (date-time) · can be null | Next planned issue. Null when there are no more occurrences (COMPLETED) or the schedule is stopped. |
| `schedule.failReason` | string · can be null | Reason for the last failure, when status=FAILED |
| `createdAt` | string · can be null | Creation date |
| `updatedAt` | string · can be null | Last change date |

### Errors

-   `400` Invalid data, or a schedule with no occurrences (endDate before startDate, say)
-   `401` Unauthorized - API key missing or invalid
-   `404` Recurring invoice not found
-   `409` A request with this idempotency key is still being processed, or the outcome of the first attempt is unknown
-   `422` The idempotency key was already used with a different request body

## Delete recurring invoice

DELETE `/invoices/scheduled/{id}`

Deletes the template and ends issuing. Documents already issued are kept but stop referencing this schedule (scheduleTemplateId) — save the ids from GET /invoices?scheduleTemplateId={id} before deleting if you need to reconcile them later. To stop without losing the history, pause with PATCH /invoices/scheduled/{id} and status=PAUSED.

Authentication: an API key (`x-api-key`). Send an `Idempotency-Key` to retry this call safely.

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` **required** | path | string | Recurring invoice ID |

**curl**

```shell
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
```

```shell
curl --request DELETE 'https://api.fiz.co/invoices/scheduled/ID' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}"
```

**TypeScript**

```ts
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.recurringInvoices.delete('ID');
```

**Python**

```python
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.recurring_invoices.delete("ID")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->recurringInvoices->delete('ID');
```

### Response `200`

Recurring invoice deleted successfully

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique invoice identifier |
| `createdAt` | string · can be null | Invoice creation date |

### Errors

-   `401` Unauthorized - API key missing or invalid
-   `404` Recurring invoice not found
-   `409` A request with this idempotency key is still being processed, or the outcome of the first attempt is unknown
-   `422` The idempotency key was already used with a different request body

## Errors

Errors share one shape: `statusCode`, `message`, `code` and `error`, with the request id in the `X-Request-Id` header.

## All resources

-   [Company](https://api.fiz.co/docs/api/company) ([Markdown](https://api.fiz.co/docs/api/company.md))
-   [Customers](https://api.fiz.co/docs/api/customers) ([Markdown](https://api.fiz.co/docs/api/customers.md))
-   [Items](https://api.fiz.co/docs/api/items) ([Markdown](https://api.fiz.co/docs/api/items.md))
-   [Invoices](https://api.fiz.co/docs/api/invoices) ([Markdown](https://api.fiz.co/docs/api/invoices.md))
-   [Recurring invoices](https://api.fiz.co/docs/api/recurring-invoices) ([Markdown](https://api.fiz.co/docs/api/recurring-invoices.md))
-   [Pro formas](https://api.fiz.co/docs/api/pro-formas) ([Markdown](https://api.fiz.co/docs/api/pro-formas.md))
-   [Transport documents](https://api.fiz.co/docs/api/transport-documents) ([Markdown](https://api.fiz.co/docs/api/transport-documents.md))
-   [Series](https://api.fiz.co/docs/api/series) ([Markdown](https://api.fiz.co/docs/api/series.md))
-   [PDF templates](https://api.fiz.co/docs/api/pdf-templates) ([Markdown](https://api.fiz.co/docs/api/pdf-templates.md))
-   [Exports](https://api.fiz.co/docs/api/exports) ([Markdown](https://api.fiz.co/docs/api/exports.md))
-   [Expenses](https://api.fiz.co/docs/api/expenses) ([Markdown](https://api.fiz.co/docs/api/expenses.md))
-   [VAT](https://api.fiz.co/docs/api/vat) ([Markdown](https://api.fiz.co/docs/api/vat.md))
-   [Bank](https://api.fiz.co/docs/api/bank) ([Markdown](https://api.fiz.co/docs/api/bank.md))
