Referencja API

API API do walidacji hiszpańskich numerów DNI, NIE i NIF

Waliduj hiszpańskie numery DNI, NIE i NIF/CIF. Użyj tej referencji, aby wybrać operację i zintegrować jej udokumentowany kontrakt odpowiedzi.

Operacje

GET /v1/national-id/validate Otwórz referencję API

GET /v1/national-id/validate

Operacja: validateNationalId Kredyty i uwierzytelnianie: 1 Wymagane uwierzytelnianie
GET /v1/national-id/validate Kredyty: 1

Parametry zapytania

Parametr Typ wymagane
id string wymagane
country string
Dozwolone wartości ES
Domyślnie ES
opcjonalne

Pola odpowiedzi

Pole Typ
country string
input string
normalized string | null
valid boolean
type string | null
entity_type string | null
holder string | null
checks object
checks.format boolean
checks.control boolean | null
expected_control string | null
errors[] string[]

Przykładowe żądanie

curl -H "X-API-Key: $DOMSCAN_API_KEY" "https://domscan.net/v1/national-id/validate?id=example-id&country=ES"
const response = await fetch("https://domscan.net/v1/national-id/validate?id=example-id&country=ES", {
  headers: { "X-API-Key": process.env.DOMSCAN_API_KEY },
});
const data = await response.json();
console.log(data);
import os
import requests

response = requests.get(
    "https://domscan.net/v1/national-id/validate?id=example-id&country=ES",
    headers={"X-API-Key": os.environ["DOMSCAN_API_KEY"]},
)
print(response.json())
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest(http.MethodGet, "https://domscan.net/v1/national-id/validate?id=example-id&country=ES", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("X-API-Key", os.Getenv("DOMSCAN_API_KEY"))

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	data, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp.Status, string(data))
}
require "json"
require "net/http"

uri = URI("https://domscan.net/v1/national-id/validate?id=example-id&country=ES")
request = Net::HTTP::Get.new(uri)
request["X-API-Key"] = ENV.fetch("DOMSCAN_API_KEY")

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
puts JSON.pretty_generate(JSON.parse(response.body))

Przykładowa odpowiedź

{
  "country": "ES",
  "input": "B-58378431",
  "normalized": "B58378431",
  "valid": true,
  "type": "cif",
  "entity_type": "sociedad_responsabilidad_limitada",
  "holder": null,
  "checks": {
    "format": true,
    "control": true
  },
  "expected_control": null,
  "errors": []
}

Kody statusu HTTP

  • 200 OK
  • 400 Nieprawidłowe żądanie
  • 401 Nieautoryzowany
  • 402 Wymagana płatność
  • 429 Zbyt wiele żądań

Materiały referencyjne