# Consulta RUC Establecimientos Anexos

### Consideraciones

* Los datos se obtienen de la consulta RUC de SUNAT.

<mark style="color:green;">`POST`</mark> `https://apiperu.dev/api/ruc-establecimientos-anexos`

#### Headers

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

#### Body

| Name                                  | Type   | Description |
| ------------------------------------- | ------ | ----------- |
| ruc<mark style="color:red;">\*</mark> | String | 11 dígitos  |

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

```json
{
    "success": true,
    "data": [
        {
            "codigo": "0087",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "AV. ALFREDO BENAVIDES NRO. 617 (ALTURA DE LA VIA EXPRESA)",
            "direccion_completa": "AV. ALFREDO BENAVIDES NRO. 617 (ALTURA DE LA VIA EXPRESA), LIMA - LIMA - MIRAFLORES",
            "departamento": "LIMA",
            "provincia": "LIMA",
            "distrito": "MIRAFLORES",
            "ubigeo_sunat": "150122",
            "ubigeo": [
                "15",
                "1501",
                "150122"
            ]
        },
        {
            "codigo": "0024",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "JR. TRUJILLO NRO. 418",
            "direccion_completa": "JR. TRUJILLO NRO. 418, LIMA - LIMA - RIMAC",
            "departamento": "LIMA",
            "provincia": "LIMA",
            "distrito": "RIMAC",
            "ubigeo_sunat": "150128",
            "ubigeo": [
                "15",
                "1501",
                "150128"
            ]
        },
        {
            "codigo": "0118",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "JR. ANCASH MZA. G LOTE. 01 INT. 100 (PROYECTO LA POLVORA)",
            "direccion_completa": "JR. ANCASH MZA. G LOTE. 01 INT. 100 (PROYECTO LA POLVORA), LIMA - LIMA - EL AGUSTINO",
            "departamento": "LIMA",
            "provincia": "LIMA",
            "distrito": "EL AGUSTINO",
            "ubigeo_sunat": "150111",
            "ubigeo": [
                "15",
                "1501",
                "150111"
            ]
        },
        {
            "codigo": "0089",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "CAL.CUTERVO ANTIGUO NRO. 128",
            "direccion_completa": "CAL.CUTERVO ANTIGUO NRO. 128, ICA - ICA - ICA",
            "departamento": "ICA",
            "provincia": "ICA",
            "distrito": "ICA",
            "ubigeo_sunat": "110101",
            "ubigeo": [
                "11",
                "1101",
                "110101"
            ]
        },
        {
            "codigo": "0004",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "----PROL.PASEO DE LA REPUBLIC NRO. SN URB. MATELLINI (BAZAR CENTRAL DEL EJERCITO-URB.MATELLINI)",
            "direccion_completa": "----PROL.PASEO DE LA REPUBLIC NRO. SN URB. MATELLINI (BAZAR CENTRAL DEL EJERCITO-URB.MATELLINI), LIMA - LIMA - CHORRILLOS",
            "departamento": "LIMA",
            "provincia": "LIMA",
            "distrito": "CHORRILLOS",
            "ubigeo_sunat": "150108",
            "ubigeo": [
                "15",
                "1501",
                "150108"
            ]
        },
        {
            "codigo": "0051",
            "tipo_de_establecimiento": "LO.  L. COMERCIAL",
            "actividad_economica": "-",
            "direccion": "AV. BENAVIDES NRO. 5250",
            "direccion_completa": "AV. BENAVIDES NRO. 5250, LIMA - LIMA - SANTIAGO DE SURCO",
            "departamento": "LIMA",
            "provincia": "LIMA",
            "distrito": "SANTIAGO DE SURCO",
            "ubigeo_sunat": "150140",
            "ubigeo": [
                "15",
                "1501",
                "150140"
            ]
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Ejemplos de uso

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

```php
    $params = json_encode(['ruc' => 'INGRESAR_NUMERO_RUC_AQUI']);
    $curl = curl_init();
    curl_setopt_array($curl, [
        CURLOPT_URL => "https://apiperu.dev/api/ruc_establecimientos_anexos",
        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-ruc-establecimientos.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.
