---
title: "Przypisz kategorię kosztu do skanów dokumentów"
description: "Zakres: `api:costs:write`. Działa tylko dla skanów dokumentów; zarejestrowane koszty i dowody wewnętrzne są zgłaszane jako `failure`."
---

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

`POST /documents/costs/assign_cost_category_many.json`

Zakres: `api:costs:write`. Działa tylko dla skanów dokumentów; zarejestrowane koszty i dowody wewnętrzne są zgłaszane jako `failure`.

## Authentication

Requires one of the following:

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

## Request body

_Required._

- `cost_category_id` (`CostDocuments_assignCostCategoryMany.cost_category_id`; integer, required) — Id kategorii kosztu: | id | Kategoria | id | Kategoria | |---|---|---|---| | 1 | Artykuły biurowe | 18 | Usługi prawne | | 2 | Delegacja | 19 | Usługi telekomunikacyjne | | 3 | Hotel | 20 | Usługi ubezpieczeniowe | | 4 | Inne | 21 | Wydatki na transport | | 5 | Internet | 22 | Wydatki związane z komputerem | | 6 | Koszty pojazdu | 23 | Wynagrodzenie | | 7 | Literatura specjalistyczna | 24 | Wyposażenie biura | | 8 | Opłaty mieszkaniowe | 25 | Zakup towarów i/lub materiałów | | 9 | Paliwo | 26 | ZUS za pracownika | | 10 | Płatność za PIT | 27 | Badania i rozwój | | 11 | Płatność za VAT | 28 | Wydatki przedsiębiorcy | | 12 | Rata leasingowa | 29 | Ulepszenie środka trwałego | | 13 | Reklama | 30 | Ulepszenie wyposażenia | | 14 | Szkolenia | 31 | Dokument niezaksięgowany | | 15 | Usługi elektroniczne | 32 | Kasa fiskalna | | 16 | Usługi gastronomiczne | 33 | Korekta podatku naliczonego | | 17 | Usługi księgowe | | | 29–31 nie są dostępne w aplikacji inFakt.
  - format `int64`; min 1; max 33
- `uuids` (`CostDocuments_assignCostCategoryMany.uuids`; string, optional) — Identyfikatory uuid oddzielone przecinkami.
- `uuid` (`CostDocuments_assignCostCategoryMany.uuid`; string, optional)
  - format `uuid`

## Example requests

### Kategoria przypisana do skanu

```json
{
  "uuids": "8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e",
  "cost_category_id": 9
}
```

### Pominięto zaksięgowany koszt

```json
{
  "uuids": "8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e,2f6e8a1c-3b4d-4e5f-9a6b-7c8d9e0f1a2b",
  "cost_category_id": 9
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.sandbox-infakt.pl/v3/documents/costs/assign_cost_category_many.json \
  --header 'Content-Type: application/json' \
  --header 'X-inFakt-ApiKey: <X-inFakt-ApiKey>' \
  --data '
{
  "uuids": "8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e",
  "cost_category_id": 9
}
'
```

### TypeScript

```typescript
const url = 'https://api.sandbox-infakt.pl/v3/documents/costs/assign_cost_category_many.json';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-inFakt-ApiKey': '<X-inFakt-ApiKey>'},
  body: JSON.stringify({uuids: '8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e', cost_category_id: 9})
};

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/documents/costs/assign_cost_category_many.json"

payload = {
    "uuids": "8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e",
    "cost_category_id": 9
}
headers = {
    "Content-Type": "application/json",
    "X-inFakt-ApiKey": "<X-inFakt-ApiKey>"
}

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

print(response.text)
```

## Responses

### 200

Sukces

#### Example

```json
{
  "success": true,
  "entities": [
    {
      "uuid": "8b9c0d1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e",
      "number": "FV/9876/10/2026",
      "status": "success"
    }
  ]
}
```

- `success` (`CostDocuments_assignCostCategoryMany.response.200.success`; boolean, required) — `true`, gdy operacja powiodła się dla wszystkich dokumentów.
- `entities` (`CostDocuments_assignCostCategoryMany.response.200.entities`; array<object>, required)
  - `uuid` (`CostDocuments_assignCostCategoryMany.response.200.entities.uuid`; string, required) — Uuid dokumentu; dla nieznalezionego uuid wartość taka, jak wysłano.
  - `number` (`CostDocuments_assignCostCategoryMany.response.200.entities.number`; string, required) — `""` dla nieznalezionego uuid.
  - `status` (`CostDocuments_assignCostCategoryMany.response.200.entities.status`; string, required)
    - one of `"success"`, `"failure"`

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

### 422

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

#### Example

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

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


Source: https://docs.niebieskiorzel.pl/api/cost-documents-assign-cost-category-many/index.md
