> For the complete documentation index, see [llms.txt](https://docs.aurora.net.pe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aurora.net.pe/documentos/generar-comprobantes-electronicos.md).

# Generar comprobantes electrónicos

## Generar documento

Este método debe ser utilizado para generar un documento y enviarlo a los servidores de SUNAT para su procesamiento.

## POST /documents

> Create a document

```json
{"openapi":"3.0.2","info":{"title":"AURORA API","version":"1.0"},"tags":[{"name":"document"}],"servers":[{"url":"https://aurora.net.pe/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Document":{"type":"object","properties":{"tipo_de_comprobante":{"type":"string","enum":["01","03","07","08"]},"serie":{"type":"string"},"numero":{"type":"number"},"cliente_tipo_de_documento":{"type":"string","enum":["-","1","6","4","7"]},"cliente_numero_de_documento":{"type":"string"},"cliente_denominacion":{"type":"string"},"cliente_direccion":{"type":"string"},"cliente_email":{"type":"string"},"codigo_sunat_de_sucursal":{"type":"string"},"fecha_de_emision":{"type":"string"},"fecha_de_vencimiento":{"type":"string","nullable":true},"moneda":{"type":"string","enum":["PEN","USD"]},"tipo_de_cambio":{"type":"string","nullable":true},"porcentaje_de_igv":{"type":"number"},"total_gravada":{"type":"number"},"total_inafecta":{"type":"number","nullable":true},"total_exonerada":{"type":"number","nullable":true},"total_gratuita":{"type":"number","nullable":true},"total_igv":{"type":"number"},"total":{"type":"number"},"detraccion":{"type":"boolean","nullable":true},"observaciones":{"type":"string","nullable":true},"documento_que_se_modifica_tipo":{"type":"string","nullable":true},"documento_que_se_modifica_serie":{"type":"string","nullable":true},"documento_que_se_modifica_numero":{"type":"string","nullable":true},"tipo_de_nota_de_credito":{"type":"string","nullable":true},"tipo_de_nota_de_debito":{"type":"string","nullable":true},"forma_de_pago":{"type":"string","description":"1 = CONTADO, 2 = CREDITO","enum":["1","2"]},"medio_de_pago":{"type":"string","nullable":true},"total_impuestos_bolsas":{"type":"number","nullable":true},"orden_compra_servicio":{"type":"string","nullable":true},"venta_al_credito":{"type":"array","items":{"$ref":"#/components/schemas/DocumentFee"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/DocumentItem"}}},"required":["tipo_de_comprobante","serie","numero","cliente_tipo_de_documento","cliente_numero_de_documento","cliente_denominacion","cliente_direccion","codigo_sunat_de_sucursal","fecha_de_emision","moneda","porcentaje_de_igv","total_gravada","total_igv","total","forma_de_pago","items"]},"DocumentFee":{"type":"object","properties":{"cuota":{"type":"number"},"fecha_de_pago":{"type":"string"},"importe":{"type":"number"}},"required":["cuota","fecha_de_pago","importe"]},"DocumentItem":{"type":"object","properties":{"unidad_de_medida":{"type":"string"},"codigo":{"type":"string"},"descripcion":{"type":"string"},"codigo_producto_sunat":{"type":"string","nullable":true},"impuesto_bolsas":{"type":"number","nullable":true},"cantidad":{"type":"number"},"valor_unitario":{"type":"integer"},"precio_unitario":{"type":"integer"},"subtotal":{"type":"integer"},"tipo_de_igv":{"type":"string"},"igv":{"type":"integer"},"total":{"type":"integer"}},"required":["unidad_de_medida","codigo","descripcion","cantidad","valor_unitario","precio_unitario","subtotal","tipo_de_igv","igv","total"]},"DocumentResponse":{"type":"object","properties":{"id":{"type":"string"},"tipo_de_comprobante":{"type":"string"},"serie":{"type":"string"},"numero":{"type":"number"},"aceptada_por_sunat":{"type":"boolean"},"sunat_descripcion":{"type":"string"},"sunat_nota":{"type":"string","nullable":true},"sunat_codigo_respuesta":{"type":"string"},"sunat_error_soap":{"type":"string","nullable":true},"anulado":{"type":"boolean"},"cadena_para_codigo_qr":{"type":"string"},"codigo_hash":{"type":"string"},"enlace_pdf":{"type":"string"},"enlace_xml":{"type":"string"},"enlace_cdr":{"type":"string"}}},"ForbiddenResponse":{"type":"object","properties":{"message":{"type":"string"}}},"NotFoundResponse":{"type":"object","properties":{"message":{"type":"string"}}},"UnprocessableResponse":{"type":"object","properties":{"id":{"type":"string"},"tipo_de_comprobante":{"type":"string"},"serie":{"type":"string"},"numero":{"type":"number"},"sunat_codigo_respuesta":{"type":"string"},"sunat_error_soap":{"type":"string"}}}}},"paths":{"/documents":{"post":{"summary":"Create a document","tags":["document"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Document"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableResponse"}}}}}}}}}
```

## Enviar documento pendiente

Este método debe ser utilizado para enviar un documento previamente generado que no recibió respuesta de los servidores de SUNAT. Esto puede ocurrir debido a problemas de conectividad o mantenimientos programados en los servicios de SUNAT.

## GET /documents/send

> Send pending document

```json
{"openapi":"3.0.2","info":{"title":"AURORA API","version":"1.0"},"tags":[{"name":"document"}],"servers":[{"url":"https://aurora.net.pe/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"DocumentResponse":{"type":"object","properties":{"id":{"type":"string"},"tipo_de_comprobante":{"type":"string"},"serie":{"type":"string"},"numero":{"type":"number"},"aceptada_por_sunat":{"type":"boolean"},"sunat_descripcion":{"type":"string"},"sunat_nota":{"type":"string","nullable":true},"sunat_codigo_respuesta":{"type":"string"},"sunat_error_soap":{"type":"string","nullable":true},"anulado":{"type":"boolean"},"cadena_para_codigo_qr":{"type":"string"},"codigo_hash":{"type":"string"},"enlace_pdf":{"type":"string"},"enlace_xml":{"type":"string"},"enlace_cdr":{"type":"string"}}},"ForbiddenResponse":{"type":"object","properties":{"message":{"type":"string"}}},"NotFoundResponse":{"type":"object","properties":{"message":{"type":"string"}}},"UnprocessableResponse":{"type":"object","properties":{"id":{"type":"string"},"tipo_de_comprobante":{"type":"string"},"serie":{"type":"string"},"numero":{"type":"number"},"sunat_codigo_respuesta":{"type":"string"},"sunat_error_soap":{"type":"string"}}}}},"paths":{"/documents/send":{"get":{"summary":"Send pending document","tags":["document"],"parameters":[{"name":"tipo_de_comprobante","in":"query","required":true,"schema":{"type":"string","enum":["01","03","07","08"]}},{"name":"serie","in":"query","required":true,"schema":{"type":"string"}},{"name":"numero","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableResponse"}}}}}}}}}
```

## Consultar documento

Este método debe ser utilizado para consultar el estado de un documento previamente generado y enviado a los servidores de SUNAT.

## GET /documents

> Get document

```json
{"openapi":"3.0.2","info":{"title":"AURORA API","version":"1.0"},"tags":[{"name":"document"}],"servers":[{"url":"https://aurora.net.pe/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"DocumentResponse":{"type":"object","properties":{"id":{"type":"string"},"tipo_de_comprobante":{"type":"string"},"serie":{"type":"string"},"numero":{"type":"number"},"aceptada_por_sunat":{"type":"boolean"},"sunat_descripcion":{"type":"string"},"sunat_nota":{"type":"string","nullable":true},"sunat_codigo_respuesta":{"type":"string"},"sunat_error_soap":{"type":"string","nullable":true},"anulado":{"type":"boolean"},"cadena_para_codigo_qr":{"type":"string"},"codigo_hash":{"type":"string"},"enlace_pdf":{"type":"string"},"enlace_xml":{"type":"string"},"enlace_cdr":{"type":"string"}}},"ForbiddenResponse":{"type":"object","properties":{"message":{"type":"string"}}},"NotFoundResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/documents":{"get":{"summary":"Get document","tags":["document"],"parameters":[{"name":"tipo_de_comprobante","in":"query","required":true,"schema":{"type":"string","enum":["01","03","07","08"]}},{"name":"serie","in":"query","required":true,"schema":{"type":"string"}},{"name":"numero","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFoundResponse"}}}}}}}}}
```

## Ver comprobantes electrónicos emitidos

Puede buscar y filtrar comprobantes electrónicos por fecha de emision, cliente (denominación o número de documento) y número de documento.

El filtro también permite establecer un rango de fechas.

<figure><img src="/files/tf4gnL4Grx0fvMlou867" alt=""><figcaption></figcaption></figure>

El botón `Opciones` permite las siguientes acciones:

* Enviar a SUNAT (cuando estado es pendiente)
* Ver detalle respuesta SUNAT

La opción `Exportar` genera un archivo Excel con los comprobantes electrónicos emitidos en base a los filtros aplicados.

## Catálogos para generar comprobantes electrónicos

### Tabla de tipos comprobantes electrónicos

| Código | Descripción     |
| ------ | --------------- |
| 01     | FACTURA         |
| 03     | BOLETA DE VENTA |
| 07     | NOTA DE CRÉDITO |
| 08     | NOTA DE DÉBITO  |

### Tabla de tipos de entidad

| Código | Descripción           |
| ------ | --------------------- |
| -      | VARIOS                |
| 1      | DNI                   |
| 6      | RUC                   |
| 4      | CARNET DE EXTRANJERIA |
| 7      | PASAPORTE             |

### Tabla de tipos de moneda

| Código | Descripción        |
| ------ | ------------------ |
| PEN    | SOLES              |
| USD    | DÓLARES AMERICANOS |

### Tabla de tipos de pago

| Código | Descripción |
| ------ | ----------- |
| 1      | CONTADO     |
| 2      | CRÉDITO     |

### Tabla de tipos de IGV

| Código | Descripción                                 |
| ------ | ------------------------------------------- |
| 10     | Gravado - Operación Onerosa                 |
| 11     | Gravado - Retiro por premio                 |
| 12     | Gravado - Retiro por donación               |
| 13     | Gravado - Retiro                            |
| 14     | Gravado - Retiro por publicidad             |
| 15     | Gravado - Bonificaciones                    |
| 16     | Gravado - Retiro por entrega a trabajadores |
| 20     | Exonerado - Operación Onerosa               |
| 21     | Exonerado - Transferencia Gratuita          |
| 30     | Inafecto - Operación Onerosa                |
| 31     | Inafecto - Retiro por Bonificación          |
| 32     | Inafecto - Retiro                           |
| 33     | Inafecto - Retiro por Muestras Médicas      |
| 34     | Inafecto - Retiro por Convenio Colectivo    |
| 35     | Inafecto - Retiro por premio                |
| 36     | Inafecto - Retiro por publicidad            |
