Documentação da API
A API do Generate Random IBAN permite gerar e validar programaticamente IBAN de teste estruturalmente válidos (ISO 13616 / MOD-97). Todas as respostas são em JSON. Os IBAN gerados servem apenas para testes e nunca correspondem a contas bancárias reais.
URL base
https://generaterandomiban.com/api/v1
Autenticação
Todos os endpoints, exceto o índice do serviço, exigem uma chave de API. Envie-a no cabeçalho X-API-Key (um token Authorization: Bearer também funciona). Mantenha a sua chave em segredo e nunca a exponha em código do lado do cliente.
curl -H "X-API-Key: YOUR_KEY" https://generaterandomiban.com/api/v1/countries
As chaves de API são emitidas manualmente. Para solicitar uma, escreva-nos com uma breve descrição do seu caso de uso e responderemos com a sua chave.
Limites de uso
As requisições são limitadas por chave — 60 requisições por minuto por padrão, ou um limite personalizado atribuído à sua chave. Exceder o limite devolve HTTP 429 (Too Many Requests).
Endpoints
/api/v1
public
Public service index: metadata and the list of endpoints. No API key required.
curl https://generaterandomiban.com/api/v1
{
"name": "Generate Random IBAN API",
"version": "v1",
"documentation": "https://generaterandomiban.com/pt/apis/docs",
"authentication": { "type": "api_key", "header": "X-API-Key" }
}
/api/v1/countries
List every supported country with its IBAN format.
curl -H "X-API-Key: YOUR_KEY" https://generaterandomiban.com/api/v1/countries
{
"count": 45,
"countries": [
{
"code": "DE",
"name": "Germany",
"slug": "germany",
"iban_length": 22,
"bban_length": 18,
"bban_format": "8n10n",
"structure": "DEkk bbbb bbbb cccc cccc cc",
"example": "DE89370400440532013000"
}
]
}
/api/v1/countries/{code}
Get the IBAN format for a single country.
| Parameter | In | Description |
|---|---|---|
code |
path | ISO 3166-1 alpha-2 country code (e.g. DE, FR, IT). |
curl -H "X-API-Key: YOUR_KEY" https://generaterandomiban.com/api/v1/countries/DE
{
"country": {
"code": "DE",
"name": "Germany",
"iban_length": 22,
"bban_format": "8n10n",
"example": "DE89370400440532013000"
}
}
/api/v1/generate/{country}
Generate one or more random, valid IBANs for a country.
| Parameter | In | Description |
|---|---|---|
country |
path | ISO 3166-1 alpha-2 country code. |
count |
query | How many IBANs to return, 1–100 (default 1). |
curl -H "X-API-Key: YOUR_KEY" "https://generaterandomiban.com/api/v1/generate/DE?count=2"
{
"country": { "code": "DE", "name": "Germany", "iban_length": 22 },
"count": 2,
"ibans": [
{
"iban": "DE89370400440532013000",
"formatted": "DE89 3704 0044 0532 0130 00",
"country": "DE",
"check_digits": "89",
"bban": "370400440532013000",
"length": 22,
"valid": true
}
]
}
/api/v1/generate
Generate IBANs from a JSON body.
| Parameter | In | Description |
|---|---|---|
country |
body | ISO 3166-1 alpha-2 country code (required). |
count |
body | How many IBANs to return, 1–100 (default 1). |
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"country":"FR","count":3}' https://generaterandomiban.com/api/v1/generate
{
"country": { "code": "FR", "name": "France", "iban_length": 27 },
"count": 3,
"ibans": [ /* … */ ]
}
/api/v1/validate/{iban}
Validate an IBAN passed in the URL (spaces removed).
| Parameter | In | Description |
|---|---|---|
iban |
path | The IBAN to validate (letters and digits only). |
curl -H "X-API-Key: YOUR_KEY" https://generaterandomiban.com/api/v1/validate/DE89370400440532013000
{
"iban": "DE89370400440532013000",
"valid": true,
"country_code": "DE",
"country_supported": true,
"check_digits": "89",
"bban": "370400440532013000",
"length": 22,
"expected_length": 22,
"checks": { "mod97": true, "length": true, "format": true, "country_supported": true }
}
/api/v1/validate
Validate an IBAN from a JSON body.
| Parameter | In | Description |
|---|---|---|
iban |
body | The IBAN to validate (required). |
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"iban":"DE89 3704 0044 0532 0130 00"}' https://generaterandomiban.com/api/v1/validate
{
"iban": "DE89370400440532013000",
"valid": true,
"country_code": "DE",
"checks": { "mod97": true, "length": true, "format": true, "country_supported": true }
}
Erros e códigos de estado
Os erros devolvem um código de estado HTTP padrão e um corpo JSON com um objeto error contendo um code e uma message. Estados comuns: 401 (chave ausente ou inválida), 404 (país ou endpoint desconhecido), 422 (parâmetros inválidos) e 429 (limite excedido).
{
"error": {
"code": "invalid_request",
"message": "The \"count\" parameter must be an integer between 1 and 100."
}
}