# Line items

Lines of booking invoices

Endpoint: `https://api.bookingmood.com/v1/line_items`, supporting `GET`, `POST`, `DELETE`, `PATCH`. Authenticate with the header `Authorization: Bearer YOUR_API_KEY` (see [authentication](https://www.bookingmood.com/uk-UA/api-reference/authentication.md)).

## The line item object

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `uuid` | Unique identifier. |
| `booking_id` | `uuid` | Identifier of the related booking. References [`bookings.id`](https://www.bookingmood.com/uk-UA/api-reference/bookings.md). |
| `event_id` | `uuid \| null` | Identifier of the related calendar event. References [`calendar_events.id`](https://www.bookingmood.com/uk-UA/api-reference/calendar_events.md). |
| `invoice_id` | `uuid \| null` | Identifier of the related invoice. References [`invoices.id`](https://www.bookingmood.com/uk-UA/api-reference/invoices.md). |
| `service_id` | `uuid \| null` | Identifier of the related service. References [`services.id`](https://www.bookingmood.com/uk-UA/api-reference/services.md). |
| `created_at` | `timestamp with time zone` | Creation timestamp. Read-only: set by the database. |
| `updated_at` | `timestamp with time zone` | Last modification timestamp. Read-only: set by the database. |
| `amount` | `integer` | Amount of the line item, in cents. |
| `fee_type` | `LineItemFeeType` | Type of the fee: `fee` or `deposit`. |
| `item_type` | `LineItemType` | Type of the line item, most commonly `fee`. |
| `manual` | `boolean` | Whether the line item was added manually. |
| `name` | `MultiLanguageString` | Localized name of the line item. |
| `quantity` | `integer` | Quantity of the line item. |

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "booking_id": "00000000-0000-0000-0000-000000000000",
  "event_id": "00000000-0000-0000-0000-000000000000",
  "invoice_id": "00000000-0000-0000-0000-000000000000",
  "service_id": "00000000-0000-0000-0000-000000000000",
  "created_at": "2026-10-30T23:18:45.588Z",
  "updated_at": "2026-10-30T23:18:45.588Z",
  "amount": 0,
  "fee_type": "fee",
  "item_type": "rent",
  "manual": false,
  "name": {},
  "quantity": 0
}
```

### Types

```typescript
type Language = 
  | "be-BY"
  | "bg-BG"
  | "cs-CZ"
  | "da-DK"
  | "de-DE"
  | "en-GB"
  | "en-NZ"
  | "en-US"
  | "es-ES"
  | "eu-ES"
  | "fr-FR"
  | "gr-EL"
  | "he-IL"
  | "hr-HR"
  | "hu-HU"
  | "it-IT"
  | "ja-JP"
  | "lt-LT"
  | "lv-LV"
  | "nl-NL"
  | "nn-NO"
  | "pl-PL"
  | "pt-BR"
  | "ro-RO"
  | "ru-RU"
  | "sk-SK"
  | "sl-SI"
  | "sr-Cyrl"
  | "sr-Latn"
  | "sv-SE"
  | "tr-TR"
  | "uk-UA";

type LineItemFeeType = "deposit" | "fee";

type LineItemType = "coupon" | "fee" | "price-difference" | "rent";

type MultiLanguageString = {
  default: string;
} & Partial<Record<Language, string>>;
```

### Related resources

Embed related resources with the [`select` parameter](https://www.bookingmood.com/uk-UA/api-reference/selecting.md), e.g. `select=*,bookings(*)`. Resources related through more than one column need the column as a hint, like `table!column(*)`.

| Embed | Type | Description |
| --- | --- | --- |
| `bookings(*)` | `object \| null` | The [booking](https://www.bookingmood.com/uk-UA/api-reference/bookings.md) referenced by `booking_id`. |
| `calendar_events(*)` | `object \| null` | The [calendar event](https://www.bookingmood.com/uk-UA/api-reference/calendar_events.md) referenced by `event_id`. |
| `invoices(*)` | `object \| null` | The [invoice](https://www.bookingmood.com/uk-UA/api-reference/invoices.md) referenced by `invoice_id`. |
| `services(*)` | `object \| null` | The [service](https://www.bookingmood.com/uk-UA/api-reference/services.md) referenced by `service_id`. |
| `line_item_taxes(*)` | `array` | The [line item taxes](https://www.bookingmood.com/uk-UA/api-reference/line_item_taxes.md) referencing this line item through `line_item_taxes.line_item_id`. |

## List line items

`GET /v1/line_items`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/uk-UA/api-reference/filtering.md)). Choose columns and embed related resources with `select` (see [selecting](https://www.bookingmood.com/uk-UA/api-reference/selecting.md)), and sort and paginate with `order`, `limit` and `offset` (see [sorting and pagination](https://www.bookingmood.com/uk-UA/api-reference/sorting-pagination.md)).

```bash
curl -X GET "https://api.bookingmood.com/v1/line_items?select=*&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: A list of line items with the selected columns. `206` when the list is a partial range.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.

## Create line items

`POST /v1/line_items`

Insert one line item or an array of line items. The body is a `Partial` line item object, so columns with a default can be left out. Read-only attributes can't be written.

```bash
curl -X POST "https://api.bookingmood.com/v1/line_items" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "booking_id": "00000000-0000-0000-0000-000000000000",
    "amount": 0,
    "fee_type": "fee",
    "item_type": "rent",
    "manual": false,
    "name": {},
    "quantity": 0
  }'
```

Responses:

- `201`: The newly created line items with the selected columns.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

## Delete line items

`DELETE /v1/line_items`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/uk-UA/api-reference/filtering.md)). Without filters, this request deletes all line items you have access to. Always filter on at least one column, e.g. `id=eq.{id}`.

```bash
curl -X DELETE "https://api.bookingmood.com/v1/line_items?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: The deleted line items with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.

## Update line items

`PATCH /v1/line_items`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/uk-UA/api-reference/filtering.md)). Without filters, this request updates all line items you have access to. Always filter on at least one column, e.g. `id=eq.{id}`. The body holds the attributes to change.

```bash
curl -X PATCH "https://api.bookingmood.com/v1/line_items?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 0
  }'
```

Responses:

- `200`: The updated line items with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

Errors have a JSON body with a `code`, `message`, `details` and `hint`. See the [introduction](https://www.bookingmood.com/uk-UA/api-reference.md) for more on errors. The full API is described by the OpenAPI spec at https://api.bookingmood.com/v1/openapi.json.
