API Documentation

GPTMail API

Use the GPTMail API to generate temporary inboxes, list and read messages, and delete mail over HTTPS with an X-API-Key header. It suits automated tests, CI/CD pipelines, and QA workflows.

How To Get An API Key

Buy API requests

Purchase API requests with GPTMail points. Earn points through daily check-ins and public domains, or buy points with LDC at a 1:1 rate.

Buy with points / add requests

Option 2: Add your own domain

After a public domain passes MX verification: submitted while signed out → API Key (20000 requests); submitted while signed in → 200 points. Each domain receives only one reward. Important: once connected, that domain suffix becomes a public suffix available to all users on this site, so other users can also generate mailbox addresses under it. After activation, do not delete, replace, or modify the MX record that points this domain to our service. Otherwise, later checks may treat the domain as misconfigured. If a later check finds the MX record invalid, the domain will be deactivated. If the MX record remains invalid for 3 consecutive checks, the associated API key will also be deactivated. If the MX record becomes valid again later, the domain will be reactivated automatically.

Domains

Public testing key

For testing, send the shared public key shown below in the X-API-Key header. It changes every day and has a daily limit of 200,000 requests shared by all users.

Remaining Today

Resets In

Loading live quota for the public key...

The API reference below can be copied as Markdown for AI tools, knowledge bases, or a README.

Base URL: https://mail.chatgpt.org.uk

AI
llms.txt

·

llms-full.txt

(Markdown)

Quick Start

  • X-API-Key: YOUR_KEY is the simplest option. For quick tests, use the daily public key shown above in place of YOUR_KEY.

  • Most mailbox endpoints require an email parameter, for example ?email=demo@example.com.

  • GPTMail API responses use JSON with success, data, and error fields, plus usage when an API key is used. Cloudflare errors, including rate-limit responses, may return HTML instead. Check the HTTP status and Content-Type before parsing JSON.

  • If you already know a currently supported domain on this site, you do not have to call the email generation endpoint first. You can compose prefix@domain locally and call the mailbox APIs directly, which saves one API request.

Rate limits and retries

  • GET and POST /api/generate-email share a limit of 30 requests per 10 seconds per source IP. This applies to both public and personal API keys. Different keys and clients behind the same IP share this limit.

  • Exceeding this limit returns HTTP 429 and blocks email generation for 10 seconds. Wait for the Retry-After duration before retrying. If this header is absent, wait at least 10 seconds, then retry with increasing delays. Avoid simultaneous retries from clients sharing an IP.

  • This rule does not apply to inbox listing or reading individual emails. API-key daily and total quotas still apply independently. Waiting 10 seconds does not restore an exhausted key quota.

Use public subdomains

Read the public domain catalog first. The subdomains array describes each base domain: domain is the base name, wildcard indicates wildcard MX support, and children lists explicitly configured subdomains.

When wildcard is true, you can choose a single subdomain label, such as mail.example.com. When wildcard is false, use only a name listed in children. The chosen name must have valid MX records; an existing DNS name can override wildcard records and be unavailable.

POST /api/generate-email accepts the full subdomain in domain. prefix is the mailbox name before @, not the subdomain label. Replace example.com below with a supported public domain from the catalog.

Use the full email address to read or delete messages. Omitting domain selects a random base domain; it does not create a random subdomain. A subdomain shown as an independent domain remains usable by its full name.

Only public domains are available through API keys. Private domains and GPTMail members-only domains, including their subdomains, are excluded.

curl 'https://mail.chatgpt.org.uk/api/domains/public'

curl -X POST 'https://mail.chatgpt.org.uk/api/generate-email' \
  -H 'X-API-Key: PUBLIC_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"prefix":"demo","domain":"mail.example.com"}'

curl 'https://mail.chatgpt.org.uk/api/emails?email=demo@mail.example.com' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example · data.subdomains
{
  "subdomains": [
    {
      "domain": "example.com",
      "wildcard": true,
      "children": [
        "mail.example.com"
      ]
    },
    {
      "domain": "example.org",
      "wildcard": false,
      "children": [
        "inbox.example.org"
      ]
    }
  ]
}

Core Endpoints

POST / GET
/api/generate-email

Generate a temporary inbox. Use GET for the simplest random inbox flow, or POST with prefix and domain when you want explicit control.

GET
/api/emails?email=...

Fetch emails for a mailbox.

GET
/api/email/{id}?email=...

Fetch a single email, including text, HTML, raw headers, and metadata.

DELETE
/api/email/{id}?email=...

Delete one email by ID.

DELETE
/api/emails/clear?email=...

Delete all emails in a mailbox.

GET
/api/stats

Read site-wide statistics.

Example Flow

Below are two common patterns: let the service generate an inbox for you, or request a fixed prefix. If you already know a currently supported domain, you can also compose the mailbox locally and query it directly.

1) Generate a random temporary email address

curl 'https://mail.chatgpt.org.uk/api/generate-email' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example
{
  "success": true,
  "data": {
    "email": "a3f9c2b1@example.com"
  },
  "usage": {
    "daily_limit": 200000,
    "used_today": 1,
    "remaining_today": 199999,
    "total_limit": 200000,
    "total_usage": 1,
    "remaining_total": 199999
  }
}

2) Generate with a fixed prefix (e.g. demo@example.com)

curl -X POST 'https://mail.chatgpt.org.uk/api/generate-email' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: PUBLIC_API_KEY' \
  -d '{"prefix":"demo"}'
Response example
{
  "success": true,
  "data": {
    "email": "demo@example.com"
  },
  "usage": {
    "daily_limit": 200000,
    "used_today": 2,
    "remaining_today": 199998
  }
}

3) List emails in an inbox

If you already know a supported domain, skip step 1 and query directly.

curl 'https://mail.chatgpt.org.uk/api/emails?email=demo@example.com' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example
{
  "success": true,
  "data": {
    "emails": [
      {
        "id": "e5a7f3...",
        "email_address": "demo@example.com",
        "from_address": "noreply@github.com",
        "subject": "Your code: 654321",
        "content": "Your verification code is 654321",
        "html_content": "...",
        "has_html": true,
        "timestamp": 1709654321,
        "created_at": "2024-03-05T12:18:41Z"
      }
    ],
    "count": 1
  }
}

4) Read a single email — includes plain text, HTML body, and metadata

Replace EMAIL_ID with an id returned from step 3. Also pass the inbox address as email (for deletes and attachment downloads too): the email is then read directly from its inbox instead of being searched by ID. With an API key the email parameter is optional, but sending it makes the lookup faster.

curl 'https://mail.chatgpt.org.uk/api/email/EMAIL_ID?email=demo@example.com' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example
{
  "success": true,
  "data": {
    "id": "e5a7f3...",
    "email_address": "demo@example.com",
    "from_address": "noreply@github.com",
    "subject": "Your code: 654321",
    "content": "Your verification code is 654321",
    "html_content": "<p>Your code is 654321</p>",
    "has_html": true,
    "timestamp": 1709654321,
    "raw_size": 2048,
    "created_at": "2024-03-05T12:18:41Z"
  }
}

5) Delete a single email by ID

With an API key the email parameter is optional, but sending it makes the lookup faster.

curl -X DELETE 'https://mail.chatgpt.org.uk/api/email/EMAIL_ID?email=demo@example.com' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example
{
  "success": true,
  "data": {
    "message": "Email deleted"
  }
}

6) Clear an entire inbox — deletes all emails for this address

Each call deletes one batch. While the response has "has_more": true, call it again until it returns false.

curl -X DELETE 'https://mail.chatgpt.org.uk/api/emails/clear?email=demo@example.com' \
  -H 'X-API-Key: PUBLIC_API_KEY'
Response example
{
  "success": true,
  "data": {
    "message": "Deleted 3 emails",
    "count": 3,
    "has_more": false
  }
}

Response Shape

Successful responses typically look like this. If you authenticate with an API key, pay attention to the quota information inside usage.

{
  "success": true,
  "data": {
    "email": "demo@example.com"
  },
  "usage": {
    "daily_limit": 200000,
    "used_today": 1,
    "remaining_today": 199999,
    "total_limit": 200000,
    "total_usage": 1,
    "remaining_total": 199999
  }
}

Extended Statistics

  • /api/statistics/24h returns one 24-hour hourly distribution window; use offset=1,2,... for older windows.
  • /api/statistics/top-subjects returns top email subjects.
  • /api/statistics/top-domains returns the most active domains.
  • /api/statistics/top-senders returns the most active senders.
GPTMail