Consulta CPE
Valida un comprobante de pago electrónico contra SUNAT.
Consideraciones
- Consulta el estado de un comprobante en SUNAT (aceptado, anulado, no autorizado…) junto con el estado y condición del emisor.
- Disponible en el plan gratuito. Consume 1 consulta de tu plan.
Headers
| Name | Type | Description |
|---|---|---|
| Accept | String | application/json |
| Content-Type | string | application/json |
| Authorization | string | Bearer <token>. Genéralo desde tu panel, en Api Tokens. |
Body
| Name | Type | Description |
|---|---|---|
| ruc_emisor* | string | RUC del emisor (11 dígitos). |
| codigo_tipo_documento* | string | Tipo de comprobante: 01 factura, 03 boleta, 07 nota de crédito, 08 nota de débito. |
| serie_documento* | string | Serie del comprobante. Ejemplo: F001. |
| numero_documento* | string | Número correlativo del comprobante. |
| fecha_de_emision* | string | Fecha de emisión en formato AAAA-MM-DD. |
| total* | number | Importe total del comprobante. |
Ejemplo de solicitud
Copiar
curl -X POST https://api.apiperu.dev/cpe \
-H "Accept: application/json" \
-H "Authorization: Bearer TU_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ruc_emisor":"20601234567","codigo_tipo_documento":"01","serie_documento":"F001","numero_documento":"123","fecha_de_emision":"2026-07-10","total":118}' Copiar
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.apiperu.dev/cpe',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'ruc_emisor' => '20601234567',
'codigo_tipo_documento' => '01',
'serie_documento' => 'F001',
'numero_documento' => '123',
'fecha_de_emision' => '2026-07-10',
'total' => 118,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Authorization: Bearer TU_TOKEN',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response; Copiar
const response = await fetch('https://api.apiperu.dev/cpe', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer TU_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
ruc_emisor: '20601234567',
codigo_tipo_documento: '01',
serie_documento: 'F001',
numero_documento: '123',
fecha_de_emision: '2026-07-10',
total: 118,
}),
});
const data = await response.json();
console.log(data); Copiar
import requests
response = requests.post(
'https://api.apiperu.dev/cpe',
headers={
'Accept': 'application/json',
'Authorization': 'Bearer TU_TOKEN',
'Content-Type': 'application/json',
},
json={
'ruc_emisor': '20601234567',
'codigo_tipo_documento': '01',
'serie_documento': 'F001',
'numero_documento': '123',
'fecha_de_emision': '2026-07-10',
'total': 118,
},
)
print(response.json()) Respuesta
200 OK application/json
{
"success": true,
"data": {
"ruc_emisor": "20601234567",
"serie_documento": "F001",
"numero_documento": "123",
"comprobante_estado_codigo": "1",
"comprobante_estado_descripcion": "ACEPTADO",
"empresa_estado_descripcion": "ACTIVO",
"empresa_condicion_descripcion": "HABIDO",
"observaciones": []
},
"time": 0.9
}