eSIM API Documentation
Complete REST API for managing eSIM orders, credits, and user accounts
Base URLs
Development: http://localhost:3000/api/v1
Production: https://api.example.com/api/v1
Authentication: All authenticated endpoints require a JWT Bearer token in the Authorization header:
Authorization: Bearer {access_token}Rate Limiting:
- Login/Registration: 5 attempts per IP per 15 minutes
- Password reset: 3 attempts per email per hour
- Other endpoints: 1000 requests per user per hour
Authentication
Manage user authentication, registration, and session management.
POST Register New User
Create a new user account (mobile_user, reseller, or developer).
- Minimum 8 characters
- At least one uppercase letter, lowercase letter, number, and special character
- For resellers/developers: checked against breach database
Request Body
{
"email": "user@example.com",
"password": "SecurePassword123!",
"role": "reseller",
"name": "My Business"
}Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Required | User email address (must be unique) | |
| password | string | Required | Secure password with mixed case, numbers, and special characters |
| role | string | Required | User account type: mobile_user, reseller, or developer |
| name | string | Optional | Optional business name (for resellers) |
Response (201 Created)
{
"success": true,
"message": "Registration successful. Please verify your email.",
"user": {
"id": "user-123",
"email": "user@example.com",
"role": "reseller",
"verified_at": null,
"profile_complete": false,
"initial_deposit_made": false
},
"verification_token_status": "sent"
}POST User Login
Authenticate with email and password to obtain access and refresh tokens.
Request Body
{
"email": "user@example.com",
"password": "SecurePassword123!"
}Response (200 OK)
{
"success": true,
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "user-123",
"email": "user@example.com",
"role": "reseller"
},
"token_expires_in": 3600
}POST Verify Email Address
Verify user email using verification token sent to email.
Request Body
{
"email": "user@example.com",
"verification_token": "token-from-email"
}POST Resend Verification Email
Send a new verification link to the user’s email.
Request Body
{
"email": "user@example.com"
}POST Refresh Access Token
Exchange a valid refresh token for a new access token.
Request Body
{
"refresh_token": "eyJhbGciOiJIUzI1NiIs..."
}Response (200 OK)
{
"success": true,
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"token_expires_in": 3600
}POST Request Password Reset
Send password reset email.
Request Body
{
"email": "user@example.com"
}POST Reset Password with Token
Reset password using token from email.
Request Body
{
"reset_token": "token-from-email",
"new_password": "NewSecurePassword123!"
}POST Logout User π Auth Required
Invalidate user session and tokens.
User Profile
Manage user profiles and account information.
GET Get Current User Profile π Auth Required
Fetch authenticated user’s profile with role-specific data. For resellers/developers: includes credit account info. For resellers: includes reseller profiles list.
Response (200 OK)
{
"success": true,
"data": {
"id": "user-123",
"email": "user@example.com",
"role": "reseller",
"verified_at": "2025-01-15T10:00:00Z",
"profile_complete": true,
"initial_deposit_made": true,
"created_at": "2025-01-15T10:00:00Z"
}
}PUT Change User Password π Auth Required
Update password with validation of old password.
Request Body
{
"old_password": "OldPassword123!",
"new_password": "NewPassword123!",
"confirm_password": "NewPassword123!"
}Plans
Browse and manage available eSIM data plans.
GET List Available eSIM Plans π Auth Required
Get available eSIM plans with filtering and pagination. Resellers see plans with their custom markup applied. Russia plans are excluded.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| country | string | ISO country code (e.g., “US”, “GB”) |
| country_name | string | Country name (e.g., “United States”) |
| region | string | Region code for regional plans |
| provider | string | Provider ID to filter by specific provider |
| search | string | Search term (searches name, description, region_code) |
| page | integer | Page number for pagination (default: 1) |
| limit | integer | Results per page (default: 20, max: 100) |
GET Get Specific Plan Details π Auth Required
Retrieve details for a specific eSIM plan by ID.
GET Get Regional Plans π Auth Required
Get all plans for a specific region (e.g., “EU”, “NA”, “ASIA”).
Orders
Create and manage eSIM orders.
POST Create New eSIM Order π Auth Required
Create a new eSIM order. For Resellers: Must have completed onboarding, must have sufficient credit balance, order total is deducted from credit account, applies custom pricing markups if configured.
Request Body
{
"plan_id": "plan-123",
"quantity": 1,
"provider_id": "provider-1",
"reseller_profile_id": "profile-1",
"end_customer_email": "customer@example.com",
"customer_name": "John Customer"
}Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| plan_id | string | Required | ID of the eSIM plan to order |
| quantity | integer | Optional | Number of eSIMs to order (default: 1) |
| provider_id | string | Optional | Optional provider ID (defaults to plan’s provider) |
| reseller_profile_id | string | Optional | Optional reseller profile ID for branding |
| end_customer_email | string | Required | Customer email for QR code delivery |
| customer_name | string | Required | Customer name for order |
Response (201 Created)
{
"success": true,
"message": "Order created successfully",
"order": {
"id": "ord-abc123def456",
"user_id": "user-123",
"plan_id": "plan-123",
"plan_name": "5GB - USA",
"quantity": 1,
"unit_price": 15.00,
"total_amount": 15.00,
"currency": "USD",
"status": "active",
"iccid": "8901234567890123456",
"qr_code_url": "https://api.example.com/qr/order-123.png"
}
}GET List User’s Orders π Auth Required
Get paginated list of user’s orders with optional filtering.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | Filter by order status: pending, active, completed, cancelled, expired |
| page | integer | Page number (default: 1) |
| limit | integer | Results per page (default: 20) |
GET Get Order Details π Auth Required
Retrieve details for a specific order.
PUT Update Order π Auth Required
Update order details (status, customer info, etc.).
Request Body
{
"status": "completed",
"customer_email": "updated@example.com",
"customer_name": "Updated Name"
}DELETE Cancel Order π Auth Required
Cancel or delete an order.
eSIM Profile Management
Manage eSIM profiles including suspension, revocation, top-ups, and SMS.
GET Get Profile Information π Auth Required
Get eSIM profile information by ICCID, esimTranNo, or order_id.
Path Parameters
{
"identifier": "89012345678901234567" // ICCID, esimTranNo, or order_id
}Response (200 OK)
{
"success": true,
"profile": {
"iccid": "89012345678901234567",
"status": "active",
"data_remaining": 4500,
"validity_days": 28
}
}GET Get Profile Usage π Auth Required
Check usage data for an eSIM profile.
Response (200 OK)
{
"success": true,
"usage": {
"data_used": 500,
"data_limit": 5000,
"percent_used": 10
}
}POST Suspend Profile π Auth Required
Suspend an active eSIM profile.
Response (200 OK)
{
"success": true,
"message": "Profile suspended successfully"
}POST Unsuspend Profile π Auth Required
Restore a suspended eSIM profile.
Response (200 OK)
{
"success": true,
"message": "Profile unsuspended successfully"
}POST Revoke Profile π Auth Required
Permanently revoke an eSIM profile.
Response (200 OK)
{
"success": true,
"message": "Profile revoked successfully"
}POST Top Up Profile π Auth Required
Add data to an existing eSIM profile.
Request Body
{
"package_code": "PKG_5GB_30D"
}Response (200 OK)
{
"success": true,
"message": "Profile topped up successfully",
"topup_details": {}
}GET Get Available Topup Plans π Auth Required
Retrieve available topup plans for a profile.
Response (200 OK)
{
"success": true,
"plans": [
{
"package_code": "PKG_5GB_30D",
"data_volume_mb": 5120,
"price": 15.00,
"validity_days": 30
}
]
}POST Send SMS to Profile π Auth Required
Send an SMS message to an eSIM profile.
Request Body
{
"message": "Your eSIM has been activated"
}Response (200 OK)
{
"success": true,
"message": "SMS sent successfully"
}Credits & Billing
Manage credit balance and view transactions.
GET Get Current Credit Balance π Auth Required
Retrieve current credit balance for reseller/developer. Response differs by billing mode: Prepaid shows balance, soft_limit_threshold, current_usage. Postpaid shows credit_limit, current_usage, available_credit.
Response (200 OK)
{
"success": true,
"balance": 1500.00,
"currency": "USD",
"billing_mode": "prepaid",
"soft_limit_threshold": 100.00,
"current_usage": 50.00,
"available_credit": 1450.00
}GET Get Credit Transaction History π Auth Required
Retrieve credit transactions with filtering by type, status, and date range.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| type | string | Filter by transaction type: topup, order, refund, adjustment |
| status | string | Filter by status: completed, pending, failed |
| search | string | Search in description |
| start_date | string | Start date (ISO format) |
| end_date | string | End date (ISO format) |
| page | integer | Page number (default: 1) |
| limit | integer | Results per page (default: 20) |
POST Top Up Credits via PayPal π Auth Required
Initiate credit top-up for prepaid mode. Requirements: Prepaid billing mode only, initial deposit must be completed.
Request Body
{
"amount": 500.00,
"currency": "USD"
}Response (200 OK)
{
"success": true,
"message": "PayPal order created",
"paypal_order": {
"id": "paypal-order-123",
"amount": 500.00,
"currency": "USD",
"approval_link": "https://sandbox.paypal.com/checkoutnow?token=...",
"status": "CREATED"
}
}Payments
Process payments via PayPal.
POST Create PayPal Order π Auth Required
Create a PayPal order for payment.
Request Body
{
"amount": 500.00,
"currency": "USD",
"orderId": "ord-abc123"
}POST Capture PayPal Payment π Auth Required
Capture PayPal payment and credit account. Accepts multiple field names: orderID, orderId, order_id, or paypal_order_id.
Request Body
{
"orderID": "paypal-order-123"
}Response (200 OK)
{
"success": true,
"transaction": {
"id": "txn-125",
"amount": 500.00,
"status": "completed",
"new_balance": 2000.00
}
}Deposit & Onboarding
Manage initial deposit for reseller onboarding.
POST Initiate Initial Deposit π Auth Required
Start the initial deposit process for resellers. Requirements: First-time deposit only, Minimum: $50, Maximum: $50,000.
Request Body
{
"amount": 100.00,
"currency": "USD",
"return_url": "https://yoursite.com/success",
"cancel_url": "https://yoursite.com/cancel",
"payment_method": "paypal_redirect"
}POST Confirm Initial Deposit π Auth Required
Confirm and process initial deposit payment.
Request Body
{
"paypal_order_id": "paypal-order-deposit-123"
}GET Check Initial Deposit Status π Auth Required
Check if initial deposit has been made and view current balance.
Reseller
Manage reseller profiles and pricing settings.
GET Get Reseller Dashboard π Auth Required
Retrieve dashboard data including account balance, pending invoices, recent orders, and transactions.
Response (200 OK)
{
"success": true,
"data": {
"account": {
"balance": 1500.00,
"billing_mode": "prepaid",
"currency": "USD",
"credit_limit": 5000.00,
"current_usage": 250.00
},
"pending_invoices": [],
"recent_orders": [],
"recent_transactions": []
}
}GET Get Reseller Profiles π Auth Required
Retrieve all reseller branding profiles.
POST Create Reseller Profile π Auth Required
Create a new branding profile for reseller.
Request Body
{
"name": "My eSIM Store",
"email_sender_name": "My Store",
"is_default": true,
"color_scheme": "#FF5733"
}PUT Update Reseller Profile π Auth Required
Update an existing reseller profile.
DELETE Delete Reseller Profile π Auth Required
Delete a reseller profile.
GET Get SMTP Configuration π Auth Required
Retrieve SMTP configuration for a reseller profile. Password is never returned, only a flag indicating if it’s configured.
Response (200 OK)
{
"success": true,
"smtp_config": {
"smtp_host": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "noreply@example.com",
"smtp_secure": true,
"email_from": "noreply@example.com",
"email_from_name": "My eSIM Store",
"use_custom_smtp": true,
"smtp_pass_configured": true
}
}PUT Update SMTP Configuration π Auth Required
Update or configure custom SMTP settings for a reseller profile. Password is encrypted using AES-256-CBC. Connection is tested automatically after update.
Request Body
{
"smtp_host": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "noreply@example.com",
"smtp_pass": "yourpassword",
"smtp_secure": true,
"email_from": "noreply@example.com",
"email_from_name": "My eSIM Store",
"use_custom_smtp": true
}Response (200 OK)
{
"success": true,
"message": "SMTP configuration updated and tested successfully",
"smtp_config": {
"smtp_host": "smtp.gmail.com",
"smtp_port": 587,
"smtp_user": "noreply@example.com",
"use_custom_smtp": true
}
}POST Test SMTP Configuration π Auth Required
Test the SMTP connection for a reseller profile.
Response (200 OK)
{
"success": true,
"message": "SMTP connection test successful"
}DELETE Disable Custom SMTP π Auth Required
Disable custom SMTP configuration and clear all SMTP data. Emails will be sent using default system SMTP.
Response (200 OK)
{
"success": true,
"message": "Custom SMTP disabled successfully"
}GET Get Reseller Pricing Overrides π Auth Required
Retrieve custom pricing overrides for plans.
PUT Update Plan Pricing π Auth Required
Set custom pricing for a plan (markup % or fixed price).
Request Body
{
"markup_percent": 20
}OR
{
"final_price_usd": 18.00
}Usage & Tracking
Monitor data usage for eSIM orders.
GET Get Enhanced Balance π Auth Required
Get balance with timestamp for specific provider.
POST Check Usage for eSIMs π Auth Required
Get data usage for specific eSIMs or orders.
Request Body
{
"provider_id": "provider-1",
"esimTranNoList": ["esim-tran-123", "esim-tran-124"]
}GET Get Order Usage π Auth Required
Get data usage for a specific order.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| refreshCache | boolean | Force refresh from provider (default: false) |
Response (200 OK)
{
"success": true,
"order_id": "ord-abc123",
"usage": {
"data_used": "1.2GB",
"data_total": "5GB",
"data_remaining": "3.8GB",
"percentage_used": 24.0,
"validity_remaining_days": 25
}
}Webhooks
Manage webhook subscriptions for real-time notifications.
GET List Webhook Subscriptions π Auth Required
Get user’s webhook subscriptions with available event types.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | Filter by status: active, inactive, failed |
| page | integer | Page number (default: 1) |
| limit | integer | Results per page (default: 20) |
POST Create Webhook Subscription π Auth Required
Create a new webhook subscription with automatic test.
Request Body
{
"name": "Order Status Updates",
"endpoint_url": "https://yourapp.com/webhooks/orders",
"event_types": ["ORDER_STATUS", "ESIM_STATUS"],
"secret": "your-webhook-secret",
"timeout_seconds": 30,
"retry_count": 3
}GET Get Webhook Subscription π Auth Required
Retrieve details for a specific webhook subscription.
PUT Update Webhook Subscription π Auth Required
Update webhook subscription settings.
DELETE Delete Webhook Subscription π Auth Required
Delete a webhook subscription.
POST Send Test Webhook π Auth Required
Send a test webhook to the endpoint.
GET Get Webhook Delivery Logs π Auth Required
Get webhook delivery history for a subscription.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| status | string | Filter by status: success, failed, pending |
| page | integer | Page number (default: 1) |
| limit | integer | Results per page (default: 20) |
Health & Utility
System health and utility endpoints.
GET Health Check
Check API and service health status.
Response (200 OK)
{
"status": "healthy",
"timestamp": "2025-01-15T10:00:00Z",
"services": {
"database": "connected",
"redis": "connected"
}
}POST Upload Reseller Logo π Auth Required
Upload a reseller logo file (PNG/JPEG, max 5MB).
- Maximum file size: 5MB
- Supported formats: PNG, JPG, JPEG, GIF
- Recommended dimensions: 200x200px minimum
Request
Form data with file upload:
Content-Type: multipart/form-data logo: [binary file data]
Β© 2025 eSIM API. All rights reserved.
API Version: v1.0.0 | Last Updated: January 2025
