You need to enable JavaScript to use this application.
POST استعلام

Deposit to IBAN Conversion API

This API endpoint allows you to convert a deposit account number to its corresponding IBAN (International Bank Account Number). The service requires authentication and deducts credits from your wallet upon successful conversion.

POST /api/services/deposit-to-iban/
نیاز به احراز هویت Token 100 requests/minute

مستندات

Overview

Overview

The Deposit to IBAN Conversion API allows you to convert a deposit account number to its corresponding IBAN (International Bank Account Number). This service is essential for banking operations, payment processing, and financial integrations.

When you make a successful API call, the service will:

  • Validate the deposit account number format
  • Validate the bank identifier
  • Query Sepal Yar to retrieve the IBAN
  • Deduct credits from your wallet (10,000 Rials per request)
  • Return the IBAN number along with a unique request reference

Use Cases:

  • Payment gateway integrations
  • Banking system integrations
  • Financial transaction processing
  • Account verification systems

Authentication

Authentication

This API requires authentication using a Token-based authentication system with a unique code.

How to authenticate:

  1. Obtain your API token and unique code from the admin panel or registration API
  2. Include both in the request headers
  3. Format: Authorization: Token YOUR_AUTH_TOKEN
  4. Format: X-Unique-Code: YOUR_UNIQUE_CODE

Example Headers:

Authorization: Token abc123def456ghi789
X-Unique-Code: 1234567890

If authentication fails, you will receive a 401 Unauthorized response.

Note: The unique code is required for additional security and tracking purposes.

Request Format

Request Format

All requests must be sent as POST requests with JSON payload.

Required Headers:

  • Authorization: Token YOUR_AUTH_TOKEN
  • X-Unique-Code: YOUR_UNIQUE_CODE
  • Content-Type: application/json

Request Body:

The request body must be a JSON object containing:

  • deposit (string, required): Deposit account number. Can include dashes (e.g., "119-813-2295556-1") or be plain digits. Minimum 6 digits required.
  • bank_id (string, required): Bank identifier code. Must be one of the supported bank codes (see Bank Codes section below).

Example Request:

{
  "deposit": "119-813-2295556-1",
  "bank_id": "SINAIR"
}

Deposit Number Format:

  • Can include dashes: 119-813-2295556-1
  • Can be plain digits: 11981322955561
  • Spaces will be automatically removed
  • Dashes are preserved in the URL but validated as digits only

Bank Codes

Supported Bank Codes

The following bank codes are supported for the bank_id parameter:

Code Bank Name
MELALIRموسسه اعتباری ملل
WALLETکیف پول
BLUBIRبلوبانک
TTBIIRبانک توسعه و تعاون
BGSHIRگردشگری
BRQBIRرسالت
KBIDIRکارآفرین
EDBIIRتوسعه صادرات
BKMNIRمسکن
KHMIIRخاورمیانه
BKPAIRپارسیان
KESHIRکشاورزی
BSIRIRصادرات
REFAIRرفاه
BKMTIRملت
BTEJIRتجارت
SEPBIRسپه
BKBPIRپاسارگاد
AYBKIRآینده
BTOSIRموسسه اعتباری توسعه
BOIMIRصنعت و معدن
MELIIRملی
PBIRIRپست بانک
MEHRIRمهر ایران
IRZAIRایران زمین
IVBBIRایران ونزوئلا
SRMBIRسرمایه
SINAIRسینا
DAYBIRدی
BEGNIRاقتصاد نوین
SABCIRسامان
CIYBIRشهر

Important: The bank_id must match the bank that issued the deposit account. Using an incorrect bank_id may result in errors.

Response Format

Response Format

All responses are returned as JSON objects.

Success Response (200 OK):

When the request is successful, you will receive a response containing:

  • success: Boolean indicating success (true)
  • request_ref: Unique reference number for this request (alphanumeric string)
  • amount: Amount deducted from your wallet (in Rials, typically 10,000)
  • response_data: The service response data containing:
    • operation_time: Timestamp of the operation
    • ref_id: Reference ID from the platform
    • iban_number: The IBAN number (starts with IR)
  • response_time_ms: Response time in milliseconds
  • error_message: null for successful requests

Example Success Response:

{
  "success": true,
  "request_ref": "NT2YSIL8MUSDNBUYOVEWFALMKP7ZMXZP",
  "amount": 10000,
  "response_data": {
    "operation_time": 1763203972118,
    "ref_id": "936d16cb-9b23-47e4-8445-bf9ad3a1907c",
    "iban_number": "IR110590011981302295556001"
  },
  "response_time_ms": 1728,
  "error_message": null
}

Error Response:

When an error occurs, you will receive a response containing:

  • success: false
  • error: Object containing error details
    • code: Error code (optional)
    • message: Error message
    • details: Additional error details (optional)
    • errors: Array of error objects from the platform (optional)

Error Handling

Error Handling

The API uses standard HTTP status codes to indicate success or failure:

  • 200 OK: Request successful, IBAN returned
  • 400 Bad Request: Invalid parameters provided or validation error
  • 401 Unauthorized: Authentication failed or missing
  • 402 Payment Required: Insufficient wallet balance
  • 404 Not Found: Deposit account number not found or invalid
  • 500 Internal Server Error: Server encountered an error

Common Error Codes:

  • INVALID_PARAMETERS: One or more parameters are invalid (deposit format, bank_id, etc.)
  • AUTHENTICATION_ERROR: Authentication token is missing or invalid
  • INSUFFICIENT_BALANCE: Not enough credits in wallet (minimum 10,000 Rials required)
  • SERVICE_ERROR: Service encountered an internal error
  • SERVICE_NOT_FOUND: Service not found or inactive
  • 032: Deposit account number is not valid (platform)
  • 1002: Bank ID is required in header (platform)

Platform Error Codes:

When errors originate from the platform, they are returned as-is with the following structure:

{
  "success": false,
  "error": {
    "operation_time": 1763203768922,
    "ref_id": "74e0eafc-3d3f-4d0d-8af5-798cb2b50891",
    "errors": [
      {
        "code": "1002",
        "message": "ارسال شناسه بانک در header اجباری می باشد",
        "reference": "BANK-ID"
      }
    ]
  }
}

Always check the success field in the response to determine if the request was successful.

Rate Limiting

Rate Limiting

This API has rate limiting to ensure fair usage:

  • Limit: 100 requests per minute
  • Per IP: Rate limits are applied per IP address
  • Per User: Rate limits may also be applied per authenticated user

If you exceed the rate limit, you will receive a 429 Too Many Requests response.

Best Practices:

  • Implement exponential backoff for retries
  • Cache responses when appropriate (IBAN numbers don't change frequently)
  • Monitor your request rate
  • Batch requests when possible

Rate Limit Headers:

The API may include rate limit information in response headers:

  • X-RateLimit-Limit: Maximum number of requests allowed
  • X-RateLimit-Remaining: Number of requests remaining
  • X-RateLimit-Reset: Time when the rate limit resets

Best Practices

Best Practices

To ensure optimal usage of this API:

  • Validate inputs client-side: Validate deposit number format and bank_id before sending requests
  • Handle errors gracefully: Always check the response status and handle errors appropriately
  • Store request references: Save the request_ref for tracking and support purposes
  • Monitor your balance: Keep track of your wallet balance to avoid 402 errors (minimum 10,000 Rials per request)
  • Use HTTPS: Always use HTTPS in production to protect sensitive financial data
  • Implement retry logic: For transient errors (5xx), implement retry logic with exponential backoff
  • Cache IBAN results: IBAN numbers don't change, so cache successful responses to reduce API calls
  • Verify bank_id: Ensure you're using the correct bank_id for the deposit account
  • Handle deposit format: Accept both formats (with/without dashes) but normalize before sending

Security Considerations:

  • Never expose your authentication token in client-side code
  • Rotate tokens regularly
  • Use IP whitelisting if available
  • Monitor for suspicious activity
  • Log all API calls for audit purposes

Performance Tips:

  • Cache successful IBAN conversions (they don't change)
  • Implement connection pooling for high-volume applications
  • Use async/await patterns where possible
  • Monitor response times and optimize accordingly

IBAN Format

IBAN Format

The IBAN (International Bank Account Number) returned by this API follows the Iranian IBAN standard:

  • Format: IR + 24 digits
  • Total Length: 26 characters
  • Structure: IR + Check Digits (2) + Bank Code (3) + Account Number (19)

Example:

IR110590011981302295556001

Breaking down the example:

  • IR: Country code for Iran
  • 11: Check digits
  • 059: Bank code (Sina Bank)
  • 0011981302295556001: Account number

Validation:

You can validate IBAN numbers using standard IBAN validation algorithms. The API ensures that all returned IBANs are valid according to Iranian banking standards.

Usage:

IBAN numbers are used for:

  • International money transfers
  • Domestic bank transfers
  • Payment gateway integrations
  • Account verification

Pricing

Pricing

Each successful API call deducts credits from your wallet:

  • Cost per request: 10,000 Rials
  • Charged only on success: If the request fails (4xx errors), no credits are deducted
  • Minimum balance: You need at least 10,000 Rials in your wallet to make a request

When credits are deducted:

  • Credits are deducted only after a successful response from Sepal Yar
  • If the service returns an error, no credits are deducted
  • If validation fails before calling the service, no credits are deducted

Request Reference:

Each successful request generates a unique request_ref that can be used for:

  • Tracking and auditing
  • Support requests
  • Billing reconciliation

Wallet Management:

You can check your wallet balance and transaction history through the wallet API endpoints.

پارامترهای درخواست

پارامتر نوع اجباری توضیحات مثال
deposit String اجباری Deposit account number. Can include dashes (e.g., '119-813-2295556-1') or be plain digits. Spaces and dashes will be preserved in the URL but validated as digits only. Minimum 6 digits required.
اعتبارسنجی: Must contain only digits and dashes. Minimum 6 digits when dashes are removed. Spaces will be automatically removed.
119-813-2295556-1
bank_id String اجباری Bank identifier code. Must be one of the supported bank codes (e.g., SINAIR, MELIIR, BKMTIR, etc.). This is used to identify which bank the deposit account belongs to.
اعتبارسنجی: Must be one of the predefined bank codes. See the bank enum list for all available options.
SINAIR

مثال‌های کد

Python Example

Example using Python requests library

import requests
import json

url = "https://inquiry.sepal.ir/api/services/deposit-to-iban/"
headers = {
    "Authorization": "Token YOUR_AUTH_TOKEN",
    "X-Unique-Code": "YOUR_UNIQUE_CODE",
    "Content-Type": "application/json"
}
data = {
    "deposit": "119-813-2295556-1",
    "bank_id": "SINAIR"
}

response = requests.post(url, json=data, headers=headers)
result = response.json()

if result.get("success"):
    print(f"IBAN: {result['response_data']['iban_number']}")
    print(f"Request Ref: {result['request_ref']}")
else:
    print(f"Error: {result.get('error', {}).get('message', 'Unknown error')}")
JavaScript Example

Example using JavaScript fetch API

// Using fetch API
const url = 'https://inquiry.sepal.ir/api/services/deposit-to-iban/';
const data = {
    deposit: '119-813-2295556-1',
    bank_id: 'SINAIR'
};

fetch(url, {
    method: 'POST',
    headers: {
        'Authorization': 'Token YOUR_AUTH_TOKEN',
        'X-Unique-Code': 'YOUR_UNIQUE_CODE',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
    if (result.success) {
        console.log('IBAN:', result.response_data.iban_number);
        console.log('Request Ref:', result.request_ref);
    } else {
        console.error('Error:', result.error.message);
    }
})
.catch(error => console.error('Request failed:', error));
C# Example

Example using C# HttpClient

using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Token YOUR_AUTH_TOKEN");
        client.DefaultRequestHeaders.Add("X-Unique-Code", "YOUR_UNIQUE_CODE");
        
        var data = new
        {
            deposit = "119-813-2295556-1",
            bank_id = "SINAIR"
        };
        
        var json = JsonSerializer.Serialize(data);
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        
        var response = await client.PostAsync(
            "https://inquiry.sepal.ir/api/services/deposit-to-iban/",
            content
        );
        
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}
PHP Example

Example using PHP cURL

<?php

$url = "https://inquiry.sepal.ir/api/services/deposit-to-iban/";
$data = [
    "deposit" => "119-813-2295556-1",
    "bank_id" => "SINAIR"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Token YOUR_AUTH_TOKEN",
    "X-Unique-Code: YOUR_UNIQUE_CODE",
    "Content-Type: application/json"
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($result['success']) {
    echo "IBAN: " . $result['response_data']['iban_number'] . "\n";
    echo "Request Ref: " . $result['request_ref'] . "\n";
} else {
    echo "Error: " . $result['error']['message'] . "\n";
}
?>
cURL Example

Example using cURL command line

curl --location 'https://inquiry.sepal.ir/api/services/deposit-to-iban/' \
  --header 'Authorization: Token YOUR_AUTH_TOKEN' \
  --header 'X-Unique-Code: YOUR_UNIQUE_CODE' \
  --header 'Content-Type: application/json' \
  --data '{
    "deposit": "119-813-2295556-1",
    "bank_id": "SINAIR"
  }'

فرمت پاسخ

200
پاسخ موفق

Successful response when the deposit account number is successfully converted to IBAN.

ساختار پاسخ:
{
  "amount": "integer",
  "success": "boolean",
  "request_ref": "string",
  "error_message": "null",
  "response_data": {
    "ref_id": "string",
    "iban_number": "string",
    "operation_time": "integer"
  },
  "response_time_ms": "integer"
}
مثال پاسخ:
{
  "amount": 10000,
  "success": true,
  "request_ref": "NT2YSIL8MUSDNBUYOVEWFALMKP7ZMXZP",
  "error_message": null,
  "response_data": {
    "ref_id": "936d16cb-9b23-47e4-8445-bf9ad3a1907c",
    "iban_number": "IR110590011981302295556001",
    "operation_time": 1763203972118
  },
  "response_time_ms": 1728
}
401
خطا

Unauthorized - Authentication token is missing or invalid.

ساختار پاسخ:
{
  "error": {
    "code": "string (optional)",
    "errors": "list (optional)",
    "details": "object (optional)",
    "message": "string"
  },
  "success": "boolean"
}
مثال پاسخ:
{
  "error": {
    "code": "AUTHENTICATION_ERROR",
    "message": "Authentication credentials were not provided."
  },
  "success": false
}
402
خطا

Payment Required - Insufficient wallet balance.

ساختار پاسخ:
{
  "error": {
    "code": "string (optional)",
    "errors": "list (optional)",
    "details": "object (optional)",
    "message": "string"
  },
  "success": "boolean"
}
مثال پاسخ:
{
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "موجودی کیف پول کافی نیست."
  },
  "success": false
}
404
خطا

Not Found - Deposit account number not found or invalid (returned from Sepal Yar).

ساختار پاسخ:
{
  "error": {
    "code": "string (optional)",
    "errors": "list (optional)",
    "details": "object (optional)",
    "message": "string"
  },
  "success": "boolean"
}
مثال پاسخ:
{
  "error": {
    "code": "032",
    "errors": [
      {
        "code": "032",
        "message": "شماره سپرده معتبر نمی باشد"
      }
    ],
    "message": "شماره سپرده معتبر نمی باشد"
  },
  "success": false
}
400
خطا

Sepal Yar validation error (returned as-is).

ساختار پاسخ:
{
  "error": {
    "code": "string (optional)",
    "errors": "list (optional)",
    "details": "object (optional)",
    "message": "string"
  },
  "success": "boolean"
}
مثال پاسخ:
{
  "error": {
    "errors": [
      {
        "code": "1002",
        "message": "ارسال شناسه بانک در header اجباری می باشد",
        "reference": "BANK-ID"
      }
    ],
    "ref_id": "74e0eafc-3d3f-4d0d-8af5-798cb2b50891",
    "operation_time": 1763203768922
  },
  "success": false
}