> For the complete documentation index, see [llms.txt](https://docs.apisunat.pe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apisunat.pe/integracion/facturacion-electronica/factura/factura-de-exportacion.md).

# Factura de exportación

### Endpoint

<mark style="color:green;">`POST`</mark> `https://sandbox.apisunat.pe/api/v3/documents`

### Header

Es obligatorio incluir el encabezado `Authorization` en cada solicitud.\
El **token es único por empresa** y puedes obtenerlo ingresando a [https://app.apisunat.pe](https://app.apisunat.pe?utm_source=chatgpt.com), en el módulo de **Organizaciones**.

```powershell
header 'Authorization: Bearer {TOKEN}'
```

### Request Body

<pre class="language-json" data-full-width="false"><code class="lang-json">{
    "documento": "factura",
    "serie": "F001",
    "numero": 123,
    "fecha_de_emision": "2025-01-03",
    "hora_de_emision": "19:40:00", //Opcional
    "moneda": "USD",
    "tipo_operacion": "0200",
    "cliente_tipo_de_documento": "0",
    "cliente_numero_de_documento": "123456",
    "cliente_denominacion": "NOMBRE PERSONA",
    "cliente_direccion": "DIRECCIÓN",
    "items": [
        {
            "unidad_de_medida": "ZZ",
            "descripcion": "Nombre del servicio",
            "cantidad": "1",
            "valor_unitario": "200",
<strong>            "porcentaje_igv": "0",
</strong><strong>            "codigo_tipo_afectacion_igv": "40",
</strong><strong>            "nombre_tributo": "EXP"
</strong>        }
    ],
    "total": "200"
}
</code></pre>

### Response

{% tabs %}
{% tab title="200 ACEPTADO" %}
{% code fullWidth="false" %}

```json
{
    "success": true,
    "message": "Factura F001-123 emitida correctamente",
    "payload": {
        "estado": "ACEPTADO",
        "hash": "4HY34uR7a+Vc1Ax3/zrUk1Ng+tjTLwlqa9mRFysy15E=",
        "xml": "https://apisunat.pe/20123456789-03-F001-123.xml",
        "cdr": "https://apisunat.pe/R-20123456789-03-F001-123.xml",
        "pdf": {
            "ticket": "https://apisunat.pe/pdf/ticket/20123456789-03-F001-123"
        }
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="200 PENDIENTE" %}

```json
{
    "success": true,
    "message": "Boleta F001-123 emitida correctamente",
    "payload": {
        "estado": "PENDIENTE",
        "hash": "4HY34uR7a+Vc1Ax3/zrUk1Ng+tjTLwlqa9mRFysy15E=",
        "xml": "https://apisunat.pe/20123456789-03-F001-123.xml",
        "cdr": null,
        "pdf": {
            "ticket": "https://apisunat.pe/pdf/ticket/20123456789-03-F001-123"
        }
    }
}
```

{% endtab %}

{% tab title="400 Bad request" %}
{% code title="Documento duplicado" overflow="wrap" %}

```json
{
    "success": false,
    "message": "ERROR: Documento F001-123 fue emitido anteriormente"
}
```

{% endcode %}

{% code title="Datos requeridos" overflow="wrap" %}

```json
{
    "success": false,
    "message": "JSON no estructurado correctamente (Validación capa 01)",
    "payload": {
        "documento": [
            "El campo documento es requerido."
        ]
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="401 Permission denied" %}

```json
{
    "success": false,
    "message": "Error en la autenticación, token no válido."
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apisunat.pe/integracion/facturacion-electronica/factura/factura-de-exportacion.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
