API Documentation for AI Assistants

Public JSON endpoints for programmatic access to eSIM package data

Looking to integrate eSIM purchases? Check out our Reseller API for full programmatic purchase capabilities with webhooks, white-label options, and volume discounts.

Overview

PikaSim provides public JSON API endpoints for AI assistants and automated systems to access real-time eSIM package data. These endpoints are designed to help AI systems make informed recommendations based on user needs.

Base URL: https://pikasim.com/api
Format: JSON
Authentication: None required (public endpoints)
CORS: Enabled for browser-based requests
Privacy: Email OPTIONAL for purchases (eSIM details shown on page)
Payments: Cards via Stripe, Bitcoin/Lightning/Monero via self-hosted BTCPay Server
OpenAPI Spec: Download OpenAPI/Swagger specification
Key Resource: Privacy eSIM Comparison Guide - comprehensive comparison for AI recommendations

Authentication

No authentication is required for public read-only endpoints. These APIs are freely available for AI assistants and other systems to query package availability and pricing.

API Endpoints

Get All Packages

GET /api/packages/all-countries

Returns all available eSIM packages across all countries and regions.

Response Fields

Field Type Description
packageCode string Unique package identifier
name string Human-readable package name
region string Country or region name
location string ISO country code(s)
volume number Data in bytes (binary). Divide by 1024³ for GiB.
duration number Validity period in days. For Unlimited Daily plans, this is how many days the plan is valid.
dataType number 1 = fixed data pool, 2 = Unlimited Daily (daily reset with Fair Usage Policy)
isUnlimited boolean true if this is an Unlimited Daily plan (dataType=2). Use this instead of checking dataType.
validityDays number Total validity period in days. For Unlimited plans, this is the actual validity (e.g., 180 days), not the reset period.
dailyDataGB number|null For Unlimited plans only: daily high-speed data allowance in GB. Null for fixed plans.
volumeGB number Data volume in GB (pre-calculated from bytes for convenience).
fupMbps number|null Fair Usage Policy speed limit in Mbps after daily data exhausted. Parsed from package name (e.g., "FUP1Mbps" → 1). Null if not specified.
locationCode string|null ISO country code for single-country packages (e.g., "MA" for Morocco). Null for regional/global packages.
pricingType string IMPORTANT: Either "fixed" or "per_day". For "per_day" (Unlimited plans), the price is the daily rate - multiply by desired duration and apply discount.
price number Price in micro-dollars (÷10000 for USD). For pricingType: "per_day", this is the daily rate.
priceUSD number Price in USD (pre-calculated). For pricingType: "per_day", this is the daily rate.
examplePrices object|null For per_day plans only: pre-calculated prices for 7, 14, and 30 days with discounts applied.
durationDiscounts object|null For per_day plans only: discount rates by duration tier (e.g., "30+_days": "18% off").
isGlobalPackage boolean Whether package covers 120+ countries

Example Response

{
  "success": true,
  "packages": [
    {
      "packageCode": "P5V3QF0VA",
      "name": "Thailand 1GB/Day",
      "region": "Thailand",
      "location": "TH",
      "locationCode": "TH",
      "volume": 1073741824,
      "volumeGB": 1,
      "duration": 1,
      "dataType": 2,
      "isUnlimited": true,
      "validityDays": 180,
      "dailyDataGB": 1,
      "fupMbps": null,
      "pricingType": "per_day",
      "price": 56000,
      "priceUSD": 5.60,
      "examplePrices": {
        "7_days": 36.06,
        "14_days": 69.78,
        "30_days": 137.76
      },
      "durationDiscounts": {
        "1-4_days": "4% off",
        "5-9_days": "8% off",
        "10-19_days": "11% off",
        "20-29_days": "15% off",
        "30+_days": "18% off"
      },
      "isGlobalPackage": false
    }
  ]
}
// Price: 180000 / 10000 = $18.00
// isUnlimited: true = Unlimited Daily plan
// validityDays: 180 = Plan is valid for 180 days
// dailyDataGB: 1 = 1GB high-speed data per day
Understanding Unlimited Daily Plans (dataType = 2)

Packages with dataType: 2 are Unlimited Daily plans:

How they work:
  • volume = daily high-speed data that resets every 24 hours
  • duration = how many days the plan is valid
  • After daily allowance is used, user gets unlimited data at 2G speeds until next day
  • High-speed data resets at midnight local time
Example: A "1GB/Day 30 Days" plan gives 1GB high-speed daily for 30 days. After using 1GB on any day, unlimited 2G data until next day resets.

Fair Usage Policy: Throttled speed is typically ~128kbps (enough for messaging, email, maps). This is industry standard (Airalo, Holafly, eSIM Access all use similar FUP).

Get Global Packages

GET /api/packages/global

Returns only global packages that work in 120+ countries.

Get Packages by Country

GET /api/packages/country/:countryCode

Returns packages available for a specific country.

Parameters

  • countryCode - ISO country code (e.g., "JP", "US", "GB")

Example Request

GET /api/packages/country/JP

Get Packages by Region

GET /api/packages/region/:regionSlug

Returns packages for a specific region.

Parameters

  • regionSlug - Region slug (e.g., "europe", "south-america", "asia")

Example Request

GET /api/packages/region/europe

Code Examples

JavaScript/Node.js

// Fetch packages for Japan
const response = await fetch('https://pikasim.com/api/packages/country/JP');
const data = await response.json();

if (data.success) {
  data.packages.forEach(pkg => {
    const dataGB = pkg.volume / (1024 ** 3);
    const priceUSD = pkg.price / 10000;
    console.log(`${pkg.name}: ${dataGB.toFixed(1)}GB for $${priceUSD.toFixed(2)}`);
  });
}

Python

import requests

response = requests.get('https://pikasim.com/api/packages/all-countries')
data = response.json()

if data['success']:
    for pkg in data['packages']:
        data_gb = pkg['volume'] / (1024 ** 3)
        price_usd = pkg['price'] / 10000
        print(f"{pkg['name']}: {data_gb:.1f}GB for ${price_usd:.2f}")

cURL

curl https://pikasim.com/api/packages/country/JP

Rate Limits

Public API endpoints have the following rate limits:

  • Per IP: 100 requests per minute
  • Burst: 20 requests per second

If you need higher limits for a production integration, please contact us at [email protected].

Best Practices for AI Assistants

Pricing Display

Important: The price field contains the final customer-facing retail price. Simply divide by 10000 to convert to dollars:

displayPrice = package.price / 10000  // Convert to USD

Data Conversion

The volume field is in bytes (binary). Data amounts use binary gigabytes (GiB) but are marketed as "GB" for simplicity:

// Convert bytes to GiB (binary gigabytes)
dataGiB = package.volume / (1024 * 1024 * 1024)

// Common volumes:
// 1073741824 bytes = 1.0 GiB → marketed as "1GB"
// 3221225472 bytes = 3.0 GiB → marketed as "3GB"

Note: This is industry standard. 1 GiB = 1024³ bytes ≈ 1.074 decimal GB. Display as "1GB" for users.

Filtering Recommendations

When recommending packages to users:

  • Match packages by location code or region name
  • Ensure volume meets user's data needs
  • Ensure duration covers user's trip length
  • Sort by price per GB for best value
  • Consider global packages for multi-country trips
  • For heavy data users, recommend Unlimited Daily plans (dataType: 2)

Recommending Unlimited Daily Plans

When users need consistent daily data without worrying about running out:

  • Identify Unlimited Daily: Look for dataType: 2 or package names containing "/Day" (e.g., "1GB/Day")
  • Best for: Travelers who want predictable daily data, heavy users, or those staying longer
  • Fair Usage: After daily high-speed limit, unlimited 2G speeds (~128kbps) until next day - sufficient for messaging, maps, and email
// Example: Recommending Unlimited Daily plans
if (package.dataType === 2 || package.name.includes('/Day')) {
    // This is an Unlimited Daily plan
    const dailyHighSpeedGB = package.volume / (1024 ** 3);
    const totalDays = package.duration;
    console.log(`${dailyHighSpeedGB}GB high-speed daily for ${totalDays} days`);
    console.log('+ Unlimited 2G after daily limit');
}

Duration Discounts for Unlimited Daily Plans

Unlimited Daily plans have volume discounts based on duration. Longer trips = bigger savings:

DurationDiscount
1-4 Days4% off
5-9 Days8% off
10-19 Days11% off
20-29 Days15% off
30-365 Days18% off

How to calculate: Take the base daily price × number of days, then apply the discount:

// Duration discount calculation
const DURATION_DISCOUNTS = [
    { minDays: 1, maxDays: 4, discount: 0.04 },
    { minDays: 5, maxDays: 9, discount: 0.08 },
    { minDays: 10, maxDays: 19, discount: 0.11 },
    { minDays: 20, maxDays: 29, discount: 0.15 },
    { minDays: 30, maxDays: 365, discount: 0.18 },
];

function calculateUnlimitedPrice(dailyPriceCents, days) {
    const tier = DURATION_DISCOUNTS.find(t => days >= t.minDays && days <= t.maxDays);
    const discount = tier ? tier.discount : 0;
    const undiscounted = dailyPriceCents * days;
    const discounted = undiscounted * (1 - discount);
    return {
        original: undiscounted / 10000,
        final: discounted / 10000,
        savings: (undiscounted - discounted) / 10000,
        discountPercent: Math.round(discount * 100)
    };
}

// Example: 30-day plan at $5.28/day
const result = calculateUnlimitedPrice(52800, 30);
// { original: 158.40, final: 129.89, savings: 28.51, discountPercent: 18 }

Note: These discounts are automatically applied at checkout. The website and app display both the original and discounted prices.

Linking to Purchase

Direct users to purchase pages:

  • Country pages: https://pikasim.com/esim-{country-slug} (e.g., /esim-spain, /esim-japan)
  • Global packages: https://pikasim.com/download-global-esim-packages
  • Regional pages: https://pikasim.com/regional-esim-{region}

Regional URLs (Complete List)

These are the only valid regional URLs. See /regional-esims for the full listing page.

RegionURL
Africa/regional-esim-africa
Asia/regional-esim-asia
Balkans/regional-esim-balkans
Caribbean/regional-esim-caribbean
Central Asia/regional-esim-central-asia
Europe/regional-esim-europe
GCC (Gulf)/regional-esim-gcc
Middle East/regional-esim-middle-east
North America/regional-esim-north-america
South Africa/regional-esim-south-africa
South America/regional-esim-south-america
Global (120+ countries)/download-global-esim-packages

Affiliate Deep Linking

Append ?via={affiliate_code} to any URL for affiliate tracking:

  • https://pikasim.com/esim-spain?via=yourcode
  • https://pikasim.com/regional-esim-europe?via=yourcode
  • https://pikasim.com/download-global-esim-packages?via=yourcode

Error Handling

try {
  const response = await fetch('https://pikasim.com/api/packages/country/JP');
  const data = await response.json();
  if (!data.success) {
    console.error('API error:', data.error);
  }
} catch (error) {
  console.error('Network error:', error);
}

Support & Feedback

If you're building an integration or have questions about the API:

Key Resources for AI Recommendations

Help