توثيق واجهة API
تتيح لك واجهة Generate Random IBAN توليد أرقام IBAN تجريبية صحيحة بنيويًا (ISO 13616 / MOD-97) والتحقق منها برمجيًا. جميع الردود بصيغة JSON. أرقام IBAN المولّدة مخصّصة للاختبار فقط ولا تقابل أبدًا حسابات مصرفية حقيقية.
عنوان URL الأساسي
https://generaterandomiban.com/api/v1
المصادقة
تتطلب جميع نقاط النهاية، باستثناء فهرس الخدمة، مفتاح API. أرسله في ترويسة X-API-Key (كما يعمل رمز Authorization: Bearer). حافظ على سرية مفتاحك ولا تكشفه أبدًا في كود جهة العميل.
curl -H "X-API-Key: YOUR_KEY" https://generaterandomiban.com/api/v1/countries
تُصدر مفاتيح API يدويًا. لطلب مفتاح، راسلنا مع وصف موجز لحالة استخدامك وسنرد عليك بمفتاحك.
حدود المعدل
الطلبات محدودة لكل مفتاح — 60 طلبًا في الدقيقة افتراضيًا، أو حد مخصّص يُعيَّن لمفتاحك. يؤدي تجاوز الحد إلى الرد بالرمز HTTP 429 (Too Many Requests).
نقاط النهاية
/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/ar/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 }
}
الأخطاء ورموز الحالة
تُرجع الأخطاء رمز حالة HTTP قياسيًا وجسم JSON يحتوي على كائن error يتضمّن code وmessage. الحالات الشائعة: 401 (مفتاح مفقود أو غير صالح)، 404 (دولة أو نقطة نهاية غير معروفة)، 422 (معطيات غير صالحة) و429 (تجاوز الحد).
{
"error": {
"code": "invalid_request",
"message": "The \"count\" parameter must be an integer between 1 and 100."
}
}