# Consulta CPE Múltiple

### Consideraciones

* Se puede enviar un máximo de 100 comprobantes a consultar, se recomienda enviar menos.
* Algunas validaciones devolverán vacío, no considerar como error del api, es como SUNAT devuelve la validación.

<mark style="color:green;">`POST`</mark> `https://apiperu.dev/api/validacion-multiple-cpe`&#x20;

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Accept        | string | application/json |
| Content-Type  | string | application/json |
| Authorization | string | Bearer \<token>  |

#### Body

| Name           | Type   | Description                                                                          |
| -------------- | ------ | ------------------------------------------------------------------------------------ |
| ruc\_empresa   | string | RUC del emisor, 11 dígitos, no es obligatorio, enviar campo vacío                    |
| sol\_usuario   | string | Usuario Sol del portal de SUNAT, no es obligatorio, enviar campo vacío               |
| clave\_usuario | string | Clave Sol del portal de SUNAT, no es obligatorio                                     |
| comprobantes   | array  | Array de comprobantes a validar, tener en cuenta la estructura de **"Consulta CPE"** |

{% tabs %}
{% tab title="200 " %}

```json
{
    "success": true,
    "data": {
        "cantidad_de_comprobantes": 2,
        "comprobantes": [
            {
                "ruc_emisor": "20308***755",
                "codigo_tipo_documento": "07",
                "serie_documento": "BC01",
                "numero_documento": "1",
                "fecha_de_emision": "2020-09-24",
                "total": 120,
                "comprobante_estado_codigo": "1",
                "comprobante_estado_descripcion": "ACEPTADO",
                "empresa_estado_codigo": "00",
                "empresa_estado_descripcion": "ACTIVO",
                "empresa_condicion_codigo": "00",
                "empresa_condicion_descripcion": "HABIDO",
                "observaciones": []
            },
            {
                "ruc_emisor": "20308***755",
                "codigo_tipo_documento": "07",
                "serie_documento": "BC01",
                "numero_documento": "1",
                "fecha_de_emision": "2020-09-24",
                "total": 120,
                "comprobante_estado_codigo": "1",
                "comprobante_estado_descripcion": "ACEPTADO",
                "empresa_estado_codigo": "00",
                "empresa_estado_descripcion": "ACTIVO",
                "empresa_condicion_codigo": "00",
                "empresa_condicion_descripcion": "HABIDO",
                "observaciones": []
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### Ejemplos de uso

{% tabs %}
{% tab title="PHP" %}

```php
    $curl = curl_init();
    $params = json_encode([
        "ruc_empresa" => "",
        "sol_usuario" => "",
        "clave_usuario" => "",
        "comprobantes": [        
            [
                "ruc_emisor" => "INGRESAR_NUMERO_RUC_AQUI",
                "codigo_tipo_documento" => "03",
                "serie_documento" => "B002",
                "numero_documento" => "409",
                "fecha_de_emision" => "2021-09-30",
                "total" => "210.00"
            ],
            [
                "ruc_emisor" => "INGRESAR_NUMERO_RUC_AQUI",
                "codigo_tipo_documento" => "03",
                "serie_documento" => "B002",
                "numero_documento" => "409",
                "fecha_de_emision" => "2021-09-30",
                "total" => "210.00"
            ]
        ]
    ]);
    
    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://apiperu.dev/api/validacion_multiple_cpe",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_POSTFIELDS => $params, 
        CURLOPT_HTTPHEADER => [
            'Accept: application/json',
            'Content-Type: application/json',
            'Authorization: Bearer INGRESAR_TOKEN_AQUI'
        ],
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
        echo "cURL Error #:" . $err;
    } else {
        echo $response;
    }
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.apiperu.dev/enpoints/consulta-cpe-multiple.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
