शुरू करना

TempMail डेवलपर API में आपका स्वागत है। हमारे पास कुछ बेहतरीन फीचर्स हैं, जैसे...

  • कोई API कुंजी साइन/अप आवश्यक नहीं (मुफ्त स्तर के लिए)
  • Plus और Ultra उपयोगकर्ताओं के लिए कस्टम डोमेन्स
  • और बहुत कुछ! देखें हमारा प्राइसिंग पेज अधिक जानकारी के लिए।

यदि कोई पुस्तकालय का उपयोग नहीं कर रहे हैं, तो सभी POST अनुरोधों में Content-Type हेडर को application/json सेट करना चाहिए!

अपना पुस्तकालय चुनें

Python

NodeJS

Java

HTTP

$ pip3 install tempmail-lol

API प्रकार

ईमेल

एक ईमेल ऑब्जेक्ट, जो आपके इनबॉक्स की जांच करते समय लौटाया जाता है।

नामप्रकारविवरण
fromstringईमेल का प्रेषक
tostringप्राप्तकर्ता (आपका अस्थायी ईमेल)
subjectstringईमेल का विषय
bodystringप्लेनटेक्स्ट बॉडी, खाली हो सकती है
html?stringईमेल HTML (शून्य हो सकता है)
datenumberईमेल प्राप्त होने का Unix टाइमस्टैम्प

इनबॉक्स

एक इनबॉक्स ऑब्जेक्ट, जिसमें ईमेल पता और एक्सेस टोकन शामिल है।

नामप्रकारविवरण
addressstringबनाया गया ईमेल पता
tokenstringइनबॉक्स देखने के लिए उपयोग किया जाने वाला एक्सेस टोकन

इनबॉक्स का जीवनकाल

आपकी सदस्यता के स्तर के अनुसार इनबॉक्स का अलग-अलग जीवनकाल होता है।

सदस्यता स्तरजीवनकाल
मुफ्त (कोई सदस्यता नहीं)एक घंटा
TempMail Plusदस घंटे
TempMail Ultraतीस घंटे

इनबॉक्स जीवनकाल को बढ़ाया जा सकता है (केवल कस्टम डोमेन्स के लिए) बस फिर से create inbox विधि का अनुरोध करके।

इनबॉक्स बनाएं

Create Inbox विधि को GET या POST के साथ उपयोग किया जा सकता है। POST विधि आपको इनबॉक्स के प्रिफिक्स और डोमेन जैसी विकल्पों को कस्टमाइज़ करने की अनुमति देती है।

GET विधि वर्तमान में केवल पुरानी कारणों के लिए मौजूद है।

POST /v2/inbox/create
from TempMail import TempMail
tmp = TempMail("optional-api-key")

inb = tmp.createInbox()

# Or... use a prefix
inb = tmp.createInbox(prefix = "joe")

# You can use a setup custom domain here
inb = tmp.createInbox(domain = "mycustomdomain.com", prefix = "optional")

बॉडी

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
domain?stringइनबॉक्स का डोमेन, या रैंडम। एक कस्टम डोमेन हो सकता है।null
prefix?stringइनबॉक्स का प्रिफिक्स, या रैंडम।null

प्रतिक्रिया (201)

नामप्रकारविवरण
addressstringइनबॉक्स का ईमेल पता।
tokenstringइनबॉक्स का टोकन।

ईमेल प्राप्त करें

टोकन का उपयोग करके ईमेल प्राप्त करें जब ईमेल बनाया गया था। यदि आप अपना टोकन खो देते हैं, तो आप ईमेल तक पहुंचने में सक्षम नहीं होंगे, जब तक कि यह कस्टम डोमेन न हो (कृपया इस पर समर्थन से संपर्क न करें, हम कानूनी कारणों से आपको ईमेल पता नहीं दे सकते)।

GET /v2/inbox
from TempMail import TempMail
tmp = TempMail("optional-api-key")

inb = tmp.createInbox()

emails = tmp.getEmails(inb.token)

print("Emails:")

for email in emails:
    print("\tSender: " + email.sender)
    print("\tRecipient: " + email.recipient)
    print("\tSubject: " + email.subject)
    print("\tBody: " + email.body)
    print("\tHTML: " + str(email.html)) # may be None
    print("\tDate: " + str(email.date)) # Unix timestamp in milliseconds

क्वेरी

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
tokenstringइनबॉक्स तक पहुंचने के लिए उपयोग किया जाने वाला टोकनnull

प्रतिक्रिया (200)

नामप्रकारविवरण
emailsEmail[]सर्वर से प्राप्त ईमेल की सरणी
expiredbooleanसत्य अगर इनबॉक्स समाप्त हो गया है (देखें इनबॉक्स जीवनकाल)

कस्टम डोमेन तैयार करें

TempMail पर कस्टम डोमेन का उपयोग करने से पहले, आपको कुछ रिकॉर्ड सेट करने होंगे। इसे खाता पृष्ठ पर करना सिफारिश की जाती है, हालांकि आप इसे API के माध्यम से भी कर सकते हैं।

कस्टम डोमेन्स का उपयोग करने के लिए TempMail Plus या Ultra सदस्यता की आवश्यकता है।

POST /v2/custom

बॉडी

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
domainstringTempMail पर पंजीकरण करने के लिए डोमेनnull

Response (200)

नामप्रकारविवरण
uuidstringआपके डोमेन रिकॉर्ड के लिए सेट करने के लिए UUID (नीचे देखें)

इस रिकॉर्ड को अपने डोमेन के अंतर्गत [uuid].yourdomain.com में जोड़ें और मान tm-custom-domain-verification. पर सेट करें।

यदि आप उप-डोमेन का उपयोग कर रहे हैं, तो इसे [uuid].subdomain.yourdomain.com. पर सेट करें।

प्रतिक्रिया (4xx)

नामप्रकारविवरण
errorstringडोमेन सेट क्यों नहीं किया जा सका, इसके बारे में त्रुटि की व्याख्या।

कस्टम डोमेन पता बनाएं

कस्टम डोमेन इनबॉक्स उसी तरह बनाएं जैसे आप सामान्य इनबॉक्स बनाते हैं, लेकिन अपने डोमेन के साथ!

नोट्स:

  • आपको उसी खाते का उपयोग करना चाहिए जिसका उपयोग डोमेन के लिए UUID बनाने के लिए किया गया था
  • prefix पैरामीटर सामान्य प्रिफिक्स सेट करेगा जिसमें कोई प्रारंभिक संख्या नहीं होगी
POST /v2/inbox/create
from TempMail import TempMail
tmp = TempMail("API Key required for custom domains")

inb = tmp.createInbox()

inb = tmp.createInbox(domain = "mycustomdomain.com", prefix = "optional")

बॉडी

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
domainstringआपका कस्टम डोमेन।null
prefix?stringइनबॉक्स का ईमेल पता (के पहले @), या रैंडम।null

प्रतिक्रिया (201)

नामप्रकारविवरण
addressstringइनबॉक्स का ईमेल पता।
tokenstringइनबॉक्स का टोकन।

यदि आप इनबॉक्स का टोकन खो देते हैं, तो उसी प्रिफिक्स के साथ विधि को फिर से कॉल करें। इनबॉक्स जीवनकाल आपकी सदस्यता के आधार पर बढ़ाया जाएगा। आप असीमित बार बढ़ा सकते हैं।

ईमेल प्राप्त करने की विधि का उपयोग करके इनबॉक्स की जांच करें।

निजी वेबहुक्स

निजी वेबहुक्स सेट करें ताकि आपके डोमेन के सभी ईमेल आपके वेबहुक पर निर्देशित हों।

सक्रिय TempMail Ultra सदस्यता की आवश्यकता है।

आपके पास पहले से ही कस्टम डोमेन्स के लिए अपना डोमेन सेट होना चाहिए ([uuid].domain.com)।

POST /v2/private_webhook

Body

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
domainstringआपके वेबहुक पर सेट करने के लिए डोमेनnull
urlstringवेबहुक URL जहां ईमेल अग्रेषित होंगेnull

प्रतिक्रिया (200)

नामप्रकारविवरण
successtrueहमेशा सत्य
messagestringसफलता सूचना संदेश

प्रतिक्रिया (4xx)

नामप्रकारविवरण
errorstringत्रुटि के बारे में विवरण वाला संदेश

आप डोमेन को क्वेरी पैरामीटर के रूप में DELETE /private_webhook भी कर सकते हैं ताकि इसे हटा सकें।

मानक वेबहुक्स

प्रत्येक मानक ईमेल पर वेबहुक्स सेट करें जिसे आप बनाते हैं। ईमेल आपके वेबहुक पर अग्रेषित होंगे।

सक्रिय TempMail Ultra सदस्यता की आवश्यकता है।

यह मौजूदा ईमेलों पर पूर्वव्यापी रूप से लागू नहीं होगा।

POST /v2/webhook

बॉडी

पैरामीटरप्रकारविवरणडिफ़ॉल्ट
urlstringवेबहुक URL जहां ईमेल अग्रेषित होंगेnull

प्रतिक्रिया (200)

नामप्रकारविवरण
successtrueहमेशा सत्य

प्रतिक्रिया (4xx)

नामप्रकारविवरण
errorstringत्रुटि के बारे में विवरण वाला संदेश

आप इसे अपने खाते से हटाने के लिए DELETE /webhook भी कर सकते हैं।

API v3 Overview NEW

API v3 is the new, consistent TempMail API. It adds account-level inbox management, a wait-for-email long poll, raw .eml downloads, per-inbox webhooks with automatic retries and delivery logs, custom domain management, a list of TempMail's own domains, scoped API keys, and a usage endpoint.

What changed from v2:

  • Fetches consume exactly what they return. Emails you receive in a response are deleted; emails excluded by your filters (since, from, limit) stay in the inbox. v2 wipes the whole inbox on every read.
  • Errors are consistent. Every error is { "error": { "code", "message" } } with a matching HTTP status-never a 200.
  • Rate limits are visible. Responses carry x-ratelimit-limit, x-ratelimit-remaining and x-ratelimit-reset headers (reset is a unix timestamp in seconds). 429 responses include retry-after.
  • v2 stays supported. Inboxes are shared between versions; v3 has its own create and fetch endpoints, but tokens work on both.
Base URL & authentication
Base URL:  https://api.tempmail.lol/v3

# account endpoints accept either key type:
Authorization: Bearer tempmail.20260101.abcdef...   # primary key
Authorization: Bearer tempmail.sk.abcdef...          # scoped key

# error envelope (here: HTTP 403)
{
  "error": {
    "code": "insufficient_scope",
    "message": "This API key does not have the required scope: domains:read",
    "required_scope": "domains:read"
  }
}

Scoped API Keys

Create additional API keys that can only do specific things, so your CI pipeline or a third-party integration never holds your full account credential. The key secret is returned once on creation and only a hash is stored.

Keys are managed with your primary API key (or the website), a scoped key can never manage keys.

Scopes

ScopeGrants
inboxes:createCreate inboxes (works on v1/v2 create endpoints too)
inboxes:readList your inboxes
webhooks:readRead webhook config and delivery logs
webhooks:writeSet/remove per-inbox webhooks
domains:readList/inspect custom domains
domains:writeRegister/verify/remove custom domains
usage:readRead usage & quota
GET/v3/keyslist keys
POST/v3/keyscreate a key
PATCH/v3/keys/:idrename / re-scope / revoke
DELETE/v3/keys/:iddelete a key
POST /v3/keys
curl -X POST https://api.tempmail.lol/v3/keys \
  -H "Authorization: Bearer $PRIMARY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci key", "scopes": ["inboxes:create", "inboxes:read"]}'

# 201 -> { "key": "tempmail.sk....", "id": "...", "scopes": [...], ... }
#        the "key" field is shown ONCE. store it now

Create & Manage Inboxes

Create inboxes anonymously (free tier, per-IP limits) or with an API key (per-account limits, longer lifespans, account ownership). Inboxes created with a key belong to your account and can be listed with the inboxes:read scope; per-inbox endpoints are authorized by the inbox token itself.

POST /v3/inboxes - body (all optional)

ParameterTypeDescriptionDefault
prefix?stringLocal part prefix (a-z, 0-9, _, -)random
domain?stringA TempMail domain (see TempMail Domains), or a custom domain verified to your account. Plus/Ultra accounts draw random domains from their own premium pool.random
community?booleanPrefer a community domainfalse

GET /v3/inboxes - query

ParameterTypeDescriptionDefault
limit?numberPage size (max 200)50
cursor?stringnext_cursor from the previous pagenull
include_expired?booleanAlso return expired inboxesfalse
POST/v3/inboxescreate an inbox
GET/v3/inboxeslist your inboxes
GET/v3/inboxes/:tokenmetadata + email count
DELETE/v3/inboxes/:tokendelete inbox + its emails
POST /v3/inboxes
curl -X POST https://api.tempmail.lol/v3/inboxes \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"prefix": "ci-run-42"}'

# 201
{
  "address": "[email protected]",
  "token": "...",
  "created_at": "2026-07-16T00:22:22.000Z",
  "expires_at": 1784269342568,
  "expired": false,
  "webhook_configured": false
}

Fetch Emails & Raw .eml

Fetching emails consumes what it returns: emails in the response are deleted, while emails excluded by since or limit stay in the inbox (v2 deletes everything on read).

Raw RFC822 source is a TempMail Ultra feature. For Ultra-owned inboxes each fetched email includes a raw field with the exact MIME source received over SMTP (null if it was not captured). The standalone /raw endpoint downloads a .eml for an email that has NOT been consumed yet - useful with the email_id from webhook delivery logs. If the verbatim source is unavailable, a reconstructed .eml is served (marked with x-tempmail-reconstructed: true).

GET /v3/inboxes/:token/emails - query

ParameterTypeDescriptionDefault
since?numberOnly emails with date >= this unix ms timestamp0
limit?numberMax emails returned (max 200)100
GET/v3/inboxes/:token/emailsfetch + consume
DELETE/v3/inboxes/:token/emails/:iddelete without reading
GET/v3/inboxes/:token/emails/:id/rawdownload .eml (Ultra)
GET /v3/inboxes/:token/emails/:id/raw
curl -OJ https://api.tempmail.lol/v3/inboxes/$TOKEN/emails/$ID/raw

# -> Content-Type: message/rfc822
#    Content-Disposition: attachment; filename="<id>.eml"
#    x-tempmail-reconstructed: false

# without Ultra -> 403
# { "error": { "code": "tier_required", "required_tier": "ultra", ... } }

Wait for Email (long poll)

Blocks until an email matching your filters arrives, or the timeout passes - one request instead of a polling loop. Perfect for signup flows and CI: request the OTP, then wait for it.

Matched emails are returned and consumed; emails that do not match the from/since filters stay in the inbox untouched.

Query

ParameterTypeDescriptionDefault
timeout?numberSeconds to wait (max 60)30
from?stringSender filter, wildcards allowed (*@example.com)null
since?numberIgnore emails older than this unix ms timestamp0

At most 2 concurrent /wait requests per inbox. A timeout is still HTTP 200, with "timed_out": true and an empty emails array.

GET /v3/inboxes/:token/wait
curl "https://api.tempmail.lol/v3/inboxes/$TOKEN/wait?\
from=*@example.com&timeout=30"

# matched emails are consumed on return
{
  "emails": [{
    "id": "6a58244f...",
    "from": "[email protected]",
    "subject": "Your verification code is 482913",
    "body": "Code: 482913",
    "raw": "From: [email protected]\r\n...",  // Ultra only
    ...
  }],
  "timed_out": false,
  "waited_ms": 2311
}

Per-Inbox Webhooks & Delivery Logs

Attach a webhook to a single inbox (TempMail Ultra): new mail to that inbox is POSTed to your URL. Failed deliveries are retried automatically with backoff - 30s, 5m, 30m, 2h after the initial attempt (5 attempts total).

Every delivery and each attempt (status code, error, duration) is logged for 7 days and queryable - this covers account-wide (v2) webhooks, private domain webhooks, and per-inbox webhooks alike.

GET /v3/webhooks/deliveries - query

ParameterTypeDescription
status?stringpending | success | failed
address / domain?stringFilter by recipient inbox or domain
limit / cursor?number / ?stringPagination (max 200)
PUT/v3/inboxes/:token/webhookset webhook (Ultra)
GET/v3/inboxes/:token/webhookread webhook
DELETE/v3/inboxes/:token/webhookremove webhook
GET/v3/webhooks/deliveriesdelivery log
GET /v3/webhooks/deliveries
{
  "deliveries": [{
    "url": "https://example.com/hook",
    "event": "email.received",
    "address": "[email protected]",
    "status": "success",
    "attempt_count": 2,
    "attempts": [
      { "at": "...", "status_code": 500, "error": "HTTP 500", "duration_ms": 12 },
      { "at": "...", "status_code": 200, "error": null, "duration_ms": 45 }
    ],
    "created_at": "..."
  }],
  "next_cursor": null
}

Custom Domains

Register a custom domain to your account, get the exact DNS records to create, and re-run verification whenever you like - with structured per-record results instead of a single pass/fail. Requires TempMail Plus or Ultra.

DNS records returned by the API

TypeNameValue
TXT<hash>.yourdomain.comtm-custom-domain-verification
Amx.yourdomain.com(returned by the API)
MXyourdomain.commx.yourdomain.com (priority 10, must be the only MX)

The exact TXT name/value pair is account-specific - always read it from the API response.

POST /v3/domains/verify re-checks up to 100 of your domains in one call, least recently checked first, and returns the same per-domain results. It can run once every 10 minutes per account; calling it sooner returns 429 rate_limited with a retry-after header.

GET/v3/domainslist your domains
POST/v3/domainsregister + verify
GET/v3/domains/:domaindetails + DNS records
POST/v3/domains/:domain/verifyre-run verification
POST/v3/domains/verifyre-verify all (once per 10 min)
DELETE/v3/domains/:domainunregister
POST /v3/domains/:domain/verify
{
  "domain": { "domain": "yourdomain.com", "verified": true, ... },
  "checks": {
    "txt": { "pass": true,  "detail": "Ownership TXT record found." },
    "mx":  { "pass": false, "records": [...],
             "expected": "mx.yourdomain.com",
             "detail": "Expected a single MX record..." }
  },
  "dns": { "ownership_txt_options": [...], "mail_records": [...] }
}

TempMail Domains

List every domain TempMail itself serves, split into the premium pool that only Plus/Ultra accounts can create inboxes on and the free pool that any tier can use. Pass any of them as domain when creating an inbox. Requires TempMail Plus or Ultra and the domains:read scope; free accounts get a tier_required error.

Response fields

FieldTypeDescription
domains_premiumstring[]The premium pool. Random Plus/Ultra inboxes are drawn from here.
domains_freestring[]The free pool, including community domains. Usable by every tier.

An entry starting with *. is a wildcard: both the bare domain and any subdomain of it are accepted, so *.example.com lets you create [email protected] or [email protected]. The lists change over time as domains are rotated in and out, so re-fetch them rather than caching them for long.

GET/v3/domains/poollist TempMail domains (Plus/Ultra)
GET /v3/domains/pool
curl https://api.tempmail.lol/v3/domains/pool \
  -H "Authorization: Bearer tempmail.sk...."

{
  "domains_premium": [
    "*.plusonly.example",
    "premium.example"
  ],
  "domains_free": [
    "*.free.example",
    "community.example"
  ]
}

Usage & Quota

See your tier, how much of the inbox-creation window you have used, and counts of your active inboxes, keys, and domains. Requires the usage:read scope.

GET /v3/usage
{
  "tier": "ultra",
  "inbox_creation": {
    "window_seconds": 300,
    "limit": 5000,
    "used": 2,
    "remaining": 4998,
    "resets_at": 1784161500000,
    "limited_by": "account"
  },
  "inboxes_active": 2,
  "api_keys_active": 1,
  "custom_domains": 0,
  "webhook_deliveries_last_7d": 14
}

API सहायता

API के साथ सहायता की आवश्यकता है? हमारे Discord सर्वर में शामिल हों! हम मदद करने के लिए खुश हैं, इसलिए हमें बताएं यदि आपको कोई समस्या है, या यदि आपको हमारे API के साथ कुछ समझने में मदद की आवश्यकता है।