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

# Retrieve Expense

> Get detailed information about a specific expense by its CzUid

## Overview

The Retrieve Expense endpoint allows you to get complete details about a specific expense record. You can optionally expand related data such as supplier information, category details, and user information.

## Path Parameters

<ParamField path="id" type="string" required>
  The CzUid of the expense to retrieve
</ParamField>

## Query Parameters

<ParamField query="expand" type="string">
  Comma-separated list of related data to include in the response:

  * `supplier` - Include full supplier details instead of just the ID
  * `category` - Include full category details instead of just the ID
  * `user` - Include user information for who created the expense
</ParamField>

## Response

<ResponseField name="expense" type="object">
  Complete expense object with all details

  <Expandable title="Expense Object Properties">
    <ResponseField name="id" type="string">
      Unique CzUid identifier for the expense
    </ResponseField>

    <ResponseField name="reference" type="string">
      Reference number or invoice number
    </ResponseField>

    <ResponseField name="description" type="string">
      Detailed description of the expense
    </ResponseField>

    <ResponseField name="amount" type="object">
      Original expense amounts in the expense currency

      <Expandable title="Amount Object">
        <ResponseField name="total" type="string">Total amount</ResponseField>
        <ResponseField name="without_vat" type="string">Amount without VAT</ResponseField>
        <ResponseField name="vat" type="string">VAT amount</ResponseField>
        <ResponseField name="currency" type="string">Currency code</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="account_amount" type="object">
      Accounting amounts in the firm's base currency

      <Expandable title="Account Amount Object">
        <ResponseField name="total" type="string">Total amount in base currency</ResponseField>
        <ResponseField name="without_vat" type="string">Amount without VAT in base currency</ResponseField>
        <ResponseField name="vat" type="string">VAT amount in base currency</ResponseField>
        <ResponseField name="currency" type="string">Base currency code</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="vat_percent" type="integer">
      VAT percentage applied to the expense
    </ResponseField>

    <ResponseField name="with_vat" type="boolean">
      Whether the original amount includes VAT
    </ResponseField>

    <ResponseField name="date" type="string" format="date">
      Expense date (YYYY-MM-DD)
    </ResponseField>

    <ResponseField name="due_date" type="string" format="date">
      Payment due date (YYYY-MM-DD)
    </ResponseField>

    <ResponseField name="paid_date" type="string" format="date">
      Payment date (null if not paid)
    </ResponseField>

    <ResponseField name="is_paid" type="boolean">
      Whether the expense has been paid
    </ResponseField>

    <ResponseField name="payment_type" type="object">
      Payment type information (null if not paid)

      <Expandable title="Payment Type Object">
        <ResponseField name="id" type="integer">Payment type ID</ResponseField>
        <ResponseField name="name" type="string">Payment type name</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="status" type="string">
      Current expense status: `paid`, `unpaid`, `overdue`, or `registered`
    </ResponseField>

    <ResponseField name="supplier_id" type="string">
      Supplier CzUid (when not expanded)
    </ResponseField>

    <ResponseField name="supplier" type="object">
      Full supplier details (when expanded)

      <Expandable title="Supplier Object">
        <ResponseField name="id" type="string">Supplier CzUid</ResponseField>
        <ResponseField name="name" type="string">Supplier name</ResponseField>
        <ResponseField name="cui" type="string">Tax identification number</ResponseField>
        <ResponseField name="rc" type="string">Trade register number</ResponseField>
        <ResponseField name="address" type="string">Address</ResponseField>
        <ResponseField name="city" type="string">City</ResponseField>
        <ResponseField name="county" type="string">County</ResponseField>
        <ResponseField name="country" type="string">Country</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="category_id" type="integer">
      Category ID (when not expanded)
    </ResponseField>

    <ResponseField name="category" type="object">
      Full category details (when expanded)

      <Expandable title="Category Object">
        <ResponseField name="id" type="integer">Category ID</ResponseField>
        <ResponseField name="name" type="string">Category name</ResponseField>
        <ResponseField name="parent_id" type="integer">Parent category ID (null for root categories)</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="user_id" type="integer">
      User ID (when not expanded)
    </ResponseField>

    <ResponseField name="user" type="object">
      User information (when expanded)

      <Expandable title="User Object">
        <ResponseField name="id" type="integer">User ID</ResponseField>
        <ResponseField name="name" type="string">User name</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="currency_exchange" type="object">
      Currency exchange information (only if applicable)

      <Expandable title="Currency Exchange Object">
        <ResponseField name="from" type="string">Original currency</ResponseField>
        <ResponseField name="to" type="string">Target currency</ResponseField>
        <ResponseField name="rate" type="number">Exchange rate used</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="attachment" type="object">
      Attachment information (only if expense has an attachment)

      <Expandable title="Attachment Object">
        <ResponseField name="url" type="string">Download URL for the attachment</ResponseField>
        <ResponseField name="type" type="string">File type (pdf or image)</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="items" type="array">
      Line rows for the expense. Always at least one entry — legacy flat
      expenses get a single synthesized line built from the header totals
      so API consumers can render a uniform table.

      See [Expense Lines & VAT Breakdown](/concepts/expense-lines) for the
      full model.

      <Expandable title="Line Object">
        <ResponseField name="id" type="integer">Line row ID (0 for synthesized legacy lines)</ResponseField>
        <ResponseField name="line_index" type="integer">Zero-based position</ResponseField>
        <ResponseField name="name" type="string">Display name</ResponseField>
        <ResponseField name="description" type="string" nullable>Optional detail</ResponseField>
        <ResponseField name="quantity" type="number">Line quantity</ResponseField>
        <ResponseField name="unit_code" type="string" nullable>UN/ECE unit (e.g. `H87`)</ResponseField>
        <ResponseField name="unit_price" type="number">Net unit price</ResponseField>
        <ResponseField name="vat_rate" type="integer">VAT percent for this line</ResponseField>
        <ResponseField name="amount_wvat" type="number">Line net (2dp, `quantity × unit_price` rounded)</ResponseField>
        <ResponseField name="amount_vat" type="number">Line VAT (2dp)</ResponseField>
        <ResponseField name="amount" type="number">Line gross (2dp)</ResponseField>
        <ResponseField name="category_id" type="string" nullable>Per-line category override</ResponseField>
        <ResponseField name="product_id" type="string" nullable>Linked product CzUid</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="vat_breakdown" type="array" nullable>
      Per-rate VAT tranches when the receipt mixes two or more rates.
      `null` for single-rate expenses.

      <Expandable title="Breakdown Entry">
        <ResponseField name="rate" type="integer">VAT percent</ResponseField>
        <ResponseField name="net" type="number">Sum of nets at this rate</ResponseField>
        <ResponseField name="vat_amount" type="number">Sum of VAT at this rate</ResponseField>
        <ResponseField name="gross" type="number">Sum of gross at this rate</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="category_source" type="string" nullable>
      How the category was assigned: `ai` (auto-classified), `supplier`
      (inherited from the supplier's default), or `manual`. `null` on
      expenses without a category or legacy rows where provenance wasn't
      recorded.
    </ResponseField>

    <ResponseField name="category_confidence" type="number" nullable>
      Auto-classifier confidence in the 0–1 range when
      `category_source === 'ai'`. `null` otherwise.
    </ResponseField>

    <ResponseField name="efactura" type="object">
      Populated when the expense was imported from the ANAF e-Factura SPV
      inbox. `null` for manually created expenses.

      <Expandable title="Efactura Object">
        <ResponseField name="supplier_invoice_id" type="string">CzUid of the linked supplier invoice</ResponseField>
        <ResponseField name="invoice_number" type="string">Supplier's invoice number</ResponseField>
        <ResponseField name="anaf_message_id" type="string">ANAF e-Factura message identifier</ResponseField>
        <ResponseField name="xml_available" type="boolean">Whether the e-Factura XML is stored on disk</ResponseField>
        <ResponseField name="pdf_available" type="boolean">Whether the PDF has already been generated</ResponseField>
        <ResponseField name="pdf_url" type="string">Bearer-authenticated URL that streams the e-Factura PDF (see [Download e-Factura PDF](/api-reference/endpoints/expenses/efactura-pdf))</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="created_at" type="string" format="datetime">
      When the expense was created
    </ResponseField>

    <ResponseField name="updated_at" type="string" format="datetime">
      When the expense was last modified
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Responses

<ResponseField name="404 Not Found">
  The expense with the specified ID does not exist or you don't have access to it
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.contazen.ro/v1/expenses/exp_abc123?expand=supplier,category,user" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json"
  ```

  ```javascript JavaScript theme={null}
  const expenseId = 'exp_abc123';
  const expand = ['supplier', 'category', 'user'].join(',');

  const response = await fetch(`https://api.contazen.ro/v1/expenses/${expenseId}?expand=${expand}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    }
  });

  const data = await response.json();
  console.log('Expense details:', data.expense);
  ```

  ```php PHP theme={null}
  $expenseId = 'exp_abc123';
  $expand = 'supplier,category,user';

  $curl = curl_init();

  curl_setopt_array($curl, [
      CURLOPT_URL => "https://api.contazen.ro/v1/expenses/{$expenseId}?expand={$expand}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer YOUR_API_KEY',
          'Content-Type: application/json'
      ]
  ]);

  $response = curl_exec($curl);
  $data = json_decode($response, true);
  curl_close($curl);

  print_r($data['expense']);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "expense": {
      "id": "exp_abc123",
      "reference": "INV-2024-001",
      "description": "Office supplies purchase including paper, pens, and folders",
      "amount": {
        "total": "238.00",
        "without_vat": "200.00",
        "vat": "38.00",
        "currency": "RON"
      },
      "account_amount": {
        "total": "238.00",
        "without_vat": "200.00",
        "vat": "38.00",
        "currency": "RON"
      },
      "vat_percent": 19,
      "with_vat": true,
      "date": "2024-01-15",
      "due_date": "2024-02-15",
      "paid_date": null,
      "is_paid": false,
      "payment_type": null,
      "status": "unpaid",
      "supplier": {
        "id": "sup_xyz789",
        "name": "Office Depot SRL",
        "cui": "RO12345678",
        "rc": "J40/1234/2020",
        "address": "Str. Exemplu 123, Sector 1",
        "city": "Bucharest",
        "county": "Bucharest",
        "country": "Romania"
      },
      "category": {
        "id": 1,
        "name": "Office Expenses",
        "parent_id": null
      },
      "user": {
        "id": 1,
        "name": "John Doe"
      },
      "attachment": {
        "url": "https://api.contazen.ro/v1/files/download/att_def456",
        "type": "pdf"
      },
      "items": [
        {
          "id": 4201,
          "line_index": 0,
          "name": "Office supplies",
          "description": null,
          "quantity": 1,
          "unit_code": null,
          "unit_price": 200.00,
          "vat_rate": 19,
          "amount_wvat": 200.00,
          "amount_vat": 38.00,
          "amount": 238.00,
          "category_id": null,
          "product_id": null
        }
      ],
      "vat_breakdown": null,
      "category_source": "manual",
      "category_confidence": null,
      "efactura": {
        "supplier_invoice_id": "si_abc123",
        "invoice_number": "119079",
        "anaf_message_id": "4891234567",
        "xml_available": true,
        "pdf_available": true,
        "pdf_url": "https://app.contazen.ro/api/v1/expenses/exp_abc123/efactura-pdf"
      },
      "created_at": "2024-01-15 10:30:00",
      "updated_at": "2024-01-15 10:30:00"
    }
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "error": {
      "message": "Expense not found",
      "type": "invalid_request_error",
      "code": "resource_missing",
      "param": "id"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /expenses/{id}
openapi: 3.1.0
info:
  title: Contazen API
  version: 1.2.0
  description: >
    Build powerful integrations with the Contazen invoicing platform. The
    Contazen API is organized around REST, 

    has predictable resource-oriented URLs, accepts JSON request bodies, returns
    JSON-encoded responses, 

    and uses standard HTTP response codes, authentication, and verbs.


    ## Authentication

    The API uses Bearer token authentication. Include your API key in the
    Authorization header.


    ### Getting your API Key

    1. Log in to your Contazen account

    2. Navigate to Settings > API

    3. Generate or copy your API key (starts with `sk_live_` for production or
    `sk_test_` for testing)


    ### Using the API Key

    Include your API key in the Authorization header:

    ```

    Authorization: Bearer sk_live_YOUR_API_KEY

    ```


    ### Example Request with cURL

    ```bash

    curl --request GET \
      --url https://api.contazen.ro/v1/clients \
      --header 'Authorization: Bearer sk_live_YOUR_API_KEY' \
      --header 'Accept: application/json'
    ```


    ## Rate Limiting

    - 1000 requests per hour per API key

    - 100 create operations per minute per API key


    Rate limit information is included in response headers:

    - `X-RateLimit-Limit`: Maximum requests allowed

    - `X-RateLimit-Remaining`: Requests remaining

    - `X-RateLimit-Reset`: Reset time (Unix timestamp)


    ## Pagination

    All list endpoints return paginated results with the following format:

    ```json

    {
      "success": true,
      "data": {
        "object": "list",
        "data": [...],
        "has_more": true,
        "total": 245,
        "page": 1,
        "per_page": 50,
        "total_pages": 5
      },
      "meta": {
        "version": "v1",
        "request_id": "req_1a2b3c4d",
        "response_time": "23.45ms"
      }
    }

    ```


    ## Multi-Work-Point Access

    API keys belong to a specific work point but can access data from all work
    points

    within the same parent company.


    ## Error Handling

    The API uses conventional HTTP response codes to indicate success or
    failure. 

    In general: 2xx codes indicate success, 4xx codes indicate an error due to
    the 

    information provided, and 5xx codes indicate an error with Contazen's
    servers.


    ## Expanding Nested Objects

    Many endpoints support the `expand` parameter to include related objects in
    the response.

    This follows the Stripe API pattern. For example:

    - `expand[]=lines` - Include invoice line items

    - `expand[]=payments` - Include payment records

    - `expand[]=client` - Include full client object


    ## Localization

    The API supports multiple languages through:

    - `locale` query parameter (en, ro)

    - `Accept-Language` header

    - Default: English
  contact:
    name: Contazen Support
    email: support@contazen.ro
    url: https://contazen.ro
  license:
    name: Proprietary
    url: https://www.contazen.ro/termeni-si-conditii-de-utilizare/
servers:
  - url: https://api.contazen.ro/v1
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: API authentication and test endpoints
  - name: Clients
    description: Manage your customers (B2B and B2C)
  - name: Invoices
    description: Create and manage invoices, proformas, and receipts
  - name: Products
    description: Manage your product and service catalog
  - name: Expenses
    description: Track and manage business expenses
  - name: Expense Categories
    description: Organize expenses with categories
  - name: Suppliers
    description: Manage expense suppliers and vendors
  - name: Settings
    description: API settings and configuration
  - name: Payments
    description: Payments received against invoices
  - name: Receipts
    description: Cash receipts (chitanțe) — standalone or paired with an invoice
  - name: Company Lookup
    description: Romanian company lookup (ANAF / VIES)
  - name: Invoice Series
    description: Manage invoice numbering series
  - name: Bank Accounts
    description: Manage IBAN bank accounts
  - name: E-Factura
    description: Romanian e-invoicing status and configuration
  - name: Supplier Bills
    description: Supplier invoices imported from the ANAF SPV inbox
  - name: VAT Rates
    description: Firm-scoped custom VAT rates on top of the Romanian catalog
  - name: Currencies
    description: Currencies enabled for the firm's bill templates
  - name: Languages
    description: Languages enabled for the firm's bill templates
  - name: Conta
    description: |
      Public ANAF data for the firm's CUI: fiscal profile (TVA scope, RTVAI,
      split TVA, status, e-Factura registration, CAEN) and annual balance
      sheets (cifra de afaceri, profit, capitaluri, datorii, salariați).

      Powered by the public ANAF webservices (no OAuth required for these
      endpoints). The data is cached locally and refreshed on demand via
      the `/sync` actions.
paths:
  /expenses/{id}:
    get:
      tags:
        - Expenses
      summary: Retrieve an expense
      description: Get a specific expense by ID
      operationId: getExpense
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Expense CzUid
        - name: expand
          in: query
          schema:
            type: string
          description: >-
            Comma-separated list of relations to expand. Supported: `supplier`,
            `category`, `user`.
      responses:
        '200':
          description: Expense details
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Expense'
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
components:
  schemas:
    Expense:
      type: object
      required:
        - id
        - reference
        - amount
        - date
        - due_date
        - status
      properties:
        id:
          type: string
          description: Unique identifier (CzUid)
          example: exp_1a2b3c4d5e
        reference:
          type: string
          description: Invoice/document reference number
        description:
          type: string
        amount:
          type: object
          properties:
            total:
              type: number
              example: 500
            without_vat:
              type: number
            vat:
              type: number
            currency:
              type: string
        account_amount:
          type: object
          description: Amounts in account currency (RON)
          properties:
            total:
              type: number
            without_vat:
              type: number
            vat:
              type: number
            currency:
              type: string
              default: RON
        vat_percent:
          type: integer
          enum:
            - 0
            - 5
            - 9
            - 11
            - 19
            - 21
        with_vat:
          type: boolean
          description: Whether amount includes VAT
        date:
          type: string
          format: date
        due_date:
          type: string
          format: date
        paid_date:
          type: string
          format: date
          nullable: true
        is_paid:
          type: boolean
        payment_type:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        status:
          type: string
          enum:
            - paid
            - unpaid
            - overdue
            - registered
        supplier_id:
          type: string
        supplier:
          $ref: '#/components/schemas/Supplier'
        category_id:
          type: integer
        category:
          $ref: '#/components/schemas/ExpenseCategory'
        user_id:
          type: integer
        user:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
        currency_exchange:
          type: object
          nullable: true
          properties:
            from:
              type: string
            to:
              type: string
            rate:
              type: number
        attachment:
          type: object
          nullable: true
          description: Single attachment (stored in the 'image' field)
          properties:
            url:
              type: string
            filename:
              type: string
            type:
              type: string
              enum:
                - pdf
                - image
            size:
              type: integer
        efactura:
          type: object
          nullable: true
          description: |
            Populated when the expense was imported from the ANAF e-Factura SPV
            inbox. `null` for manually created expenses.
          properties:
            supplier_invoice_id:
              type: string
            invoice_number:
              type: string
              nullable: true
            anaf_message_id:
              type: string
              nullable: true
            xml_available:
              type: boolean
            pdf_available:
              type: boolean
            pdf_url:
              type: string
              nullable: true
              description: >-
                Bearer-authenticated URL that streams the e-Factura PDF;
                regenerated on demand when missing
        items:
          type: array
          description: |
            Line rows for the expense. Always at least one entry — legacy flat
            expenses get a single synthesized line built from the header totals
            so API consumers can render a uniform table. Send `items` on
            create/update to persist real multi-line rows.
          items:
            $ref: '#/components/schemas/ExpenseLine'
        vat_breakdown:
          type: array
          nullable: true
          description: |
            Per-rate VAT tranches when the receipt mixes two or more rates.
            `null` for single-rate expenses.
          items:
            $ref: '#/components/schemas/ExpenseVatBreakdownEntry'
        category_source:
          type: string
          nullable: true
          enum:
            - ai
            - supplier
            - manual
          description: |
            How the category was assigned. `null` on uncategorized expenses
            or legacy rows where provenance wasn't recorded.
        category_confidence:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: Auto-classifier confidence when category_source is 'ai'.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ResponseMeta:
      type: object
      properties:
        version:
          type: string
          default: v1
        request_id:
          type: string
          format: uuid
          description: Unique request identifier for debugging
        response_time:
          type: string
          example: 23.45ms
    Supplier:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Unique identifier (CzUid)
          example: sup_1a2b3c4d5e
        name:
          type: string
        cui:
          type: string
          description: Tax identification number
        rc:
          type: string
          description: Company registration number
        cnp:
          type: string
          description: Personal identification number
        address:
          type: string
        city:
          type: string
        county:
          type: string
        country:
          type: string
        postal_code:
          type: string
        phone:
          type: string
        email:
          type: string
        iban:
          type: string
        bank:
          type: string
        contact_person:
          type: string
        contact_phone:
          type: string
        contact_email:
          type: string
        is_vat_payer:
          type: boolean
        statistics:
          type: object
          properties:
            expense_count:
              type: integer
            total_amount:
              type: number
            paid_amount:
              type: number
            unpaid_amount:
              type: number
        recent_expenses:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              reference:
                type: string
              amount:
                type: number
              currency:
                type: string
              date:
                type: string
                format: date
              is_paid:
                type: boolean
        metadata:
          type: object
          description: |
            Lightweight expense aggregates. Returned by `GET /suppliers` only
            when `with_totals=1` is supplied. Cheaper than `expand=statistics`
            since the totals come from a single inline subquery rather than
            a per-row N+1 follow-up. Amounts are expressed in the firm's
            accounting currency.
          properties:
            expense_count:
              type: integer
              description: Number of non-deleted expenses for this supplier
            total_expenses:
              type: number
              description: Sum of `account_amount_total` across all matching expenses
            unpaid_total:
              type: number
              description: Sum of `account_amount_total` across unpaid matching expenses
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ExpenseCategory:
      type: object
      required:
        - id
        - name
        - type
      properties:
        id:
          type: integer
        name:
          type: string
        parent_id:
          type: integer
          nullable: true
        is_default:
          type: boolean
          description: Whether this is a system default category
        is_visible:
          type: boolean
        type:
          type: string
          enum:
            - system
            - custom
        expense_count:
          type: integer
          description: Number of expenses in this category
        children:
          type: array
          items:
            $ref: '#/components/schemas/ExpenseCategory'
    ExpenseLine:
      type: object
      required:
        - id
        - line_index
        - name
        - quantity
        - unit_price
        - vat_rate
        - amount_wvat
        - amount_vat
        - amount
      properties:
        id:
          type: integer
          description: Line row ID. `0` for synthesized legacy lines.
        line_index:
          type: integer
          description: Zero-based position within the expense.
        name:
          type: string
        description:
          type: string
          nullable: true
        quantity:
          type: number
          description: Supports fractional quantities (e.g. 0.5 kg).
        unit_code:
          type: string
          nullable: true
          description: Optional UN/ECE unit code (e.g. H87, KGM).
        unit_price:
          type: number
          description: >-
            Net unit price (excluding VAT). Negative values represent discount
            rows (e.g. bon fiscal `DISCOUNT 4,40-A`); the sign is preserved
            through net/VAT/gross.
        vat_rate:
          type: integer
          enum:
            - 0
            - 5
            - 9
            - 11
            - 19
            - 21
        amount_wvat:
          type: number
          description: Line net, 2dp, `round(quantity * unit_price, 2)`.
        amount_vat:
          type: number
          description: Line VAT, 2dp, `round(amount_wvat * vat_rate / 100, 2)`.
        amount:
          type: number
          description: Line gross, 2dp, `amount_wvat + amount_vat`.
        category_id:
          type: string
          nullable: true
          description: >-
            Optional per-line category override (falls back to expense-level
            category).
        product_id:
          type: string
          nullable: true
          description: Optional link to a product in the firm's catalog.
    ExpenseVatBreakdownEntry:
      type: object
      required:
        - rate
        - vat_amount
      properties:
        rate:
          type: integer
          enum:
            - 0
            - 5
            - 9
            - 11
            - 19
            - 21
        net:
          type: number
          nullable: true
          description: Sum of line nets at this rate (2dp).
        vat_amount:
          type: number
          description: Sum of line VATs at this rate (2dp).
        gross:
          type: number
          nullable: true
          description: Sum of line gross values at this rate (2dp).
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          default: false
        error:
          type: object
          required:
            - message
            - type
            - code
          properties:
            message:
              type: string
              description: Human-readable error message
            type:
              type: string
              enum:
                - api_error
                - authentication_error
                - invalid_request_error
                - rate_limit_error
                - permission_error
                - validation_error
            code:
              type: string
              description: Machine-readable error code
            param:
              type: string
              description: The parameter that caused the error
            doc_url:
              type: string
              format: uri
              description: URL to relevant documentation
        meta:
          $ref: '#/components/schemas/ResponseMeta'
  responses:
    UnauthorizedError:
      description: API key is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundError:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use your API key (sk_live_xxx or sk_test_xxx)

````