This API endpoint allows you to verify if a mobile number matches a given national code. The service requires authentication and deducts credits from your wallet upon successful verification.
POST/api/services/mobile-national-code-match/
نیاز به احراز هویت
Token
100 requests/minute
مستندات
Overview
Overview
The Mobile National Code Match API allows you to verify if a mobile number matches a given Iranian national code. This service is useful for identity verification and fraud prevention.
When you make a successful API call, the service will:
Verify the mobile number format
Verify the national code format
Check if they match
Deduct credits from your wallet
Return a unique request reference number
Authentication
Authentication
This API requires authentication using a Token-based authentication system.
How to authenticate:
Obtain your API token from the admin panel
Include the token in the Authorization header
Format: Authorization: Token YOUR_AUTH_TOKEN
Example:
Authorization: Token abc123def456ghi789
If authentication fails, you will receive a 401 Unauthorized response.
Request Format
Request Format
All requests must be sent as POST requests with JSON payload.
Required Headers:
Authorization: Token YOUR_AUTH_TOKEN
Content-Type: application/json
Request Body:
The request body must be a JSON object containing:
mobile (string, required): Mobile number in Iranian format (09...) or international format (+98 or 0098)
national_code (string, required): Iranian national code (10 digits)
When the request is successful, you will receive a response containing:
success: Boolean indicating success
request_ref: Unique reference number for this request
amount: Amount deducted from your wallet (in Rials)
response_data: The actual response data from the service
response_time_ms: Response time in milliseconds
error_message: null for successful requests
Error Response:
When an error occurs, you will receive a response containing:
success: false
error: Object containing error details
code: Error code
message: Error message
details: Additional error details (optional)
Error Handling
Error Handling
The API uses standard HTTP status codes to indicate success or failure:
200 OK: Request successful
400 Bad Request: Invalid parameters provided
401 Unauthorized: Authentication failed or missing
402 Payment Required: Insufficient wallet balance
500 Internal Server Error: Server encountered an error
Common Error Codes:
INVALID_PARAMETERS: One or more parameters are invalid
AUTHENTICATION_ERROR: Authentication token is missing or invalid
INSUFFICIENT_BALANCE: Not enough credits in wallet
SERVICE_ERROR: Service encountered an internal error
SERVICE_NOT_FOUND: Service not found or inactive
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
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
Monitor your request rate
Best Practices
Best Practices
To ensure optimal usage of this API:
Validate inputs client-side: Validate mobile and national code formats 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
Use HTTPS: Always use HTTPS in production to protect sensitive data
Implement retry logic: For transient errors (5xx), implement retry logic with exponential backoff
پارامترهای درخواست
پارامتر
نوع
اجباری
توضیحات
مثال
mobile
String
اجباری
Mobile number in Iranian format (starting with 09) or international format (+98 or 0098). Spaces and dashes will be automatically removed.
اعتبارسنجی: Must start with 09, +98, or 0098. Max length: 20 characters.
09123456789
national_code
String
اجباری
Iranian national code (10 digits). Must contain only digits.
اعتبارسنجی: Must be exactly 10 digits. Only numeric characters allowed.
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");
var data = new
{
mobile = "09123456789",
national_code = "1234567890"
};
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/mobile-national-code-match/",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}