eSIM API – Complete API Reference

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

/auth/register

Create a new user account (mobile_user, reseller, or developer).

Password Requirements:
  • 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

ParameterTypeRequiredDescription
emailstringRequiredUser email address (must be unique)
passwordstringRequiredSecure password with mixed case, numbers, and special characters
rolestringRequiredUser account type: mobile_user, reseller, or developer
namestringOptionalOptional 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

/auth/login

Authenticate with email and password to obtain access and refresh tokens.

Account Lockout: After 5 failed login attempts, account is locked for 15 minutes.

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

/auth/verify-email

Verify user email using verification token sent to email.

Request Body

{
  "email": "user@example.com",
  "verification_token": "token-from-email"
}

POST Resend Verification Email

/auth/verification-resend

Send a new verification link to the user’s email.

Request Body

{
  "email": "user@example.com"
}

POST Refresh Access Token

/auth/refresh-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

/auth/forgot-password

Send password reset email.

Request Body

{
  "email": "user@example.com"
}

POST Reset Password with Token

/auth/reset-password

Reset password using token from email.

Request Body

{
  "reset_token": "token-from-email",
  "new_password": "NewSecurePassword123!"
}

POST Logout User πŸ”’ Auth Required

/auth/logout

Invalidate user session and tokens.

User Profile

Manage user profiles and account information.

GET Get Current User Profile πŸ”’ Auth Required

/users/me

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

/users/me/password

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

/plans

Get available eSIM plans with filtering and pagination. Resellers see plans with their custom markup applied. Russia plans are excluded.

Query Parameters

ParameterTypeDescription
countrystringISO country code (e.g., “US”, “GB”)
country_namestringCountry name (e.g., “United States”)
regionstringRegion code for regional plans
providerstringProvider ID to filter by specific provider
searchstringSearch term (searches name, description, region_code)
pageintegerPage number for pagination (default: 1)
limitintegerResults per page (default: 20, max: 100)

GET Get Specific Plan Details πŸ”’ Auth Required

/plans/{plan_id}

Retrieve details for a specific eSIM plan by ID.

GET Get Regional Plans πŸ”’ Auth Required

/plans/regional/{region_code}

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

/orders

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

ParameterTypeRequiredDescription
plan_idstringRequiredID of the eSIM plan to order
quantityintegerOptionalNumber of eSIMs to order (default: 1)
provider_idstringOptionalOptional provider ID (defaults to plan’s provider)
reseller_profile_idstringOptionalOptional reseller profile ID for branding
end_customer_emailstringRequiredCustomer email for QR code delivery
customer_namestringRequiredCustomer 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

/orders

Get paginated list of user’s orders with optional filtering.

Query Parameters

ParameterTypeDescription
statusstringFilter by order status: pending, active, completed, cancelled, expired
pageintegerPage number (default: 1)
limitintegerResults per page (default: 20)

GET Get Order Details πŸ”’ Auth Required

/orders/{order_id}

Retrieve details for a specific order.

PUT Update Order πŸ”’ Auth Required

/orders/{order_id}

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

/orders/{order_id}

Cancel or delete an order.

eSIM Profile Management

Manage eSIM profiles including suspension, revocation, top-ups, and SMS.

GET Get Profile Information πŸ”’ Auth Required

/profiles/{identifier}

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

/profiles/{esimTranNo}/usage

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

/profiles/{identifier}/suspend

Suspend an active eSIM profile.

Response (200 OK)

{
  "success": true,
  "message": "Profile suspended successfully"
}

POST Unsuspend Profile πŸ”’ Auth Required

/profiles/{identifier}/unsuspend

Restore a suspended eSIM profile.

Response (200 OK)

{
  "success": true,
  "message": "Profile unsuspended successfully"
}

POST Revoke Profile πŸ”’ Auth Required

/profiles/{identifier}/revoke

Permanently revoke an eSIM profile.

Response (200 OK)

{
  "success": true,
  "message": "Profile revoked successfully"
}

POST Top Up Profile πŸ”’ Auth Required

/profiles/{identifier}/topup

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

/profiles/{identifier}/topup-plans

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

/profiles/{identifier}/sms

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

/credits/balance

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

/credits/transactions

Retrieve credit transactions with filtering by type, status, and date range.

Query Parameters

ParameterTypeDescription
typestringFilter by transaction type: topup, order, refund, adjustment
statusstringFilter by status: completed, pending, failed
searchstringSearch in description
start_datestringStart date (ISO format)
end_datestringEnd date (ISO format)
pageintegerPage number (default: 1)
limitintegerResults per page (default: 20)

POST Top Up Credits via PayPal πŸ”’ Auth Required

/credits/topup

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

/payment/create-paypal-order

Create a PayPal order for payment.

Request Body

{
  "amount": 500.00,
  "currency": "USD",
  "orderId": "ord-abc123"
}

POST Capture PayPal Payment πŸ”’ Auth Required

/payment/capture-paypal-order

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

/deposit/initiate

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

/deposit/confirm

Confirm and process initial deposit payment.

Request Body

{
  "paypal_order_id": "paypal-order-deposit-123"
}

GET Check Initial Deposit Status πŸ”’ Auth Required

/deposit/status

Check if initial deposit has been made and view current balance.

Reseller

Manage reseller profiles and pricing settings.

GET Get Reseller Dashboard πŸ”’ Auth Required

/dashboard

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

/reseller/profile

Retrieve all reseller branding profiles.

POST Create Reseller Profile πŸ”’ Auth Required

/reseller/profile

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

/reseller/profile/{id}

Update an existing reseller profile.

DELETE Delete Reseller Profile πŸ”’ Auth Required

/reseller/profile/{id}

Delete a reseller profile.

GET Get SMTP Configuration πŸ”’ Auth Required

/reseller/profile/{id}/smtp

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

/reseller/profile/{id}/smtp

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

/reseller/profile/{id}/smtp/test

Test the SMTP connection for a reseller profile.

Response (200 OK)

{
  "success": true,
  "message": "SMTP connection test successful"
}

DELETE Disable Custom SMTP πŸ”’ Auth Required

/reseller/profile/{id}/smtp

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

/reseller/pricing

Retrieve custom pricing overrides for plans.

PUT Update Plan Pricing πŸ”’ Auth Required

/reseller/pricing/{plan_id}

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

/usage/balance/{provider_id}

Get balance with timestamp for specific provider.

POST Check Usage for eSIMs πŸ”’ Auth Required

/usage/check

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

/usage/order/{order_id}

Get data usage for a specific order.

Query Parameters

ParameterTypeDescription
refreshCachebooleanForce 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

/webhook-subscriptions

Get user’s webhook subscriptions with available event types.

Query Parameters

ParameterTypeDescription
statusstringFilter by status: active, inactive, failed
pageintegerPage number (default: 1)
limitintegerResults per page (default: 20)

POST Create Webhook Subscription πŸ”’ Auth Required

/webhook-subscriptions

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

/webhook-subscriptions/{id}

Retrieve details for a specific webhook subscription.

PUT Update Webhook Subscription πŸ”’ Auth Required

/webhook-subscriptions/{id}

Update webhook subscription settings.

DELETE Delete Webhook Subscription πŸ”’ Auth Required

/webhook-subscriptions/{id}

Delete a webhook subscription.

POST Send Test Webhook πŸ”’ Auth Required

/webhook-subscriptions/{id}/test

Send a test webhook to the endpoint.

GET Get Webhook Delivery Logs πŸ”’ Auth Required

/webhook-subscriptions/{id}/logs

Get webhook delivery history for a subscription.

Query Parameters

ParameterTypeDescription
statusstringFilter by status: success, failed, pending
pageintegerPage number (default: 1)
limitintegerResults per page (default: 20)

Health & Utility

System health and utility endpoints.

GET Health Check

/health

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

/uploads/logo

Upload a reseller logo file (PNG/JPEG, max 5MB).

File Requirements:
  • 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