---
title: "Wyślij fakturę e-mailem"
description: "Zakres: `api:invoices:write`. Wysyła PDF faktury e-mailem i zmienia jej status na `sent` (chyba że jest `paid`).\nZwraca `403` z `limit: cant_print_invoice` po wyczerpaniu limitu wydruków."
---

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

Path: inFakt API › Faktury VAT

`POST /invoices/{id}/deliver_via_email.json`

Zakres: `api:invoices:write`. Wysyła PDF faktury e-mailem i zmienia jej status na `sent` (chyba że jest `paid`).
Zwraca `403` z `limit: cant_print_invoice` po wyczerpaniu limitu wydruków.

## Authentication

Requires one of the following:

- `ApiKey`, apiKey, in header, header `X-inFakt-ApiKey`
- `Token`, apiKey, in header, header `X-Token`

## Path parameters

- `id` (`Invoices_sendByEmail.path.id`; string, required) — Liczbowe `id` albo `uuid` rekordu.

## Query parameters

- `allow_correction` (`Invoices_sendByEmail.query.allow_correction`; boolean, optional) — Potwierdź akcję, która skoryguje złożone deklaracje (zamknięty okres księgowy). Bez tego takie żądania zwracają `422` z `errors.allow_correction` albo `errors.locked_accounting`, gdy plan nie pozwala na korekty (wtedy ta flaga jest ignorowana). Można też podać w treści żądania.

## Request body

_Required._

- `recipient` (`Invoices_sendByEmail.recipient`; string, optional) — Adresy rozdzielone przecinkami; domyślnie e-mail klienta.
- `print_type` (`Invoices_sendByEmail.print_type`; string, optional)
  - one of `"original"`, `"copy"`, `"original_copy"`, `"original_duplicate"`, `"copy_duplicate"`, `"duplicate"`, `"regular"`, `"double_regular"`; default `"regular"`
- `locale` (`Invoices_sendByEmail.locale`; string, optional)
  - one of `"pl"`, `"en"`, `"pe"`; default `"pl"`
- `send_copy` (`Invoices_sendByEmail.send_copy`; boolean, optional) — Wyślij kopię do właściciela konta.
  - default `false`
- `content` (`Invoices_sendByEmail.content`; string, optional) — Treść wiadomości.

## Example requests

### Wysyłka do klienta

```json
{
  "recipient": "ksiegowosc@example.com",
  "print_type": "original",
  "locale": "pl",
  "send_copy": true
}
```

### Nieprawidłowy odbiorca

```json
{
  "locale": "pl",
  "recipient": "nie-email"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.sandbox-infakt.pl/v3/invoices/999/deliver_via_email.json \
  --header 'Content-Type: application/json' \
  --header 'X-inFakt-ApiKey: <X-inFakt-ApiKey>' \
  --data '
{
  "recipient": "ksiegowosc@example.com",
  "print_type": "original",
  "locale": "pl",
  "send_copy": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sandbox-infakt.pl/v3/invoices/999/deliver_via_email.json';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-inFakt-ApiKey': '<X-inFakt-ApiKey>'},
  body: JSON.stringify({
    recipient: 'ksiegowosc@example.com',
    print_type: 'original',
    locale: 'pl',
    send_copy: true
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sandbox-infakt.pl/v3/invoices/999/deliver_via_email.json"

payload = {
    "recipient": "ksiegowosc@example.com",
    "print_type": "original",
    "locale": "pl",
    "send_copy": True
}
headers = {
    "Content-Type": "application/json",
    "X-inFakt-ApiKey": "<X-inFakt-ApiKey>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 202

Przyjęto do przetwarzania

### 401

Brak klucza API, nieprawidłowy klucz albo klucz bez wymaganego zakresu uprawnień.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.401.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.401.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.401.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.401.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.401.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.401.action_url`; string, optional)

### 402

API niedostępne w obecnym planie (`limit: plan_upgrade_needed`) albo osiągnięty limit dokumentów.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.402.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.402.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.402.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.402.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.402.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.402.action_url`; string, optional)

### 403

Brak uprawnień, limit planu dla tej akcji (`limit`) albo zawieszone konto.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.403.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.403.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.403.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.403.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.403.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.403.action_url`; string, optional)

### 404

Nie znaleziono zasobu.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.404.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.404.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.404.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.404.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.404.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.404.action_url`; string, optional)

### 406

Ścieżka nie kończy się na `.json`.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.406.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.406.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.406.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.406.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.406.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.406.action_url`; string, optional)

### 422

Walidacja nie powiodła się; szczegóły w `errors`.

#### Example

```json
{
  "errors": {
    "recipient": [
      "Wpisany adres e-mail jest niepoprawny."
    ]
  }
}
```

- `error` (`Invoices_sendByEmail.response.422.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.422.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.422.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.422.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.422.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.422.action_url`; string, optional)

### 423

Niepotwierdzony adres e-mail albo wymagana weryfikacja tożsamości.

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.423.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.423.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.423.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.423.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.423.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.423.action_url`; string, optional)

### 429

Przekroczony limit zapytań. Komunikat jest po angielsku, np. `API rate limit exceeded. Try again in 60 seconds.`

#### Example

```json
{
  "error": "Zasób którego szukasz nie został znaleziony."
}
```

- `error` (`Invoices_sendByEmail.response.429.error`; any of, optional) — Komunikat po polsku (po angielsku dla `429`). Niektóre akcje zamiast jednego tekstu zwracają listę komunikatów albo błędy walidacji według pól.
  - any of: `string`, `array<string>`, `object`
- `errors` (`Invoices_sendByEmail.response.429.errors`; any of, optional) — Błędy walidacji według nazw pól API; na niektórych endpointach zwykły komunikat.
  - any of: `object`, `string`
- `limit` (`Invoices_sendByEmail.response.429.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Invoices_sendByEmail.response.429.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Invoices_sendByEmail.response.429.url`; string, optional)
- `action_url` (`Invoices_sendByEmail.response.429.action_url`; string, optional)


Source: https://docs.niebieskiorzel.pl/api/invoices-send-by-email/index.md
