Documentación / Clientes, productos y NIF

Validar NIF en el VIES

POST  https://{entorno}.verifactu.ws/validar-nif-vies/

Permite verificar si un NIF está registrado en el VIES. Permite comprobar que el NIF sea correcto y si está registrado como operador intracomunitario

PARÁMETROS

nif string obligatorio
NIF a validar
B12345678
pais string obligatorio
Código de país
ES


Los posibles resultados son:

IDENTIFICADO: NIF válido y registrado en el VIES como operador intracomunitario
NO IDENTIFICADO: NIF no válido o no registrado como operador intracomunitario

POST https://api.verifactu.ws/validar-nif-vies/
$ curl --request POST \
     --url https://api.verifactu.ws/validar-nif-vies/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
	 --data '
{
    "nif": "12345678Z",
    "nombre": "Juan Martínez"
}'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Instalación: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';

$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'real']);

$r = $tbai->validarNifVies('12345678Z', '');

if ($r->isError()) {
    echo $r->getMessageText();
} else {
    print_r($r->getData());
}
$ python -m pip install requests
import requests

url = "https://api.verifactu.ws/validar-nif-vies/"
payload = {
    "nif": "12345678Z",
    "nombre": "Juan Martínez"
}

headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.verifactu.ws/validar-nif-vies/");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, '{"nif": "12345678Z","nombre": "Juan Martínez"}');

CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{"nif": "12345678Z","nombre": "Juan Martínez"}');

Request request = new Request.Builder()
  .url("https://api.verifactu.ws/validar-nif-vies/")
  .post(body)
  .addHeader("Accept", "application/json")
  .addHeader("Token", "xxx")
  .addHeader("Nif", "00000014Z")
  .build();
  
Response response = client.newCall(request).execute();
{ } Response JSON
HTTP/1.1 200 OK
{
    "result": "OK",
    "return": {
        "nif": "12345678Z",
        "nombre": "MARTINEZ RODRIGUEZ JUAN",
        "resultado": "IDENTIFICADO"
    },
    "msg": ""
}

‹ Todos los métodos de la API