---
title: "Utwórz produkt"
description: "Zakres: `api:invoices:write`."
---

> 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 › Produkty

`POST /products.json`

Zakres: `api:invoices:write`.

## Authentication

Requires one of the following:

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

## Request body

_Required._

- `product` (`Products_create.product`; object, required) — Wymagane są `name` (unikalna) i `tax_symbol`. Ceny nie są wyliczane: pominięte ceny zapisują się jako `0`. `tax_price` musi być równe `net_price` × stawka VAT (±1 grosz, klucz błędu `vat`), a `gross_price` musi być równe `net_price` + `tax_price` (klucz błędu `gross`).
  - `name` (`Products_create.product.name`; string, required)
  - `tax_symbol` (`Products_create.product.tax_symbol`; string, required) — Symbol stawki VAT. Zobacz `GET /vat_rates.json`.
  - `pkwiu` (`Products_create.product.pkwiu`; string, optional)
    - maxLength 50; pattern `^[.\d]+$`
  - `cn` (`Products_create.product.cn`; string, optional)
    - maxLength 50; pattern `^[\d ]+$`
  - `pkob` (`Products_create.product.pkob`; string, optional)
    - maxLength 50; pattern `^\d+$`
  - `gtin` (`Products_create.product.gtin`; string, optional)
    - maxLength 20; pattern `^\d+$`
  - `symbol` (`Products_create.product.symbol`; string, optional) — Ignorowane, gdy wysłano `pkwiu`, `cn` lub `pkob`.
  - `unit` (`Products_create.product.unit`; string, optional)
  - `flat_rate_tax_symbol` (`Products_create.product.flat_rate_tax_symbol`; string, optional)
  - `quantity` (`Products_create.product.quantity`; number, optional) — Domyślnie `1`.
    - format `double`
  - `net_price` (`Products_create.product.net_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `tax_price` (`Products_create.product.tax_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `gross_price` (`Products_create.product.gross_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `unit_net_price` (`Products_create.product.unit_net_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `purchase_unit_net_price` (`Products_create.product.purchase_unit_net_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `purchase_unit_gross_price` (`Products_create.product.purchase_unit_gross_price`; integer, optional) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
    - format `int64`
  - `discount` (`Products_create.product.discount`; number, optional) — Rabat w procentach; domyślnie `0`.
    - format `double`; min 0
  - `unit_net_price_before_discount` (`Products_create.product.unit_net_price_before_discount`; integer, optional) — Domyślnie `unit_net_price`.
    - format `int64`
  - `vat_exemption_reason` (`Products_create.product.vat_exemption_reason`; integer, optional)
    - format `int64`
  - `gtu_id` (`Products_create.product.gtu_id`; integer, optional)
    - format `int64`

## Example requests

### Produkt ze stawką 23% VAT

```json
{
  "product": {
    "name": "Macbook Pro",
    "pkwiu": "234",
    "unit": "szt.",
    "tax_symbol": "23",
    "quantity": 1,
    "net_price": 406423,
    "tax_price": 93477,
    "gross_price": 499900,
    "unit_net_price": 406423,
    "purchase_unit_net_price": 350000,
    "purchase_unit_gross_price": 430500
  }
}
```

### Niezgodna kwota brutto

```json
{
  "product": {
    "name": "Macbook Air",
    "tax_symbol": "23",
    "quantity": 1,
    "net_price": 406423,
    "tax_price": 93477,
    "gross_price": 500000,
    "unit_net_price": 406423
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.sandbox-infakt.pl/v3/products.json \
  --header 'Content-Type: application/json' \
  --header 'X-inFakt-ApiKey: <X-inFakt-ApiKey>' \
  --data '
{
  "product": {
    "name": "Macbook Pro",
    "pkwiu": "234",
    "unit": "szt.",
    "tax_symbol": "23",
    "quantity": 1,
    "net_price": 406423,
    "tax_price": 93477,
    "gross_price": 499900,
    "unit_net_price": 406423,
    "purchase_unit_net_price": 350000,
    "purchase_unit_gross_price": 430500
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.sandbox-infakt.pl/v3/products.json';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-inFakt-ApiKey': '<X-inFakt-ApiKey>'},
  body: JSON.stringify({
    product: {
      name: 'Macbook Pro',
      pkwiu: '234',
      unit: 'szt.',
      tax_symbol: '23',
      quantity: 1,
      net_price: 406423,
      tax_price: 93477,
      gross_price: 499900,
      unit_net_price: 406423,
      purchase_unit_net_price: 350000,
      purchase_unit_gross_price: 430500
    }
  })
};

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/products.json"

payload = { "product": {
        "name": "Macbook Pro",
        "pkwiu": "234",
        "unit": "szt.",
        "tax_symbol": "23",
        "quantity": 1,
        "net_price": 406423,
        "tax_price": 93477,
        "gross_price": 499900,
        "unit_net_price": 406423,
        "purchase_unit_net_price": 350000,
        "purchase_unit_gross_price": 430500
    } }
headers = {
    "Content-Type": "application/json",
    "X-inFakt-ApiKey": "<X-inFakt-ApiKey>"
}

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

print(response.text)
```

## Responses

### 201

Utworzono

#### Example

```json
{
  "id": 1007,
  "uuid": "c41f7a2d-9b3e-4d58-a6c1-0e7b2f9d3a85",
  "name": "Macbook Pro",
  "symbol": "234 / - / -",
  "pkwiu": "234",
  "cn": null,
  "pkob": null,
  "gtin": null,
  "unit": "szt.",
  "tax_symbol": "23",
  "flat_rate_tax_symbol": "",
  "quantity": 1,
  "net_price": 406423,
  "tax_price": 93477,
  "gross_price": 499900,
  "unit_net_price": 406423,
  "purchase_unit_net_price": 350000,
  "purchase_unit_gross_price": 430500,
  "discount": "0.0",
  "unit_net_price_before_discount": 406423,
  "vat_exemption_reason": null,
  "gtu_id": null
}
```

- `id` (`Products_create.response.201.id`; integer, required)
  - format `int64`
- `uuid` (`Products_create.response.201.uuid`; string, required)
  - format `uuid`
- `name` (`Products_create.response.201.name`; string, required)
- `symbol` (`Products_create.response.201.symbol`; any of, required) — Klasyfikacja drukowana na dokumentach. Gdy ustawiono `pkwiu`, `cn` lub `pkob`, ma postać `pkwiu / cn / pkob` z `-` w miejscu każdego brakującego kodu, np. `234 / - / -`.
  - any of: `string`, `null`
- `pkwiu` (`Products_create.response.201.pkwiu`; any of, required) — Kod PKWiU dla KSeF.
  - any of: `string`, `null`
- `cn` (`Products_create.response.201.cn`; any of, required) — Kod CN dla KSeF.
  - any of: `string`, `null`
- `pkob` (`Products_create.response.201.pkob`; any of, required) — Kod PKOB dla KSeF.
  - any of: `string`, `null`
- `gtin` (`Products_create.response.201.gtin`; any of, required)
  - any of: `string`, `null`
- `unit` (`Products_create.response.201.unit`; any of, required) — Jednostka miary, np. `szt.`.
  - any of: `string`, `null`
- `tax_symbol` (`Products_create.response.201.tax_symbol`; string, required) — Symbol stawki VAT, np. `23`, `8`, `zw`. Zobacz `GET /vat_rates.json`.
- `flat_rate_tax_symbol` (`Products_create.response.201.flat_rate_tax_symbol`; string, required) — Symbol stawki ryczałtu; `""`, gdy nie ustawiono.
- `quantity` (`Products_create.response.201.quantity`; number, required)
  - format `double`
- `net_price` (`Products_create.response.201.net_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `tax_price` (`Products_create.response.201.tax_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `gross_price` (`Products_create.response.201.gross_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `unit_net_price` (`Products_create.response.201.unit_net_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `purchase_unit_net_price` (`Products_create.response.201.purchase_unit_net_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `purchase_unit_gross_price` (`Products_create.response.201.purchase_unit_gross_price`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `discount` (`Products_create.response.201.discount`; string, required) — Rabat w procentach.
  - pattern `^-?\d+(\.\d+)?$`
- `unit_net_price_before_discount` (`Products_create.response.201.unit_net_price_before_discount`; integer, required) — Kwota w groszach (1/100 PLN). `12300` oznacza 123,00 PLN.
  - format `int64`
- `vat_exemption_reason` (`Products_create.response.201.vat_exemption_reason`; any of, required) — Id podstawy zwolnienia z VAT. Zobacz `GET /vat_exemptions.json`.
  - any of: `integer`, `null`
- `gtu_id` (`Products_create.response.201.gtu_id`; any of, required) — Id kodu GTU. Zobacz `GET /gtus.json`.
  - any of: `integer`, `null`

### 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` (`Products_create.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` (`Products_create.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` (`Products_create.response.401.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.401.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.401.url`; string, optional)
- `action_url` (`Products_create.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` (`Products_create.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` (`Products_create.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` (`Products_create.response.402.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.402.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.402.url`; string, optional)
- `action_url` (`Products_create.response.402.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` (`Products_create.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` (`Products_create.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` (`Products_create.response.406.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.406.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.406.url`; string, optional)
- `action_url` (`Products_create.response.406.action_url`; string, optional)

### 422

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

#### Example

```json
{
  "error": "Wadliwy zasób. Popraw błędy i spróbuj ponownie.",
  "errors": {
    "gross": [
      "Wartość brutto jest nieprawidłowa."
    ]
  }
}
```

- `error` (`Products_create.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` (`Products_create.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` (`Products_create.response.422.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.422.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.422.url`; string, optional)
- `action_url` (`Products_create.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` (`Products_create.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` (`Products_create.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` (`Products_create.response.423.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.423.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.423.url`; string, optional)
- `action_url` (`Products_create.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` (`Products_create.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` (`Products_create.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` (`Products_create.response.429.limit`; string, optional) — Kod limitu planu, np. `limit_exceeded`, `plan_upgrade_needed`, `cant_add_client`.
- `type` (`Products_create.response.429.type`; string, optional)
  - one of `"redirect"`, `"email_not_confirmed"`
- `url` (`Products_create.response.429.url`; string, optional)
- `action_url` (`Products_create.response.429.action_url`; string, optional)


Source: https://docs.niebieskiorzel.pl/api/products-json/create/index.md
