# Consulta RUC

Los datos se obtienen de la consulta RUC de SUNAT.

```
POST https://service.miasoftware.net/api/consultar/ruc
```

**HEADER**

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Accept       | string | application/json |
| Content-Type | string | application/json |
| Autorization | string | Bearer {token}   |

**BODY**

| Name  | Type   | Description |
| ----- | ------ | ----------- |
| ruc\* | string | 11 digitos  |

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

```jsonp
{
    "success": true,
    "data": {
        "direccion": "AV. SANTUARIO NRO. 1122 URB. ZARATE (ALT CDRA 45 AV CHIMU)",
        "direccion_completa": "AV. SANTUARIO NRO. 1122 URB. ZARATE (ALT CDRA 45 AV CHIMU) LIMA - LIMA - SAN JUAN DE LURIGANCHO"    
        "ruc": "20123456789",
        "nombre_o_razon_social": "EMPRESA DEMO SAC",
        "estado": "ACTIVO",
        "condicion": "HABIDO",
        "departamento": "LIMA",
        "provincia": "LIMA",
        "distrito": "SAN JUAN DE LURIGANCHO",
        "ubigeo_sunat": "150132",
        "ubigeo": [
            "15",
            "1501",
            "150132"
        ]        
    }
}
```

{% endtab %}
{% endtabs %}

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

```php
$params = json_encode(['ruc' => 'INGRESAR_NUMERO_RUC_AQUI']);
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://service.miasoftware.net/api/consultar/ruc",
    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.miasoftware.net/consulta-ruc.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.
