Consulta DNI - RUC
Deriva el RUC de persona natural (prefijo 10) a partir de un número de DNI.
Consideraciones
- Calcula el RUC de persona natural asociado a un DNI (prefijo
10+ dígito verificador). - 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 |
|---|---|---|
| dni* | string | Número de DNI de 8 dígitos. Ejemplo: 44556677. |
Ejemplo de solicitud
Copiar
curl -X POST https://api.apiperu.dev/dni-ruc \
-H "Accept: application/json" \
-H "Authorization: Bearer TU_TOKEN" \
-H "Content-Type: application/json" \
-d '{"dni":"44556677"}' Copiar
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.apiperu.dev/dni-ruc',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'dni' => '44556677',
]),
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/dni-ruc', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer TU_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
dni: '44556677',
}),
});
const data = await response.json();
console.log(data); Copiar
import requests
response = requests.post(
'https://api.apiperu.dev/dni-ruc',
headers={
'Accept': 'application/json',
'Authorization': 'Bearer TU_TOKEN',
'Content-Type': 'application/json',
},
json={
'dni': '44556677',
},
)
print(response.json()) Respuesta
200 OK application/json
{
"success": true,
"data": {
"ruc": "10445566778"
},
"time": 0.05
}