Buy Gmail Accounts in Bulk via API for Bots and Scripts

When a bot, a QA pipeline or an agency workflow needs dozens of Gmail accounts at a time, clicking Buy on the web gets old fast. The OTPGmail API does everything the Buy short-lived Gmail page does: list the warehouses, quote a quantity, buy, follow the delivery, download the accounts and read their emails. This guide covers the order flow and the details that keep a large run safe.

Short answer: call GET /v1/mail-shop/products to see each warehouse's fields, price, stock and maxQty. Then POST /v1/mail-shop/orders with {"warehouse": N, "quantity": Q} and a fresh Idempotency-Key header. Delivery usually completes within the call; if status is pending, poll the order every 5 seconds. Each order can take up to the warehouse's maxQty, so split bigger runs into several orders.

Pick the warehouse for the job

Warehouse (product code) What each account brings Use it when
1 (gm_cookie) Email, password, cookies, login link (shop's Chrome extension), inbox link and JSON link, live check Your script reads codes from the inbox, or each account runs in its own browser profile
2 (gm_login) Email, password, quick login link for a desktop browser A person or a browser bot opens one link and works in Gmail
3 (gm_2fa) Email, password, recovery email if any, 2FA key and code link, cookies, inbox link, live check Sign-ins on new devices or phones, where Google asks for a code
4 (gm_link_cookie) Email, password, login link with no extension, cookies, inbox link, live check You buy a batch and open links one at a time; each lasts about 10 minutes after it is opened

Do not hard-code these numbers. Read the delivers array of each product: new warehouses can be added, and a warehouse that is not open is simply absent from products[]. Warehouse 99 means "cheapest first" among the warehouses in auto.order when auto.available is true. Warehouse 3 is never part of it.

API purchase flow

Your API key is on your profile page. Send it as Authorization: Bearer <key>. The base URL and every field are in the API documentation.

  1. Catalog: GET /v1/mail-shop/products returns warehouse, code, delivers, priceVnd (your price), listPriceVnd, stock, available and maxQty for each warehouse. A stock of null means the figure is not published: just buy, and any shortfall is refunded.
  2. Quote: GET /v1/mail-shop/quote?warehouse=3&quantity=20 returns totalVnd, available and maxQty. It reserves nothing.
  3. Buy: POST /v1/mail-shop/orders with the JSON body and an Idempotency-Key. You are charged at once. The call waits up to about 16 seconds for delivery, so give your client a timeout of 60 seconds.
  4. Follow: while status is pending, call GET /v1/mail-shop/orders/{id} every 5 seconds. The final states are completed, partial (the shortfall is refunded, see refundVnd), failed (fully refunded) and refunded.
  5. Collect: items[] holds the accounts. GET /v1/mail-shop/orders/{id}/download gives the same accounts as a .txt file.

A minimal Python buyer:

import os, time, uuid, requests

API = os.environ["OTPGMAIL_API_BASE"]   # the /v1 base URL from the API docs
H = {"Authorization": f"Bearer {os.environ['OTPGMAIL_API_KEY']}"}

def buy(warehouse, quantity, key):
    for _ in range(5):
        try:
            r = requests.post(f"{API}/mail-shop/orders",
                              json={"warehouse": warehouse, "quantity": quantity},
                              headers={**H, "Idempotency-Key": key}, timeout=60)
        except requests.RequestException:
            time.sleep(5)
            continue                       # network error: retry with the SAME key
        body = r.json()
        if body["success"]:
            return body["data"]
        code = body["error"]["code"]
        if code in ("RATE_LIMITED", "DUPLICATE_REQUEST"):
            time.sleep(int(r.headers.get("Retry-After", 5)))
            continue
        raise RuntimeError(f"{r.status_code} {code}: {body['error']['message']}")
    raise RuntimeError("no answer after 5 tries")

order = buy(3, 20, str(uuid.uuid4()))
while order["status"] == "pending":
    time.sleep(5)
    order = requests.get(f"{API}/mail-shop/orders/{order['id']}", headers=H, timeout=30).json()["data"]
print(order["status"], order["deliveredCount"], order["refundVnd"])

Parsing deliveries per warehouse, and storing them

Prefer the JSON items[]. Each item has lineNo, warehouse, email, password and the fields from that warehouse's delivers, for example cookies, loginUrl, inboxUrl, inboxJsonUrl, liveUrl, twofa, twoFaUrl or recovery. If you work from the .txt download, read its first line, which is the column header:

Store one row per account: order ID, lineNo, warehouse, email, the secrets (encrypted at rest), purchase time and, for Warehouse 4, the time you opened the link. Before handing an account to a worker, check it with its liveUrl (add ?json for { alive, note }). For Warehouses 1 and 3 you can also call GET /v1/mail-shop/orders/{id}/items/{lineNo}/status. Checks and inbox reads count toward an hourly limit per account, so check just before use rather than in a loop.

Batching and idempotency, so a retry never buys twice

The general pattern, with timeouts and logging, is in OTP API retries, timeouts and idempotency.

Balance and top-up before a big run

Call GET /v1/balance (the amount is in VND) and compare it with the quote's totalVnd before you start. Stop the job cleanly if the balance is short, instead of letting every order fail. Outside Vietnam you can top up with USDT or USDC on several networks, or with a Binance ID transfer through Binance Pay. The rate is shown and locked when you create the top-up, and the deposit is credited automatically. Vietnamese customers can use a bank QR transfer. Check that crypto payments are allowed where you live. The steps are in paying with USDT.

Errors and what to do

Error Meaning What to do
INSUFFICIENT_BALANCE Not enough balance, nothing bought Top up, then buy with a new key
MAILSHOP_OUT_OF_STOCK (409) Not enough accounts at this price; error.details.stock says how many you can buy now Buy that many, or try another warehouse; nothing was charged
MAILSHOP_QTY_LIMIT (400) Over the per-order maximum; error.details.max Split the order
RATE_LIMITED (429) Too many purchases per minute; web and API share the counter Wait for Retry-After, then retry with the same key
MAILSHOP_DISABLED (503) Buying is paused, or this product is off Try again later
HTTP 502 The purchase could not be completed; a failed order is recorded and fully refunded (error.details.orderId) Retry later with a new key
Status partial Some accounts were delivered, the rest refunded (refundVnd) Use what arrived, buy the difference

Use the accounts within Google's terms and each target platform's rules. The acceptable use policy applies to automated buying too.

Frequently asked questions

What is the maximum number of accounts per order?

Each warehouse returns its current maxQty in the catalog, and the per-order cap is listed in the API documentation. For a bigger run, place several orders, each with its own Idempotency-Key.

How is this different from renting inboxes in bulk?

Renting gives you a code at a real address: no password and no sign-in, with a refund if no code arrives. Rental batches take 1 to 200 inboxes at the same unit price; see bulk Gmail rental. Buying gives you whole accounts that you sign in to.

Is there a warranty on bulk orders?

Yes, per account: the first successful sign-in within 2 hours of purchase. If one account fails, contact support with the order ID and the line number. The other accounts in the order are not affected.

Can my bot read codes without signing in?

Yes, for the warehouses whose delivers include inboxJsonUrl (1, 3 and 4): GET that link, no API key needed. For Warehouses 1 and 3 there is also GET /v1/mail-shop/orders/{id}/items/{lineNo}/inbox. Warehouse 2 has no inbox link, so you read its mail after signing in with the login link.

Related guides

Get your verification code now

Sign up free. You are only charged when an inbox is issued. No code within 25 minutes — 100% refunded automatically.

Can't find the service you need? Use Add service on the rental page and we will add it if our infrastructure supports it.

Need a Gmail account you can sign in to, not just a code? See buy short-lived Gmail accounts · Refund and warranty