# Consulta RUC Domicilio Fiscal

### Consideraciones

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

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

#### 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": "0000",
            "tipo_de_establecimiento": "DOMICILIO FISCAL",
            "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"
            ]
        }
}
```

{% 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_domicilio_fiscal",
        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-domicilio-fiscal.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.
