Nif

Validate NIF against AEAT registry

**Public endpoint** to validate a NIF/CIF against the AEAT registry using VeriFactu. This endpoint is useful for: - Pre-validation before registration (proactive feedback) - Validating client NIFs before creating invoices - Verifying that a NIF exists in the registry **Behavior:** - **VALID**: The NIF exists in the AEAT registry. Returns the fiscal name. - **INVALID**: The NIF has correct format but doesn't exist in the registry. - **PENDING**: VeriFactu API is temporarily unavailable. The NIF has valid syntax but couldn't be verified against the registry. - **ERROR**: Technical error during validation (invalid syntax, timeout, etc.) **Note about PENDING:** If you use this endpoint for pre-validation during registration, a PENDING status indicates that the NIF has valid format and the user can continue. The system will validate the NIF automatically when the service becomes available. **Rate limiting:** - With API Key: 100 requests/hour - With Session Cookie: 1000 requests/hour **Authentication:** This endpoint accepts both API Keys and Session Cookies.

POST
/nif/validar
X-API-Key<token>

API Key authentication.

Format: X-API-Key: beel_sk_<key>

Obtaining Keys: API Keys are managed from the BeeL dashboard

Security: API Keys are secret credentials. Do not share them or store them in source code

In: header

nifstring
nombre_fiscal?string|null

Apellidos y nombre (persona física) o razón social (persona jurídica).

Importante:

  • OBLIGATORIO para personas físicas (NIFs que empiezan con número)
  • OPCIONAL para personas jurídicas (NIFs que empiezan con letra)

La AEAT valida que el nombre proporcionado coincida con el registrado en el censo. Si no coincide, la validación retornará INVALID.

Length1 <= length <= 255

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.beel.es/api/v1/nif/validar" \  -H "Content-Type: application/json" \  -d '{    "nif": "B12345678"  }'

{
  "success": true,
  "data": {
    "valido": true,
    "status": "VALID",
    "nombre_fiscal": "JUAN PEREZ GARCIA",
    "mensaje": "NIF successfully validated in AEAT registry",
    "validated_at": "2025-01-15T10:30:00Z"
  },
  "meta": {
    "timestamp": "2025-01-15T10:30:00Z",
    "request_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}

{
  "success": false,
  "error": {
    "code": "BAD_REQUEST",
    "message": "Invalid request"
  },
  "meta": {
    "timestamp": "2025-01-15T10:30:00Z",
    "request_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  },
  "meta": {
    "timestamp": "2025-01-15T10:30:00Z",
    "request_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation error",
    "details": {
      "field_name": "Field is required"
    }
  },
  "meta": {
    "timestamp": "2025-01-15T10:30:00Z",
    "request_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}
{
  "success": false,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Internal server error"
  },
  "meta": {
    "timestamp": "2025-01-15T10:30:00Z",
    "request_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}