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

# Obtener Factura

> Obtiene los detalles completos de una factura por ID o por CUF.

Obtiene todos los detalles de una factura especifica, incluyendo datos del cliente, items, montos, estado SIAT, CUF y URLs de descarga.

## Por ID (UUID)

### Path Parameters

| Parametro | Tipo   | Req | Descripcion        |
| --------- | ------ | --- | ------------------ |
| `id`      | string | Si  | UUID de la factura |

### Headers

| Parametro   | Tipo   | Req | Descripcion |
| ----------- | ------ | --- | ----------- |
| `X-API-Key` | string | Si  | Tu API Key  |

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X GET https://sandbox.cucu.bo/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch(
    'https://sandbox.cucu.bo/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890',
    { headers: { 'X-API-Key': 'YOUR_API_KEY' } }
  );
  const data = await response.json();
  ```

  ```python Python theme={"system"}
  import requests

  response = requests.get(
      'https://sandbox.cucu.bo/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890',
      headers={'X-API-Key': 'YOUR_API_KEY'}
  )
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"system"}
  {
    "success": true,
    "data": {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "invoiceNumber": 5,
      "cuf": "2872F7294502332E637FABFBC3654EA82202AD48E0969F14EBEB8AF74",
      "state": "VALIDATED",
      "emissionType": "NORMAL",
      "siatCode": 908,
      "siatDescription": "FACTURA VALIDADA",
      "clientDocumentType": 5,
      "clientDocumentNumber": "99001",
      "clientBusinessName": "EMPRESA DEMO S.R.L.",
      "clientEmail": "demo@ejemplo.com",
      "amountSubtotal": 500.00,
      "amountDiscount": 0.00,
      "amountTotal": 500.00,
      "literal": "Quinientos 00/100 Bolivianos",
      "paymentMethodCode": 1,
      "emissionDate": "2026-02-11T12:00:00",
      "details": [
        {
          "lineNumber": 1,
          "activityEconomic": "620100",
          "codeProductSin": "83141",
          "description": "Servicio de desarrollo de software",
          "quantity": 1.0,
          "unitMeasure": 58,
          "priceUnit": 500.00,
          "amountDiscount": 0.00,
          "subtotal": 500.00
        }
      ],
      "pdfUrl": "https://sandbox.cucu.bo/api/v1/public/invoice/2872F...AF74/pdf",
      "xmlUrl": "https://sandbox.cucu.bo/api/v1/public/invoice/2872F...AF74/xml"
    },
    "timestamp": "2026-02-11T12:00:00"
  }
  ```
</ResponseExample>

<Note>
  **`details[].lineNumber`** es el número de línea (`1..N`, en orden estable) de cada ítem.
  Úsalo como `nroItem` al emitir una [Nota de Crédito/Débito](/api/credit-note) de sector `47`/`48`:
  el `returnedDetails[].nroItem` (y el overlay ICE del 48) referencian la línea original por
  este número. Solo el detalle de una factura individual (`GET /invoices/{id}` o `/cuf/{cuf}`)
  incluye `details`; los listados (`GET /invoices`, `/search`) no lo traen.
</Note>

***

## Por CUF

Tambien puedes obtener una factura usando su Codigo Unico de Factura (CUF):

```
GET /api/v1/invoices/cuf/{cuf}
```

<CodeGroup>
  ```bash cURL theme={"system"}
  curl -X GET https://sandbox.cucu.bo/api/v1/invoices/cuf/2872F7294502332E637FABFBC3654EA82202AD48E0969F14EBEB8AF74 \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch(
    'https://sandbox.cucu.bo/api/v1/invoices/cuf/2872F7294502332E637FABFBC3654EA82202AD48E0969F14EBEB8AF74',
    { headers: { 'X-API-Key': 'YOUR_API_KEY' } }
  );
  ```

  ```python Python theme={"system"}
  import requests

  response = requests.get(
      'https://sandbox.cucu.bo/api/v1/invoices/cuf/2872F7294502332E637FABFBC3654EA82202AD48E0969F14EBEB8AF74',
      headers={'X-API-Key': 'YOUR_API_KEY'}
  )
  ```
</CodeGroup>

La respuesta tiene el mismo formato que la consulta por ID.
