New update - Phone number rental (OTP SMS)We've just added a new feature: renting phone numbers from all countries for all services at very affordable prices, for those who need them. Feel free to check it out!
Apply custom discountAnyone who rents OTP Gmail > 2000 Gmails per day for any service (except Facebook, Instagram, and Apple) and wants a private discount, feel free to message me! Discounts can be up to 50% off the original price for those registering accounts in large enough volumes.
New update - Buy ProxyWe've just added a new feature to buy super cheap proxies for those of you registering accounts. Feel free to check it out!

API documentation

Public API /v1 — authenticate with an API key and automate inbox rentals from your own software

Your API key
You are not logged in — log in to get your own API key.
Send this key in the Authorization: Bearer <key> header or the ?api_key=<key> query parameter. Click the eye icon to reveal the full key; click Generate new key when you need to replace it (the old key stops working immediately).

Shared by every product

Base URL
https://otpgmail.net
Authentication
Add your API key to every request, either in the Authorization: Bearer og_xxx... header (recommended) or in the ?api_key=og_xxx... query string.
JSON
Every response is JSON — success {"success":true,"data":…}, error {"success":false,"error":{"code":…}}. Branch on error.code; error.retryable = true ⇒ wait error.retryAfterSec seconds and send the same call again. Money is integer VND; times are Unix seconds.
Idempotency-Key
Create / buy calls accept the Idempotency-Key header (a new UUID per order): lost connection ⇒ resend with the same key and the server replays the first response — never a second charge.
Rate limits
Limits: 100 requests/second and 3000 requests/minute per API key — above that ⇒ 429 RATE_LIMITED with Retry-After. Details at the bottom: Rate limits · Error codes.
Balance
One balance for every product — GET /v1/balance:
curl "https://otpgmail.net/v1/balance" \
  -H "Authorization: Bearer og_xxx..."
# → {"success":true,"data":{"balance":25000}}

Overview

Idempotency-Key (prevents duplicate orders)
Every POST /v1/orders request should include the Idempotency-Key: <new UUID per order> header. If the request times out or the connection drops, send it again with the same key — the server returns the original response instead of creating another order. Generate a new UUID for each new order and reuse a UUID only when retrying.
Many orders at once: bulk status
Renting tens or hundreds of inboxes? Read them in bulk: POST /v1/orders/status returns up to 100 orders per call (one request against your rate limit), and GET /v1/orders lists your orders — after a restart, ?status=waiting_code gives back every order still waiting for a code. Every error also says whether to retry (error.retryable, error.retryAfterSec). Details: the Bulk status section.
Inbox type: Gmail or iCloud
By default you get an @gmail.com inbox. To rent an @icloud.com inbox, add "domain": "icloud.com" to the POST /v1/orders body. Omitting domain means gmail.com — existing integrations keep working without changes. iCloud is available only for services whose icloud field is not null in GET /v1/services; the iCloud price may differ from the Gmail price (see icloud.price). Every order response includes a domain field that tells you which inbox type the order uses. Some services also offer @gmx.com inboxes (currently only Pokemon, code pkm, warehouse 2): send "domain": "gmx.com" — a service offers it when its offers[] in GET /v1/services has an entry with domain = "gmx.com"; any other service ⇒ DOMAIN_UNAVAILABLE. gmx.com is not available for batches.
Warehouses: one service, several inbox sources
A service can be sold from several warehouses, each with its own price, stock and code rules (the offers[] array in GET /v1/services). Send "warehouse": 2 when creating an order to pick one; "warehouse": 99 ⇒ the system picks the cheapest warehouse with stock and moves on to the next one if it runs out (ideal for services that often run out, such as Facebook and Instagram); 0 ⇒ the cheapest warehouse with stock. Existing clients need no changes: omit warehouse ⇒ warehouse 1 as before, and price, stock and icloud describe warehouse 1 (services without warehouse 1 ⇒ the cheapest warehouse with stock). Details: see Warehouses.
Let your customers read codes themselves (the /otp page)
Reselling inboxes you rented (on the web or through the API)? Turn on a share code on your Account page, then send your customer the link https://otpgmail.net/en/otp#k7m2q9:[email protected] (k7m2q9 = your share code) — they see the latest codes of that email without logging in and never see prices or your balance; the page only performs free actions (it never charges you).
JSON link for tools / bots (yours or your customer's): take the path-style link https://otpgmail.net/en/otp/k7m2q9:[email protected] (it opens the /otp page just like the # link) and add ?json ⇒ the server returns JSON with exactly what the page shows: cards[] — one card per service rented on that email (email, serviceName, state, items[] = up to 5 latest codes / links, newest first) — plus serverTime. state: waiting for the first code · listening waiting for a new code · received has codes · needs_owner the seller must extend it · expired · banned inbox locked. Several emails: separate them with commas (up to 50). No API key, no cookies, CORS is open; read-only (“Load new OTP” / “Rent this email again” stay on the /otp page). Same anti-guessing limits as the page: wrong code / no order to show for the email ⇒ 404 NOT_FOUND; repeated misses or more than 30 reads per minute for one email ⇒ 429 RATE_LIMITED with retryAfter (seconds). Adding ?json to a /otp#… link does NOT return JSON: browsers never send the part after # to the server.
curl "https://otpgmail.net/en/otp/k7m2q9:[email protected]?json"
{
  "success": true,
  "data": {
    "cards": [
      {
        "ref": "Q3vX9kL2mP0aB7cD",
        "serviceCode": "fb",
        "serviceName": "Facebook",
        "logo": "/logos/fb.png?v=20261007",
        "domain": "gmail.com",
        "email": "[email protected]",
        "state": "received",
        "until": null,
        "items": [
          {
            "kind": "code",
            "value": "529170",
            "label": null,
            "at": 1760000405
          },
          {
            "kind": "code",
            "value": "381904",
            "label": null,
            "at": 1759999030
          }
        ],
        "total": 2,
        "canLoad": true
      }
    ],
    "serverTime": 1760000530
  }
}
Complete sample code on GitHub
Ready-to-run clients for Python, Node.js, PHP, C# (.NET) and curl — rent an inbox, wait for the code, cancel automatically for a refund, and switch between iCloud and Gmail when stock runs out: github.com/letoan0902/otpgmail-email-otp-api (English) · thue-otp-gmail (Vietnamese). Python note: use requests rather than bare urllib (its default User-Agent gets a 403 from the CDN).
Webhooks
Instead of polling every order, register one URL and receive a signed POST as soon as an order gets a new code or is cancelled / refunded — see Webhooks.

Endpoints

GET/v1/balance
Returns the account balance (in VND) for the API key used in the request.
Example
curl "https://otpgmail.net/v1/balance" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": {
    "balance": 25000
  }
}
Possible errors: UNAUTHORIZED
GET/v1/services
Lists the enabled services — code, name, Gmail price (in VND) and current Gmail stock, an icloud block with the price and stock for @icloud.com inboxes, and an offers[] array: every warehouse selling the service, one entry per warehouse × inbox type (price, stock, number of codes, rules). The data is cached: stock is refreshed about every 30–60 seconds, prices less often.
icloud = null means the service does not support iCloud yet (the provider does not offer it, or it is temporarily disabled) — only Gmail can be rented. For services with an icloud block, send "domain": "icloud.com" when creating the order to get an @icloud.com inbox at icloud.price. price / stock / icloud.price describe warehouse 1 — where orders without warehouse go (services without warehouse 1 ⇒ the cheapest warehouse with stock); per-warehouse prices and stock are in offers[] (see Warehouses). stock is the number the source publishes (warehouse 1: refreshed about every 30 seconds), not a promise that one call can rent that many: inboxes are allocated one at a time and the source can run out midway — POST /v1/orders then returns fewer orders plus a partial field. Warehouses 2 and 4 likewise show their sources' numbers.
Example
curl "https://otpgmail.net/v1/services" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": [
    {
      "code": "dr",
      "name": "OpenAI (ChatGPT)",
      "price": 350,
      "stock": 616525,
      "icloud": {
        "price": 630,
        "stock": 12464
      },
      "offers": [
        {
          "warehouse": 2,
          "domain": "gmail.com",
          "price": 350,
          "stock": 616525,
          "maxCodes": null,
          "rules": null,
          "fee": {
            "freeHours": 6,
            "paidPct": 50,
            "maxHours": 24
          },
          "isDefault": true
        },
        {
          "warehouse": 1,
          "domain": "gmail.com",
          "price": 630,
          "stock": 12464,
          "maxCodes": 3,
          "rules": null,
          "fee": null,
          "isDefault": false
        },
        {
          "warehouse": 1,
          "domain": "icloud.com",
          "price": 630,
          "stock": 12464,
          "maxCodes": 5,
          "rules": null,
          "fee": null,
          "isDefault": true
        }
      ],
      "note": null
    },
    {
      "code": "fb",
      "name": "Facebook",
      "price": 1590,
      "stock": 88,
      "icloud": null,
      "offers": [
        {
          "warehouse": 1,
          "domain": "gmail.com",
          "price": 1590,
          "stock": 88,
          "maxCodes": 10,
          "rules": null,
          "fee": null,
          "isDefault": false
        },
        {
          "warehouse": 4,
          "domain": "gmail.com",
          "price": 1580,
          "stock": 2310,
          "maxCodes": null,
          "rules": null,
          "fee": null,
          "isDefault": true
        }
      ],
      "note": null
    }
  ]
}
Possible errors: UNAUTHORIZED
POST/v1/orders
Creates an order for an inbox that receives verification codes — Gmail by default, or iCloud when you send domain: "icloud.com". Your balance is charged as soon as the provider allocates the inbox. Returns a list of orders (one, or several when quantity > 1).
Partial delivery: quantity is a maximum
  • Inboxes are allocated one at a time. If the provider runs out midway (for example, warehouse 1 has no more inboxes for that service at that moment), the call stops and returns HTTP 200 with the orders created so far — data can be shorter than quantity, and you are charged only for the orders in data. The stock in GET /v1/services does not promise how many one call will get.
  • The response then also carries a top-level partial field next to data (absent when everything was delivered, so bots that only read data keep working): requested, delivered, missing and reason = {code, message, retryable, retryAfterSec}, where code is the error that stopped the call (NO_MAILS_AVAILABLE, OUT_OF_STOCK, ALL_WAREHOUSES_EXHAUSTED, INSUFFICIENT_BALANCE, WAITING_LIMIT_REACHED…).
  • Running out is usually temporary — at warehouse 1 the provider often has inboxes again a few seconds later. When reason.retryable = true, wait reason.retryAfterSec seconds (3–5 s), then request the missing inboxes again with a NEW Idempotency-Key (the old key only replays this same response); repeat until you have them all.
  • Right after a partial delivery the next call may return 409 WAREHOUSE_UNAVAILABLE / OUT_OF_STOCK or 503 NO_MAILS_AVAILABLE — that is normal: keep pausing 3–5 s between calls and give up only when many calls in a row fail (for example 10 attempts, about a minute); then try again later, or send "warehouse": 99 to let the system move on to other warehouses. retryable = false (INSUFFICIENT_BALANCE, WAITING_LIMIT_REACHED…) ⇒ fix the cause first (top up, or wait for open orders to finish).
  • Error responses carry the same two fields inside error: error.retryable and error.retryAfterSec (for example 409 OUT_OF_STOCK ⇒ true, 5; 402 INSUFFICIENT_BALANCE ⇒ false, null) — see Error codes.
The Idempotency-Key header (a UUID) is required. Generate a new UUID for each new rental; when retrying after a timeout, reuse the SAME key to avoid creating a duplicate order. This call waits for the provider to allocate an inbox, so it usually takes about 0.3 seconds but can take up to 10 seconds at peak times (rare) — set your client timeout to about 15 seconds rather than giving up after 5 seconds and retrying early.
Parameters
NameTypeRequiredDescription
servicestringYesService code (from GET /v1/services, e.g. "ig", "tg", "fb")
quantitynumberNoMAXIMUM number of inboxes to rent (default 1; at most 200 per request) — if the warehouse runs out midway you get fewer: count data[] and read partial
domainstringNoInbox type: "gmail.com" (default), "icloud.com" or "gmx.com". Omitted = gmail.com — existing integrations need no changes. iCloud can be rented only for services whose icloud field is not null in GET /v1/services; "gmx.com" only for services with offers[].domain = "gmx.com" (currently only Pokemon, code pkm) — otherwise the call fails with DOMAIN_UNAVAILABLE. Any other value ⇒ VALIDATION_ERROR.
warehousenumberNoWarehouse to rent from. Omitted = WAREHOUSE 1, exactly as before multi-warehouse (services without warehouse 1 fall back to the cheapest) — existing clients need no changes. 0 = the cheapest warehouse with stock (only one warehouse is tried). 1–4 = that exact warehouse (from offers[].warehouse in GET /v1/services); if it does not sell this service/inbox type, is paused or is out of stock ⇒ WAREHOUSE_UNAVAILABLE. 99 = AUTOMATIC: warehouses with stock are tried from cheapest to most expensive, moving on when one is out of stock or failing; none left ⇒ ALL_WAREHOUSES_EXHAUSTED — recommended for services that often run out (Facebook, Instagram…). See Warehouses.
Example
# Generate a random Idempotency-Key for every NEW order
# REUSE the same key when retrying after a timeout (prevents duplicate orders)
# domain: "gmail.com" (default, optional) | "icloud.com" (rent an @icloud.com inbox) | "gmx.com" (only services offering it, e.g. Pokemon)
# warehouse: 0 | 1–4 | 99 (optional — omit it to keep warehouse 1 as before; 0 = cheapest warehouse with stock; 99 = automatic, moves on when a warehouse runs out; see offers[] in GET /v1/services)
curl -X POST "https://otpgmail.net/v1/orders" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"service":"ig","quantity":1,"domain":"gmail.com"}'
Sample response
{
  "success": true,
  "data": [
    {
      "orderId": "abc123xyz",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270000,
      "rentExpiresAt": 1753356400,
      "createdAt": 1753268200,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    }
  ]
}
Sample response — partial delivery (quantity 5, 2 inboxes delivered)
{
  "success": true,
  "data": [
    {
      "orderId": "abc123xyz",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270000,
      "rentExpiresAt": 1753356400,
      "createdAt": 1753268200,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    },
    {
      "orderId": "jkl012mno",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270001,
      "rentExpiresAt": 1753356401,
      "createdAt": 1753268201,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    }
  ],
  "partial": {
    "requested": 5,
    "delivered": 2,
    "missing": 3,
    "reason": {
      "code": "NO_MAILS_AVAILABLE",
      "message": "No inboxes available for this service right now, please try again later",
      "retryable": true,
      "retryAfterSec": 5
    }
  }
}
Possible errors: UNAUTHORIZED, VALIDATION_ERROR, SERVICE_DISABLED, INSUFFICIENT_BALANCE, OUT_OF_STOCK, DOMAIN_UNAVAILABLE, WAREHOUSE_UNAVAILABLE, ALL_WAREHOUSES_EXHAUSTED, NO_MAILS_AVAILABLE, QUANTITY_EXCEEDED, WAITING_LIMIT_REACHED, RATE_LIMITED, DUPLICATE_REQUEST, PROVIDER_ERROR, MAINTENANCE
GET/v1/orders/{id}
Returns an order by ID, including the codes received so far (otp[]). Poll this endpoint every 3–5 seconds to pick up the code while the order is in the waiting_code status.
The otp[] array is ordered by arrival: oldest first, NEWEST LAST — read the latest code with otp[otp.length - 1]. On every call the system checks the provider for orders that are still open, at each warehouse's own pace (every few seconds) — calling more often just returns the stored data. After the first code, keep polling: further codes (if the service sends more than one) are appended to the end of otp[] at no extra charge within the order period — the limit and time window are shown before you rent (maxCodes and fee in offers[]); to make sure the system is waiting for a new code, call POST /v1/orders/{id}/next-code (every warehouse; only warehouse 2 outside its free window charges a fee). If the service allows only one code per inbox, otp[] stops at that code — responses stay normal, with no error. The warehouse field tells you which warehouse supplied the inbox (1–4); nextCodeFee is the fee for more codes (warehouse 2 and 3 orders; null for warehouses 1 and 4) — see Warehouses. Since 2026-10-02 orders also carry nextCodeBlocked (true = the inbox cannot receive any more codes) and nextCodeBlockReason — the reason: "email_banned" (the email was locked by the service — rent a new one), "activation_gone" (the provider closed the inbox), "hard_expired" (the code window has ended), "max_codes" (the maximum number of codes was received), null (not blocked / older order with no recorded reason). These are added fields — existing clients need no changes. An order still waiting for its first code whose inbox dies before the deadline (mostly warehouse 2 orders with a long wait) ends early: status "cancelled", fully refunded, nextCodeBlocked = true and nextCodeBlockReason = "email_banned" (the email was locked) or "activation_gone" (the inbox is gone) — rent a new one; an order that simply reached its wait deadline has nextCodeBlockReason = null. Polling many orders? Send up to 100 IDs per call to POST /v1/orders/status instead of one GET per order — same order objects, one request against your rate limit.
Parameters
NameTypeRequiredDescription
idstringYesOrder ID (the orderId returned when the order was created)
Example
curl "https://otpgmail.net/v1/orders/ORDER_ID" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": {
    "orderId": "abc123xyz",
    "service": "ig",
    "domain": "gmail.com",
    "email": "[email protected]",
    "status": "completed",
    "price": 1060,
    "otp": [
      {
        "code": "123456",
        "receivedAt": 1753268500
      },
      {
        "code": "789012",
        "receivedAt": 1753269000
      }
    ],
    "codeDeadlineAt": 1753270000,
    "rentExpiresAt": 1753356400,
    "createdAt": 1753268200,
    "warehouse": 1,
    "nextCodeFee": null,
    "listening": true,
    "listenUntil": 1753270500,
    "nextCodeBlocked": false,
    "nextCodeBlockReason": null
  }
}
Possible errors: UNAUTHORIZED, NOT_FOUND
POST/v1/orders/{id}/cancel
Cancels the order and refunds 100% of the price. Allowed only while the order is in the waiting_code status AND no code has been received.
An order that has received a code (even a single one) cannot be cancelled or refunded — this applies to both the website and the API. Orders with rules.cancellable = false (own-inventory services such as Cointiply) cannot be cancelled: once the inbox is assigned there is no cancellation or refund — the cancel call returns ORDER_NOT_CANCELLABLE. Warehouse-3 orders of regular services (rules.cancellable = true) can be cancelled like any other order before a code arrives.
Parameters
NameTypeRequiredDescription
idstringYesID of the order to cancel
Example
curl -X POST "https://otpgmail.net/v1/orders/ORDER_ID/cancel" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json"
Sample response
{
  "success": true,
  "data": {
    "orderId": "abc123xyz",
    "service": "ig",
    "domain": "gmail.com",
    "email": "[email protected]",
    "status": "cancelled",
    "price": 1060,
    "otp": [],
    "codeDeadlineAt": 1753270000,
    "rentExpiresAt": 1753356400,
    "createdAt": 1753268200,
    "warehouse": 1,
    "nextCodeFee": null,
    "listening": false,
    "listenUntil": null,
    "nextCodeBlocked": false,
    "nextCodeBlockReason": null
  }
}
Possible errors: UNAUTHORIZED, NOT_FOUND, ORDER_NOT_CANCELLABLE, PROVIDER_ERROR
POST/v1/orders/{id}/rerent
Rents the SAME inbox again for an order of an own-inventory service (provider = "inventory", e.g. Cointiply): creates a NEW order on that inbox with a fresh receiving window, priced at the old order's rerentPriceVnd.
Only works when the old order has canRerent = true (the latest order of that inbox, whose previous window has ended or received all its emails). You are charged as soon as it succeeds — send an Idempotency-Key and reuse it when retrying so you are never charged twice. The response is { order, message }; order has the same shape as GET /v1/orders/{id}. Warehouse 2 (since 2026-10-09): an order that was cancelled, timed out or expired (inbox closed) — call it when canRerent = true (the latest order of that email, and the email has no other active order). The system reopens that EXACT email as a NEW order (status = waiting_code) priced at rerentPriceVnd (currently 100% of your price) and waits 20 minutes for an email like any warehouse 2 order — no email means it is cancelled and refunded 100%. Email locked by the service ⇒ RERENT_EMAIL_BANNED; the provider can no longer reopen it ⇒ RERENT_MAIL_GONE; warehouse 2 temporarily down ⇒ PROVIDER_ERROR — none of the three charges you.
Parameters
NameTypeRequiredDescription
idstringYesID of the inbox's previous order (the one with canRerent = true)
Example
# REUSE the same key when retrying after a timeout (prevents duplicate orders)
curl -X POST "https://otpgmail.net/v1/orders/ORDER_ID/rerent" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Idempotency-Key: $(uuidgen)"
Sample response
{
  "success": true,
  "data": {
    "order": {
      "orderId": "def456uvw",
      "service": "ctp",
      "domain": "icloud.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 3500,
      "otp": [],
      "codeDeadlineAt": 1753273500,
      "rentExpiresAt": 1753273500,
      "createdAt": 1753269000,
      "provider": "inventory",
      "rules": {
        "windowMinutes": 75,
        "maxCodes": 4,
        "cancellable": false,
        "refundOnTimeout": false,
        "rerentRatio": 0.5
      },
      "windowEndsAt": 1753273500,
      "canRerent": false,
      "rerentPriceVnd": 3500,
      "warehouse": 3,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    },
    "message": "Inbox rented again — a new 75-minute message window has started"
  }
}
Possible errors: UNAUTHORIZED, NOT_FOUND, RERENT_NOT_AVAILABLE, RERENT_EMAIL_BANNED, RERENT_MAIL_GONE, INSUFFICIENT_BALANCE, WAITING_LIMIT_REACHED, RATE_LIMITED, DUPLICATE_REQUEST, PROVIDER_ERROR, MAINTENANCE
POST/v1/orders/{id}/next-code
Asks for the next code on the SAME inbox — works for orders from EVERY warehouse (warehouse 1–4) that already received their first code (status = completed). Free, except warehouse-2 orders whose free window has ended (nextCodeFee.feePriceVnd > 0): then send confirmFee: true to pay the fee and open another code window (up to the hard limit nextCodeFee.hardUntil). Your bot does not need to know the warehouse: keep polling GET /v1/orders/{id} — new codes are appended to otp[] — and call this endpoint when you want the system to wait for a new code.
What this call does in each warehouse
  • Warehouse 1: the system waits for the next code by itself after every code within the order period (rentExpiresAt) — the call returns 200 and changes nothing; once the inbox can take no more codes (code limit reached, inbox closed, expired) ⇒ 409 with nextCodeBlockReason.
  • Warehouse 2: reopens the inbox at the provider (reordered = true) and waits 20 minutes for an email; free inside the free window (nextCodeFee.feePriceVnd = 0), outside it you must send confirmFee = true (missing ⇒ 409 NEXT_CODE_FEE_CONFIRM, nothing charged). The fee is kept only if a new code arrives — no code within 20 minutes ⇒ automatic refund. After every code, the system keeps waiting for the next one for 25 more minutes (listening = true, listenUntil).
  • Warehouse 3 (regular services): reopens a short listening window, free inside the free window (nextCodeFee.freeUntil); after it ⇒ 409 — use POST /v1/orders/{id}/rerent. Own-inventory services such as Cointiply (rules.cancellable = false) have no next code (409): every email shows up by itself during the window. Warehouse 3 on Gmail (per service): after each code the system stops waiting — call this to wait for the next one, free until rentExpiresAt (listening = true; calling again while waiting ⇒ 200, nothing changes); expired ⇒ 409 hard_expired, inbox closed ⇒ 409 activation_gone.
  • Warehouse 4: re-reads the order at the provider and waits for a new code, free until rentExpiresAt.
200 = the system is waiting for a new code for this order (listening = true, listenUntil = when it stops; reordered = true when the inbox was just reopened; chargedVnd when a fee was taken), or a new code arrived right as you called (already in order.otp). 409 = no new waiting window could be opened — read error.code; why the inbox takes no more codes is in order.nextCodeBlockReason (GET /v1/orders/{id}). An order still waiting for its first code (waiting_code) ⇒ 409, no need to call yet. Send an Idempotency-Key with paid calls (reuse it when retrying so you are never charged twice). Provider unreachable ⇒ 502 PROVIDER_ERROR, try again later. 409 error codes of this call: NEXT_CODE_FEE_CONFIRM (warehouse 2 needs the fee — call again with confirmFee: true), EMAIL_BANNED (the email was locked by the service — rent a new one; error.details.blockReason = "email_banned"), ORDER_EXPIRED (expired, inbox closed, code limit reached, or the service has no "next code" — the reason is in order.nextCodeBlockReason), ORDER_NOT_CANCELLABLE (the order has not received its first code yet). Bots that treat any 409 from this call as "no more codes" keep working unchanged. refresh: true (warehouse 2): first checks for a new email (one that just arrived is delivered, no reopen), then reopens the inbox at the provider — inside the free window the wait restarts for 20 minutes; outside it the wait keeps its end time (listenUntil) and nothing is charged. The response adds refreshed (true = reopened now) and refreshAvailableAt (unix seconds; before it another refresh does not reopen the inbox and just returns the current state; null = allowed now). Other warehouses: no effect (refreshed = false). Without refresh the call behaves exactly as before.
Parameters
NameTypeRequiredDescription
idstringYesOrder ID (orderId) — any warehouse
confirmFeebooleanNotrue = you agree to pay nextCodeFee.feePriceVnd to open another code window. Not needed while feePriceVnd = 0.
refreshbooleanNotrue = warehouse 2, the order is waiting for a new code (listening = true) but none arrives: reopen the inbox at the provider right now (refresh the wait) — the old wait may have stopped receiving mail on the provider side. Free; at least 5 s between two refreshes of one order — refreshing again and again without a new code makes the wait grow (up to ~1 minute); see refreshAvailableAt. Order not waiting ⇒ same as a normal call.
Example
# Free (nextCodeFee is null or feePriceVnd = 0 — every warehouse except warehouse 2 after its free window): no confirmFee needed
curl -X POST "https://otpgmail.net/v1/orders/ORDER_ID/next-code" \
  -H "Authorization: Bearer og_xxx..."

# Warehouse 2 after its free window: send confirmFee = true to pay nextCodeFee.feePriceVnd
curl -X POST "https://otpgmail.net/v1/orders/ORDER_ID/next-code" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"confirmFee":true}'
Sample response
{
  "success": true,
  "data": {
    "order": {
      "orderId": "ghi789rst",
      "service": "dr",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "completed",
      "price": 350,
      "otp": [
        {
          "code": "482913",
          "receivedAt": 1753268300
        }
      ],
      "codeDeadlineAt": 1753269700,
      "rentExpiresAt": 1753354200,
      "createdAt": 1753267800,
      "warehouse": 2,
      "nextCodeFee": {
        "feePriceVnd": 0,
        "freeUntil": 1753311000,
        "hardUntil": 1753354200,
        "paidPct": 50,
        "freeHours": 6
      },
      "listening": true,
      "listenUntil": 1753269500,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    },
    "message": "Another code window is open — waiting for a new code",
    "listening": true,
    "listenUntil": 1753269500,
    "reordered": true
  }
}
Possible errors: UNAUTHORIZED, NOT_FOUND, VALIDATION_ERROR, NEXT_CODE_FEE_CONFIRM, INSUFFICIENT_BALANCE, EMAIL_BANNED, ORDER_EXPIRED, ORDER_NOT_CANCELLABLE, PROVIDER_ERROR, DUPLICATE_REQUEST, MAINTENANCE

Bulk status: many orders per call

Resellers and bots that rent many inboxes should not send one GET /v1/orders/{id} per order: POST /v1/orders/status reads up to 100 orders per call, with the same order objects, and GET /v1/orders lists your orders from stored data.
  • Poll every 3–5 seconds with POST /v1/orders/status, up to 100 order IDs per call — each call counts as one request against your rate limit.
  • Each call checks the provider for at most 20 open orders of the list (orders waiting for their first code first, then the least recently checked) and returns the rest from stored data; those are checked on the next calls. A call answers within about 3 seconds.
  • Drop an order from your list once it is final: cancelled (refunded), or completed when you need no more codes.
  • IDs that do not exist or belong to another account come back in missing (no 404) — drop them too.
  • After a restart, get every open order back with GET /v1/orders?status=waiting_code (follow nextCursor), then resume polling with POST /v1/orders/status.
POST/v1/orders/status
Returns up to 100 of your orders in one call. Each element is exactly what GET /v1/orders/{id} returns for that order (status, otp[] with every code received, warehouse…). Use it to poll many open orders at once.
data keeps the order of ids; duplicate IDs are ignored. IDs that do not exist or belong to another account are listed in missing (no 404). For open orders the system checks the provider just like GET /v1/orders/{id}, but for at most 20 orders per call — those waiting for their first code first, then the least recently checked — and returns the others from stored data (they are checked on the next calls); a call answers within about 3 seconds. One call counts as one request against your rate limit, however many IDs it carries. More than 100 IDs, an empty list or non-string IDs ⇒ 400 VALIDATION_ERROR.
Parameters
NameTypeRequiredDescription
idsstring[]YesOrder IDs (orderId) — 1 to 100 per call
Example
# Order IDs you are waiting on (orderId from POST /v1/orders) — up to 100 per call
curl -X POST "https://otpgmail.net/v1/orders/status" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -d '{"ids":["ORDER_ID_1","ORDER_ID_2"]}'
Sample response
{
  "success": true,
  "data": [
    {
      "orderId": "abc123xyz",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "completed",
      "price": 1060,
      "otp": [
        {
          "code": "123456",
          "receivedAt": 1753268500
        }
      ],
      "codeDeadlineAt": 1753270000,
      "rentExpiresAt": 1753356400,
      "createdAt": 1753268200,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    },
    {
      "orderId": "jkl012mno",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270001,
      "rentExpiresAt": 1753356401,
      "createdAt": 1753268201,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    }
  ],
  "missing": [
    "zzz999qqq"
  ]
}
Possible errors: UNAUTHORIZED, VALIDATION_ERROR, RATE_LIMITED
GET/v1/orders
Lists your orders, newest first, from stored data only — it does not ask the provider for new codes (POST /v1/orders/status does). Filter by status and creation time; page with nextCursor.
Pass nextCursor as cursor to get the next page; nextCursor = null ⇒ last page. Pages never repeat or skip an order, even when many orders were created in the same second. Internal states are never listed (only waiting_code, completed, cancelled and queued). After your bot restarts: GET /v1/orders?status=waiting_code&limit=200, follow nextCursor, then poll those orders with POST /v1/orders/status.
Parameters
NameTypeRequiredDescription
statusstringNoOnly this status: waiting_code | completed | cancelled | queued (omitted ⇒ all of them)
sincenumberNoOnly orders created at or after this unix time (seconds)
limitnumberNoOrders per page: 1–200 (default 50)
cursorstringNonextCursor of the previous page, passed unchanged
Example
# After a restart: collect every order still waiting for a code, page by page
curl "https://otpgmail.net/v1/orders?status=waiting_code&limit=200" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": [
    {
      "orderId": "jkl012mno",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270001,
      "rentExpiresAt": 1753356401,
      "createdAt": 1753268201,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    },
    {
      "orderId": "abc123xyz",
      "service": "ig",
      "domain": "gmail.com",
      "email": "[email protected]",
      "status": "waiting_code",
      "price": 1060,
      "otp": [],
      "codeDeadlineAt": 1753270000,
      "rentExpiresAt": 1753356400,
      "createdAt": 1753268200,
      "warehouse": 1,
      "nextCodeFee": null,
      "listening": false,
      "listenUntil": null,
      "nextCodeBlocked": false,
      "nextCodeBlockReason": null
    }
  ],
  "nextCursor": "1753268200:abc123xyz"
}
Possible errors: UNAUTHORIZED, VALIDATION_ERROR, RATE_LIMITED

Warehouses

Each offers[] entry is one offer = (service, warehouse, inbox type). Only warehouses currently selling are listed; a warehouse that is temporarily out of stock stays in the list with stock = 0. Warehouse numbers are fixed: 1, 2, 3, 4 — pass the same number in the warehouse parameter when creating an order.
Existing clients need no changes. Omit warehouse ⇒ the same behaviour as before (warehouse 1: 25-minute wait, extra codes arrive automatically within the 24-hour order period when the service sends more than one); send 0 ⇒ cheapest warehouse with stock; send 99 ⇒ automatic warehouse, moving on when one runs out (see right below); every existing field stays as it is — only new fields are added (offers[], warehouse, nextCodeFee, listening, nextCodeBlocked…).
Automatic warehouse: warehouse = 99 (recommended for services that often run out)
Send "warehouse": 99 and the system rents from the cheapest warehouse with stock; if that warehouse is out of stock or failing, it moves on to the next one within the same call. Ideal for services that often run out, such as Facebook and Instagram — your bot no longer has to read offers[] and retry warehouse by warehouse.
  • Order tried: price from low to high (e.g. 1,500 → 1,600 → 1,700 VND); equal prices ⇒ lower warehouse number first.
  • Warehouses reporting zero stock (stock = 0 in offers[]) are never called — no time wasted.
  • Moves on when the current warehouse is out of stock or failing (OUT_OF_STOCK, NO_MAILS_AVAILABLE, WAREHOUSE_UNAVAILABLE, PROVIDER_ERROR).
  • Other errors are returned right away, without trying the next warehouse: INSUFFICIENT_BALANCE, WAITING_LIMIT_REACHED, QUANTITY_EXCEEDED, MAINTENANCE, SERVICE_DISABLED, DOMAIN_UNAVAILABLE…
  • quantity > 1: if the first warehouse runs short, the rest comes from the next one — orders may span several warehouses; each order carries the warehouse and price of the warehouse that issued it (and follows that warehouse's code rules).
  • If every warehouse was tried and no inbox could be rented ⇒ ALL_WAREHOUSES_EXHAUSTED (HTTP 409, nothing charged) — try again later. If only some inboxes were rented, you still get 200 with those orders.
Example: rent Facebook Gmail with warehouse = 99
# warehouse: 99 — cheapest warehouse with stock; out of stock or failing ⇒ next warehouse automatically
curl -X POST "https://otpgmail.net/v1/orders" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"service":"fb","quantity":1,"domain":"gmail.com","warehouse":99}'
offers[] fields
FieldTypeDescription
warehouse1 | 2 | 3 | 4Warehouse number: 1, 2, 3 or 4.
domainstringInbox type of the offer: gmail.com, icloud.com or gmx.com (extra domain — only some services, currently Pokemon).
pricenumberPrice of one inbox from this warehouse (VND).
stocknumberInboxes left. 0 = out of stock — renting from warehouse 1 or 2 then returns WAREHOUSE_UNAVAILABLE; warehouse 4 is still tried (its sources often deliver although they report 0) and returns OUT_OF_STOCK when nothing is available.
maxCodesnumber | nullMaximum codes one inbox can receive; null = unlimited / unknown (see fee).
rulesobject | nullWindow rules for warehouse 3 (windowMinutes, maxCodes, cancellable, refundOnTimeout, rerentRatio); null for warehouses 1, 2 and 4.
feeobject | nullExtra-code window: freeHours free hours from the rental, then each extension costs paidPct% of the rental price, up to maxHours hours from the rental (null = no limit). fee = null: no fee — extra codes cost nothing within the order period when the service sends more than one (up to maxCodes), as in warehouse 1.
isDefaultbooleantrue for the cheapest warehouse with stock (ties ⇒ lower warehouse number) — the one used with warehouse = 0, and the first one tried with 99.
Rules by warehouse
RuleWarehouse 1Warehouse 2Warehouse 3Warehouse 4
Wait for the first code25 minutes20 minutes25 minutes ¹Up to 25 minutes (shorter at some sources — the real deadline is the order's codeDeadlineAt)
No codeAuto-cancelled, 100% refundAuto-cancelled, 100% refundAuto-cancelled, 100% refund ¹Auto-cancelled, 100% refund
Cancel before a codeYesYesYes ¹Yes
Codes per inboxPer maxCodesUnlimitedUnlimited ¹Per maxCodes (usually null = no limit; 1 for some offers)
More codesNo extra charge within the 24-hour order period if the service sends more codes; automatic (no extra call). The inbox usually stays open about 25 minutes after the latest code.Free for fee.freeHours hours (currently Gmail 6 hours, iCloud 12 hours); then each extension costs fee.paidPct% of the price via next-code, up to fee.maxHours (Gmail 24 hours, iCloud 10 days)No extra charge for 24 hours; then rent the same inbox again (rerent) at 50% of the price; from the 2nd rerent on (at least 20 hours after the previous one) only 25%No extra charge within the 24-hour order period, like warehouse 1 — new codes appear when you read the order; next-code re-reads it right away.
¹ Services sold only from the own inventory, such as Cointiply (provider = "inventory", rules.cancellable = false), follow rules: up to rules.maxCodes emails within rules.windowMinutes minutes, no cancellation, and no refund if time runs out without an email.
Warehouse 3 on Gmail (domain = gmail.com, rules.windowOnly = true): only emails from the rented service itself, sent after you rent. The first code must arrive within rules.windowMinutes minutes (until codeDeadlineAt); no code ⇒ auto-cancel with a 100% refund; cancellable before the first code. After the first code the system stops waiting, but the order stays active until rentExpiresAt: to get another code call POST /v1/orders/{id}/next-code — free until nextCodeFee.freeUntil (each call listens for rules.windowMinutes minutes, listening = true until the new code arrives); after that, until nextCodeFee.hardUntil, each call costs nextCodeFee.feePriceVnd (send confirmFee = true; refunded if no new code arrives in that round), like warehouse 2. After hardUntil ⇒ 409 hard_expired; email no longer usable ⇒ 409 activation_gone (never charged). Once the order has left the active list, canRerent = true ⇒ POST /v1/orders/{id}/rerent rents the same email again for rerentPriceVnd. The Any service (ot) order gets up to the first rules.maxLetters emails sent after you rent (they show up by themselves, no next-code); 0 emails ⇒ 100% refund.
nextCodeFee — fee for more codes (warehouse 2 and 3 orders)
Included in GET /v1/orders/{id} and every order response; null for warehouse 1 and 4 orders (more codes are free). Warehouse 2: call POST /v1/orders/{id}/next-code when you need another code — if feePriceVnd is above 0 you must send confirmFee = true. Warehouse 3 (regular services): once the free window is over, feePriceVnd is the price to rent the same inbox again (rerent).
FieldTypeDescription
feePriceVndnumberAmount charged if you call next-code now; 0 = still inside the free window.
freeUntilnumber | nullEnd of the current free window (unix seconds).
hardUntilnumber | nullHard limit (unix seconds) — no more codes after this time.
paidPctnumber% of the rental price charged for each extra window.
freeHoursnumberFree hours of one code window (warehouse 2: Gmail 6, iCloud 12; warehouse 3: 24).
Example: list the warehouses, then rent from one
# warehouse: 0 | 1–4 | 99 (optional — omit it to keep warehouse 1 as before; 0 = cheapest warehouse with stock; 99 = automatic, moves on when a warehouse runs out; see offers[] in GET /v1/services)
curl -X POST "https://otpgmail.net/v1/orders" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"service":"dr","quantity":1,"domain":"gmail.com","warehouse":2}'
Sample warehouse-2 order (GET /v1/orders/{id})
{
  "success": true,
  "data": {
    "orderId": "ghi789rst",
    "service": "dr",
    "domain": "gmail.com",
    "email": "[email protected]",
    "status": "completed",
    "price": 350,
    "otp": [
      {
        "code": "482913",
        "receivedAt": 1753268300
      }
    ],
    "codeDeadlineAt": 1753269700,
    "rentExpiresAt": 1753354200,
    "createdAt": 1753267800,
    "warehouse": 2,
    "nextCodeFee": {
      "feePriceVnd": 175,
      "freeUntil": 1753289400,
      "hardUntil": 1753354200,
      "paidPct": 50,
      "freeHours": 6
    },
    "listening": false,
    "listenUntil": null,
    "nextCodeBlocked": false,
    "nextCodeBlockReason": null
  }
}

Order lifecycle

StatusDescription
Waiting for codeNewly created order, waiting for the first code. Poll GET /v1/orders/{id} every 3–5 seconds.
CompletedThe first code has arrived — the status changes immediately. More codes can still arrive if the service sends more than one (no extra charge within the order period; limit and window per warehouse); keep polling and each new code appears at the end of otp[].
CancelledRefunded 100%. Happens when you call /cancel (before any code arrives), or when no code has arrived by codeDeadlineAt (at most 25 minutes).
Important notes:
  • Poll GET /v1/orders/{id} every 3–5 seconds while the order is waiting_code so you pick up the code promptly.
  • As soon as the first code arrives, the status changes to completed immediately.
  • No code by codeDeadlineAt (at most 25 minutes; warehouse 2: 20 minutes; some warehouse-4 sources are shorter) ⇒ the system cancels the order and refunds 100% (status = cancelled).
  • The otp[] array is ordered oldest first, newest last. Read the latest code with otp[otp.length - 1] (Python: otp[-1]).
  • A completed order keeps receiving codes automatically: keep polling GET /v1/orders/{id} and each new code shows up at the end of otp[]. Extra codes cost nothing within the order period when the service sends more than one; the limit and time window are shown before you rent (maxCodes and fee in offers[]; at warehouse 1 the inbox usually stays open about 25 minutes after the latest code). To ask for another code explicitly (e.g. to log in after signing up): POST /v1/orders/{id}/next-code — works in every warehouse, and only warehouse 2 outside its free window charges a fee.
  • If the service allows only one code per inbox, otp[] stops at that code. Responses stay normal, with no error — you decide when to stop polling.
  • otp[].code is usually a short code (digits / letters) or a link. An email with no extractable code (welcome emails, newsletters, unusual code formats…) is delivered verbatim (HTML or text) in otp[].code — treat it as a full email when it is longer than 80 characters, contains a line break or is HTML, and look for the code or link in it yourself.
  • POST /v1/orders waits for the provider to allocate an inbox, so it usually takes ~0.3 seconds but can take up to 10 seconds at peak times (rare). Set a client timeout of ≈ 15 seconds rather than giving up after 5 seconds and retrying early — and when you do retry, reuse the same Idempotency-Key.
  • An order that has received a code cannot be cancelled or refunded — the cancel call returns ORDER_NOT_CANCELLABLE.
  • To rent an @icloud.com inbox, send "domain": "icloud.com" when creating the order (omit it for Gmail; existing bots need no changes). If the service does not support iCloud, or iCloud is temporarily disabled, you get DOMAIN_UNAVAILABLE — switch to Gmail and the rental goes through right away. The lifecycle, the cancellation and refund rules, and the way you read codes are exactly the same as for Gmail.
  • Own-inventory services (provider = "inventory", e.g. Cointiply — see GET /v1/services) are iCloud-only; each email arrives as a link in otp[].code, together with kind, label and the full email text in text. An order receives up to rules.maxCodes emails within rules.windowMinutes minutes (until windowEndsAt), cannot be cancelled (ORDER_NOT_CANCELLABLE), and if time runs out with no email it becomes cancelled without a refund. To keep receiving on the same inbox, call POST /v1/orders/{id}/rerent while canRerent is true (price: rerentPriceVnd). Every other service / order has provider = "standard" — since 2026-10-24 provider has only two values, "standard" | "inventory" (the actual warehouse is in warehouse); compare with "inventory" only.
  • Warehouse 2 orders (warehouse = 2): codes are free for fee.freeHours hours; once the free window closes, new codes stop arriving — call POST /v1/orders/{id}/next-code with confirmFee = true (paying nextCodeFee.feePriceVnd) to open another window, up to nextCodeFee.hardUntil. Warehouse 3 orders of regular services: free codes for 24 hours, cancellable before a code arrives, then use rerent. Warehouse 4 orders: new codes land in otp[] when you read the order, free until rentExpiresAt; with a single-code source, nextCodeBlockReason becomes "max_codes" after the first code.
  • Many orders at once? Poll up to 100 per call with POST /v1/orders/status — see Bulk status.

Webhooks (push notifications)

Register one URL per account and we POST a signed JSON event to it as soon as an order receives a new code (order.code) or is cancelled / refunded (order.cancelled). Webhooks are optional and cover every order of your account (web and API). Delivery is best-effort — keep a slow poll as a fallback (see below).
Set up in 3 steps
  1. PUT /v1/webhook with your URL (and optionally events) — store data.secret (64 hex characters): you need it to verify every delivery. Calling PUT again keeps the same secret.
  2. POST /v1/webhook/test — we send a ping event right away and return what your server answered (ok, httpStatus, error).
  3. Your endpoint answers any 2xx within 5 seconds — reply first, then process the event. Anything else (3xx, 4xx, 5xx, timeout, connection error) counts as a failure and is retried.
The URL must start with http:// or https:// (with a valid certificate) and be reachable from the internet: localhost, private, link-local, multicast and reserved addresses (10.x, 172.16–31.x, 192.168.x, 169.254.x, fc00::/7, fe80::/10…) and OTPGmail's own servers are rejected with VALIDATION_ERROR. The host name is resolved again before every delivery. Redirects are not followed — register the final URL.
Request format
Every delivery is an HTTP POST to your URL with a JSON body (UTF-8) and these headers:
HeaderValue
Content-Typeapplication/json
User-AgentOTPGmail-Webhook/1
X-OTPGmail-EventEvent name: order.code, order.cancelled or ping
X-OTPGmail-DeliveryUnique event ID (UUID) — equal to deliveryId in the body and unchanged on every retry
X-OTPGmail-TimestampUnix time (seconds) when this attempt was signed — equal to sentAt in the body
X-OTPGmail-Signaturesha256= + lowercase hex HMAC-SHA256 of timestamp + "." + raw body, keyed with your secret
Verify the signature
Compute HMAC-SHA256 with your secret as the key over X-OTPGmail-Timestamp + . + the raw request body, as lowercase hex, and compare it with the value after sha256= in constant time. The key is the 64-character secret string itself (its UTF-8 bytes — do not hex-decode it). Use the raw bytes: parsing and re-serializing the JSON changes them. Reject timestamps more than 5 minutes away from your clock (replay protection).
Receiver examples (Python and Node use only the standard library; the curl command sends a correctly signed test delivery to your own receiver)
# Local test: send your receiver a delivery signed exactly like ours
SECRET="9f2c6d1e8b7a4f3c5e0d2b1a6c9e8f7d3b5a1c2e4f6a8b0d9c7e5f3a1b2c4d6e"
TS=$(date +%s)
BODY='{"event":"ping","deliveryId":"6f1d2c3b-8a9e-4f70-b1c2-d3e4f5a6b7c8","sentAt":'$TS'}'
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.* //')
curl -X POST "http://localhost:8080/" \
  -H "Content-Type: application/json" \
  -H "X-OTPGmail-Event: ping" \
  -H "X-OTPGmail-Delivery: 6f1d2c3b-8a9e-4f70-b1c2-d3e4f5a6b7c8" \
  -H "X-OTPGmail-Timestamp: $TS" \
  -H "X-OTPGmail-Signature: sha256=$SIG" \
  -d "$BODY"
Events
EventSent when
order.codeAn order received a new code — one event per code, including every next code on the same inbox. code is the new code; otp lists every code of the order so far, oldest first (as in GET /v1/orders/{id}; only the new code when the body would exceed 64 KB).
order.cancelledAn order was cancelled or refunded — once per order: no code before the deadline (timeout), cancelled by you (user) or by an administrator (admin), or refunded because the warehouse failed (provider). refundVnd = VND returned to your balance (0 when the service rules do not refund).
pingOnly from POST /v1/webhook/test.
Event fields
FieldTypeDescription
eventstringEvent name (also in the X-OTPGmail-Event header)
deliveryIdstringUnique event ID (UUID, = X-OTPGmail-Delivery) — store it to skip duplicates
sentAtnumberUnix time of this attempt (= X-OTPGmail-Timestamp)
orderIdstringOrder ID — the same as in GET /v1/orders/{id}
servicestringService code
warehouse1 | 2 | 3 | 4 | nullWarehouse 1–4 that supplied the inbox; null if the order never got one
domainstringInbox domain: gmail.com, icloud.com or gmx.com
emailstring | nullThe rented inbox address
codestringorder.code only: the new code — can also be a link or a full email, like otp[].code
receivedAtnumberorder.code only: unix time the code arrived
statusstringOrder status at that moment: completed for order.code, cancelled for order.cancelled (an admin refund of an order that already had codes keeps completed)
otparrayorder.code only: every code so far, [{code, receivedAt}], oldest first
reasonstringorder.cancelled only: timeout | user | admin | provider
refundVndnumberorder.cancelled only: VND refunded to your balance (0 = no refund)
nextCodeBlockReasonstringorder.cancelled only, and only when the inbox cannot receive any more codes: email_banned | activation_gone | hard_expired | max_codes (as in GET /v1/orders/{id}). An order that ended early because its inbox was locked / is gone keeps reason timeout and carries this field; a plain timeout has no such field
Example body — order.code
{
  "event": "order.code",
  "deliveryId": "6f1d2c3b-8a9e-4f70-b1c2-d3e4f5a6b7c8",
  "sentAt": 1760700125,
  "orderId": "k3m9x2p7q1w8e5r4",
  "service": "fb",
  "warehouse": 1,
  "domain": "gmail.com",
  "email": "[email protected]",
  "code": "482913",
  "receivedAt": 1760700124,
  "status": "completed",
  "otp": [
    {
      "code": "482913",
      "receivedAt": 1760700124
    }
  ]
}
Example body — order.cancelled
{
  "event": "order.cancelled",
  "deliveryId": "0b7e4c2a-5d1f-4e8b-9a3c-2f6d8e1b4a7c",
  "sentAt": 1760701630,
  "orderId": "p8v2n5c1x7z3m9k4",
  "service": "ig",
  "warehouse": 2,
  "domain": "gmail.com",
  "email": "[email protected]",
  "reason": "timeout",
  "refundVnd": 1500,
  "status": "cancelled"
}
Example body — ping
{
  "event": "ping",
  "deliveryId": "3c9a1e7f-2b4d-4c6e-8f0a-5d7b9c1e3a2f",
  "sentAt": 1760700000
}
Retries, pausing and history
  • A failed delivery is retried after 10 s, 1 min, 5 min, 30 min and 2 h (5 retries); if the last retry also fails, the event is dropped (failed).
  • 50 failed attempts in a row (across all events) pause the webhook: GET /v1/webhook shows pausedAt, nothing is sent and new events are not queued.
  • To resume: call PUT /v1/webhook again (the same URL is fine) or get a successful POST /v1/webhook/test — events waiting in the queue are then sent.
  • GET /v1/webhook/deliveries lists the latest 100 deliveries with their status, attempts and last error; history is kept for 7 days.
Duplicates and ordering
The same event can arrive more than once (for example when your 2xx reply was lost) and events can arrive out of order (several are sent in parallel). Store processed deliveryIds and skip repeats; for an order, rely on its newest data (otp, status) rather than on arrival order.
Keep polling as a fallback
Webhooks can be delayed (retries) or missed (webhook paused, your server down). Keep a slow poll — for example GET /v1/orders/{id} every 30–60 s for orders still waiting_code — and treat the order object from the API as the source of truth.
PUT/v1/webhook
Register or update the webhook of your account. The first call creates it and returns a new secret; later calls keep the secret, switch the webhook back on and resume it if it was paused. Without events: both events for a new webhook, unchanged for an existing one. The URL must be a public address — otherwise 400 VALIDATION_ERROR (error.details.problem says why).
Parameters
NameTypeRequiredDescription
urlstringYesYour endpoint (http:// or https://, public address, at most 2048 characters)
eventsstring[]NoWhich events to send: ["order.code", "order.cancelled"] (default both)
Example
# Store data.secret — you need it to verify every delivery
curl -X PUT "https://otpgmail.net/v1/webhook" \
  -H "Authorization: Bearer og_xxx..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://your-server.example/otpgmail-webhook","events":["order.code","order.cancelled"]}'
Sample response
{
  "success": true,
  "data": {
    "url": "https://your-server.example/otpgmail-webhook",
    "events": [
      "order.code",
      "order.cancelled"
    ],
    "enabled": true,
    "secret": "9f2c6d1e8b7a4f3c5e0d2b1a6c9e8f7d3b5a1c2e4f6a8b0d9c7e5f3a1b2c4d6e",
    "pausedAt": null,
    "consecutiveFailures": 0,
    "createdAt": 1760699000,
    "updatedAt": 1760699000
  }
}
Possible errors: UNAUTHORIZED, VALIDATION_ERROR
GET/v1/webhook
The webhook of your account, including its secret, pausedAt and consecutiveFailures. data is null when no webhook is registered.
Example
curl "https://otpgmail.net/v1/webhook" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": {
    "url": "https://your-server.example/otpgmail-webhook",
    "events": [
      "order.code",
      "order.cancelled"
    ],
    "enabled": true,
    "secret": "9f2c6d1e8b7a4f3c5e0d2b1a6c9e8f7d3b5a1c2e4f6a8b0d9c7e5f3a1b2c4d6e",
    "pausedAt": 1760705400,
    "consecutiveFailures": 50,
    "createdAt": 1760699000,
    "updatedAt": 1760705400
  }
}
Possible errors: UNAUTHORIZED
DELETE/v1/webhook
Removes the webhook; events still waiting in the queue are dropped. Always 200 — data.deleted is false when there was nothing to remove.
Example
curl -X DELETE "https://otpgmail.net/v1/webhook" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": {
    "deleted": true
  }
}
Possible errors: UNAUTHORIZED
POST/v1/webhook/test
Sends a ping event to your URL right now and reports what happened: ok (your server answered 2xx), httpStatus, durationMs, error. A successful test resumes a paused webhook. At most 10 tests per minute; 503 MAINTENANCE while webhooks are switched off system-wide.
Example
curl -X POST "https://otpgmail.net/v1/webhook/test" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": {
    "ok": true,
    "httpStatus": 200,
    "durationMs": 143,
    "error": null,
    "deliveryId": "3c9a1e7f-2b4d-4c6e-8f0a-5d7b9c1e3a2f"
  }
}
Response 200 when your server does not answer 2xx
{
  "success": true,
  "data": {
    "ok": false,
    "httpStatus": 500,
    "durationMs": 88,
    "error": "HTTP 500",
    "deliveryId": "7d2b9f4e-1c6a-4e3b-8d5f-0a9c2e7b1f4d"
  }
}
Possible errors: UNAUTHORIZED, NOT_FOUND, RATE_LIMITED, MAINTENANCE
GET/v1/webhook/deliveries
Latest deliveries, newest first (kept 7 days): status = queued (next attempt at nextAt) | delivered | failed | paused, with attempts, lastHttpStatus and lastError. Event bodies are not returned.
Parameters
NameTypeRequiredDescription
limitnumberNoNumber of deliveries, 1–100 (default 100)
Example
curl "https://otpgmail.net/v1/webhook/deliveries?limit=20" \
  -H "Authorization: Bearer og_xxx..."
Sample response
{
  "success": true,
  "data": [
    {
      "id": "0b7e4c2a-5d1f-4e8b-9a3c-2f6d8e1b4a7c",
      "event": "order.cancelled",
      "orderId": "p8v2n5c1x7z3m9k4",
      "status": "queued",
      "attempts": 1,
      "lastHttpStatus": 503,
      "lastError": "HTTP 503",
      "nextAt": 1760701640,
      "createdAt": 1760701630,
      "deliveredAt": null
    },
    {
      "id": "6f1d2c3b-8a9e-4f70-b1c2-d3e4f5a6b7c8",
      "event": "order.code",
      "orderId": "k3m9x2p7q1w8e5r4",
      "status": "delivered",
      "attempts": 1,
      "lastHttpStatus": 200,
      "lastError": null,
      "nextAt": null,
      "createdAt": 1760700124,
      "deliveredAt": 1760700125
    }
  ]
}
Possible errors: UNAUTHORIZED

Rate limits

Limits apply per API key (an account can have its own limits; otherwise the site default applies):
  • 100 requests/second — short bursts over a few seconds
  • 3000 requests/minute — total traffic per minute
Going over a limit returns HTTP 429 with a Retry-After: <seconds> header and the body {"success":false,"error":{"code":"RATE_LIMITED",...}}. Wait the number of seconds given in the header before retrying. The error body carries the same number of seconds in error.retryAfterSec (with error.retryable = true).

Error codes — Rent inbox

Every error has the same shape: {"success":false,"error":{"code":"...","message":"...","retryable":false,"retryAfterSec":null}}
Since 2026-10-17 every /v1 error also has error.retryable and error.retryAfterSec (added fields — existing clients need no changes; details is unchanged). retryable = true ⇒ the same call may succeed later: wait retryAfterSec seconds (a whole number ≥ 1) and send it again — out of stock / no inboxes / warehouse paused / provider error ⇒ 5 s; 429 RATE_LIMITED ⇒ the Retry-After header; 409 DUPLICATE_REQUEST while the first request with the same Idempotency-Key is still running ⇒ 2 s. retryable = false (retryAfterSec = null) ⇒ calling again will not help until you fix the cause (balance, waiting-order limit, parameters, API key…). partial.reason of POST /v1/orders follows the same rules. On a 409 out-of-stock answer (OUT_OF_STOCK, WAREHOUSE_UNAVAILABLE, ALL_WAREHOUSES_EXHAUSTED), wait the full retryAfterSec before trying again — retrying sooner usually just returns the same answer — and check stock / offers[].stock in GET /v1/services before renting again; follow the orders you already have with webhooks instead of tight polling.
Sample error responses
HTTP/1.1 409 Conflict
{
  "success": false,
  "error": {
    "code": "OUT_OF_STOCK",
    "message": "This service is currently out of stock",
    "retryable": true,
    "retryAfterSec": 5
  }
}

HTTP/1.1 429 Too Many Requests
Retry-After: 1
{
  "success": false,
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded, retry after 1s",
    "retryable": true,
    "retryAfterSec": 1
  }
}

HTTP/1.1 402 Payment Required
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Insufficient balance to rent an inbox",
    "retryable": false,
    "retryAfterSec": null
  }
}
Codes you can get in Rent inbox (codes shared by every product + this product's own).
Error codeHTTPretryable · retryAfterSecMeaning
UNAUTHORIZED401false · nullThe API key is invalid or missing.
ACCOUNT_LOCKED403false · nullThe account is locked — every request made with its key is rejected. Contact support. An account that keeps renting with a very low code success rate can be locked automatically.
NOT_FOUND404false · nullNo order / batch / inbox with this ID in your account (another account's orders also return 404).
VALIDATION_ERROR400false · nullThe request parameters are invalid (wrong type, missing required field, etc.).
INSUFFICIENT_BALANCE402false · nullThe account balance is too low to pay for the order.
SERVICE_DISABLED409false · nullThe service code does not exist or the service is temporarily disabled. Take the exact code from GET /v1/services.
OUT_OF_STOCK409true · 5The service has no inboxes available (for the selected inbox type) at the time of the request.
DOMAIN_UNAVAILABLE409false · nullThe service does not offer the selected inbox type — iCloud is not supported yet / temporarily disabled, or the service has no gmx.com inboxes. Send domain "gmail.com" (or omit the field) to rent Gmail.
WAREHOUSE_UNAVAILABLE409true · 5 / falseThe chosen warehouse does not sell this service/inbox type, is paused or has just run out. Pick another warehouse from offers[], or send warehouse = 99 to let the system pick one with stock. If that warehouse (or every warehouse selling this service) is not available for your account, retryable is false — calling again will not help, use another warehouse.
ALL_WAREHOUSES_EXHAUSTED409true · 5Only with warehouse = 99: every warehouse with stock was tried (cheapest first) and all were out of stock or failing — or every warehouse reports zero stock. Nothing was charged; try again later.
NO_MAILS_AVAILABLE503true · 5The provider has no inboxes left for this service (temporarily out).
QUANTITY_EXCEEDED400false · nullquantity exceeds the per-request maximum (currently 200).
WAITING_LIMIT_REACHED429false · nullToo many orders are waiting for a code at the same time (over your account's limit of concurrent waiting_code orders) — wait for some to finish, then rent again.
ORDER_NOT_CANCELLABLE409false · nullThe order cannot be cancelled — it may already have a code, or it is no longer in the waiting_code status. next-code also returns this code when the order has not received its first code yet.
RERENT_NOT_AVAILABLE409false · nullThe order cannot be rented again. Warehouse 3: it is not the inbox's latest order, the inbox is no longer assigned to your account, or the previous receiving window is still open. Warehouse 2: the order is not closed yet (it can still receive codes — use next-code), it is too old to rent again, the email has another active order, or the service is paused. Warehouses 1 and 4 have no rent-again.
RERENT_EMAIL_BANNED409false · nullWarehouse 2 rent-again: the provider reports the email was locked by the service (email banned) — it can't be rented again; you are not charged.
RERENT_MAIL_GONE409false · nullWarehouse 2 rent-again: the provider can no longer reopen this email — rent a new one; you are not charged.
NEXT_CODE_FEE_CONFIRM409false · nullThe warehouse-2 order's free window has ended — call next-code again with confirmFee: true to pay the fee (nextCodeFee.feePriceVnd). Nothing has been charged.
EMAIL_BANNED409false · nullThe email has been locked by the service (the provider reports email banned) — it can't receive more codes; rent a new one. Since 2026-10-02 (previously ORDER_EXPIRED, same HTTP 409).
ORDER_EXPIRED409false · nullThe order can't receive more codes — its time limit has passed (rentExpiresAt / nextCodeFee.hardUntil), the provider closed the inbox, the code limit (maxCodes) was reached, or the service has no "next code". The reason is in order.nextCodeBlockReason.
RATE_LIMITED429true · = Retry-AfterMore than 100 req/second or 3000 req/minute on your API key (accounts can have their own limits). The Retry-After header tells you how many seconds to wait. In warehouse 2, POST /v1/orders and /rerent also return this code when the account has cancelled many warehouse 2 orders without a code in the last 60 minutes while very few got a code — renting from warehouse 2 pauses until the cancellation rate drops ("warehouse": 99 stops there with this error — pick another warehouse meanwhile). Facebook / Instagram (fb, fbb, ig) are exempt.
DUPLICATE_REQUEST409true · 2 / falseThe Idempotency-Key was already used with a different payload or endpoint, or the first request with this key is still running (retry in a moment). Generate a new key to create another order.
PROVIDER_ERROR502true · 5Error from the inbox provider (temporary — retry after a few seconds).
MAINTENANCE503false · nullThe system is under maintenance — creating and cancelling orders is paused.
INTERNAL500false · nullUnexpected server error — try again later; contact support if it keeps happening.