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

# GET /v1/ecommerce/sales/:id/documents

> List the electronic tax documents (DTE) issued for a sale, with their folio, status, and PDF link.

Returns the DTE issued for one sale. Use it to show the folio to the customer, check the document's status, or fetch its PDF.

## Endpoint

```
GET https://api.keebai.com/v1/ecommerce/sales/{id}/documents
```

## Required scope

`ecommerce:invoicing:read`

## Headers

| Header | Required | Value |
| - | - | - |
| `Authorization` | Yes | `Bearer kbai_pk_<token>` |

## Path parameters

| Field | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | `ObjectId` of the sale. |

## Example request

```bash curl theme={"system"}
curl https://api.keebai.com/v1/ecommerce/sales/65e4f5a6b7c8d9e0f1a2b3c4/documents \
  -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

```js JavaScript theme={"system"}
const response = await fetch(
  `https://api.keebai.com/v1/ecommerce/sales/${saleId}/documents`,
  { headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` } },
);
const { items } = await response.json();
```

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

resp = requests.get(
    f"https://api.keebai.com/v1/ecommerce/sales/{sale_id}/documents",
    headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
    timeout=10,
)
resp.raise_for_status()
documents = resp.json()["items"]
```

## Response

### 200 OK

```json theme={"system"}
{
  "items": [
    {
      "id": "6653e4f5a6b7c8d9e0f1a2b3",
      "document": "receipt",
      "type": 39,
      "folio": 15422,
      "status": "uploaded",
      "issue_date": "2026-11-04",
      "total": 59990,
      "pdf_url": "https://api.keebai.com/v1/ecommerce/invoicing/documents/6653e4f5a6b7c8d9e0f1a2b3/pdf"
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `id` | `string` | Document id. |
| `document` | `string` | `receipt`, `exempt_receipt`, `invoice`, `exempt_invoice`, or `credit_note`. |
| `type` | `number` | SII code of the document: `39`, `41`, `33`, `34`, or `61`. |
| `folio` | `number` | Folio of the document. |
| `status` | `string` | Status of the document at the tax authority. |
| `issue_date` | `string` | Issue date. |
| `total` | `number` | Total of the document. |
| `pdf_url` | `string` | Link to the PDF. |

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `ecommerce:invoicing:read` scope.

### 404 Not Found

No sale with that id, or it belongs to a different company.

### 502 Bad Gateway

`ECOMMERCE_UPSTREAM_ERROR` — the ecommerce service could not answer.

## Operational notes

* **An empty `items` means nothing was issued yet.** Issue it with [`POST /v1/ecommerce/sales/{id}/dte`](https://docs.keebai.com/dev/endpoints/ecommerce-sale-dte-issue).
* **The PDF is also available through the API.** [`GET /v1/ecommerce/invoicing/documents/{id}/pdf`](https://docs.keebai.com/dev/endpoints/ecommerce-invoicing-document-pdf) takes the document `id` from this list.


## OpenAPI

````yaml GET /v1/ecommerce/sales/{id}/documents
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/ecommerce/sales/{id}/documents:
    get:
      tags:
        - ecommerce
      summary: Documentos tributarios de una venta
      description: >-
        Los DTE emitidos para la venta, con su estado en el SII y la URL del
        PDF.
      operationId: PublicEcommerceOperationsController_saleDocuments
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicSaleDocumentListResponseDto'
      security:
        - PAT: []
components:
  schemas:
    PublicSaleDocumentListResponseDto:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PublicSaleDocumentDto'
      required:
        - items
    PublicSaleDocumentDto:
      type: object
      properties:
        id:
          type: string
        document:
          type: string
          enum:
            - invoice
            - exempt_invoice
            - receipt
            - exempt_receipt
            - credit_note
            - debit_note
            - purchase_invoice
            - invoice_settlement
            - dispatch_guide
        type:
          type: number
          description: Código SII del documento
        folio:
          type: number
        status:
          type: string
        issue_date:
          type: string
        total:
          type: number
          nullable: true
        pdf_url:
          type: string
          description: URL pública del PDF (requiere el mismo PAT)
      required:
        - id
        - document
        - type
        - folio
        - status
        - issue_date
        - total
        - pdf_url
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.