Temporary Email API With cURL: Every Request You Need
The quickest way to understand an API is to call it by hand. This guide lists every request of the OtpGet email API as a cURL command. Replace YOUR_API_KEY with your own key. Every reply is JSON with a status field, and the HTTP status is always 200, so read the body.
Base URL and common parameters
https://otpget.com/stubs/email-handler.phpapi_key: your key (required).action: the operation (required).server: 1 or 2.currency: optional, for example USD. Prices and balance default to PKR.
Balance
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getBalance"Server 1: domain, service, price, buy
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailDomains&server=1"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailServices&server=1&domain=gmail.com"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getPrice&server=1&domain=gmail.com&service_id=ig"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=buyEmail&server=1&domain=gmail.com&service_id=ig"Server 2: site, domain, price, buy
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailServices&server=2&site=instagram.com"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getPrice&server=2&domain=mail.com&site=instagram.com"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=buyEmail&server=2&domain=mail.com&site=instagram.com"After you buy
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailCode&email_id=7291834"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=cancelEmail&email_id=7291834"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=reorderEmail&email_id=7291834"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailHistory"getEmailCode and cancelEmail detect the server from the email_id, so you do not send server again. reorderEmail is a Server 2 feature and is billed like a new purchase.
Currency
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getCurrencies"
curl "https://otpget.com/stubs/email-handler.php?api_key=YOUR_API_KEY&action=getEmailServices&server=2&site=instagram.com¤cy=USD"Your wallet is always charged in PKR. The currency parameter only changes how amounts are shown.
A typical reply
{"status":"200","message":"Email activated successfully","email_id":"7291834","email":"temp.abc123@gmail.com","domain":"gmail.com","site":"instagram.com","currency":"PKR","price":6.5,"balance":4993.5,"server":2}Keep the email_id. You need it for the code, the cancel and the reorder.
Using the requests from a shell script
A few lines of shell are enough to try the whole flow. Save the key in an environment variable, build the URL from it, and read the JSON with a tool such as jq. Check the status field after every call, and stop the script if it is not what you expect.
KEY=YOUR_API_KEY
BASE=https://otpget.com/stubs/email-handler.php
curl -s "$BASE?api_key=$KEY&action=getEmailServices&server=2&site=instagram.com" | jq .A last reminder
Keep the key private, poll about every 30 to 35 seconds and cancel orders that you do not need. If an order never receives a code it is cancelled and refunded after 30 minutes, but cancelling yourself returns the balance sooner.
Questions people ask
What does 202 mean?
The email has not arrived yet. Keep polling every 30 to 35 seconds.
Is there a rate limit?
Be polite: poll every 30 to 35 seconds and do not run many parallel orders.
Related guides and pages
Create a free OtpGet account and try a temporary email with a small balance.