# Testmail — Full Technical Reference & Developer Guide > Website: https://tempmail.codaipro.com > API Base: https://api-testmail.codaipro.com > Blog Feed: https://tempmail.codaipro.com/rss.xml > Author: https://tempmail.codaipro.com/authors/pankaj-kumawat --- ## 1. System Overview & Architecture Testmail is a high-density companion service and developer gateway built on top of `testmail.app`. It provisions on-demand temporary disposable mailboxes under the domain `inbox.testmail.app` and streams incoming messages in real time over Server-Sent Events (SSE). ### Key Architectural Tenets: 1. **Public Ephemeral Tier**: By default, emails displayed to web clients auto-purge after 10 minutes (`retention_minutes=10`) to ensure sensitive one-time passwords (OTPs) and activation tokens do not linger publicly. 2. **Admin Historical Archive**: When accessed via authorized admin endpoints (`retention_minutes=0`), historical retention filtering is disabled, allowing administrative review of the complete unpruned inbox. 3. **Open Developer Gateway**: The API is 100% free and open with unconstrained Cross-Origin Resource Sharing (`CORS: *`). Developers can call endpoints directly from frontend client apps, curl commands, or CI/CD test runners without authenticating or generating personal API keys. 4. **Client Attribution**: In-memory telemetry tracks consuming domains (`Origin` / `Referer`) and client tools (`User-Agent`) to distinguish official web traffic from automated developer scripts. --- ## 2. API Endpoints Reference ### Base URL Production: `https://api-testmail.codaipro.com` Local Development: `http://localhost:8000` --- ### Endpoint: Generate Disposable Address - **Method**: `POST` - **Path**: `/api/emails/generate` - **Query Parameters**: - `tag` (string, optional): Custom tag for the mailbox (e.g. `signup`, `trial-01`). If omitted, a random 6-character alphanumeric tag is automatically created. - **Request Body**: None - **Response**: `201 Created` ```json { "email": "demo.signup-01@inbox.testmail.app", "tag": "signup-01", "namespace": "demo" } ``` - **Example cURL**: ```bash curl -X POST "https://api-testmail.codaipro.com/api/emails/generate?tag=auth-check" \ -H "Content-Type: application/json" ``` --- ### Endpoint: List / Search Emails - **Method**: `GET` - **Path**: `/api/emails/` - **Query Parameters**: - `tag` (string, optional): Filter by exact tag match. - `tag_prefix` (string, optional): Filter by tag prefix. - `from_contains` (string, optional): Case-insensitive substring match on sender address. - `subject_contains` (string, optional): Case-insensitive substring match on email subject. - `has_attachments` (boolean, optional): Set `true` for emails with attachments, `false` otherwise. - `limit` (integer, default `20`, max `100`): Maximum number of emails to retrieve. - `offset` (integer, default `0`): Pagination offset. - `timestamp_from` (integer, optional): Unix epoch timestamp in milliseconds. - `timestamp_to` (integer, optional): Unix epoch timestamp in milliseconds. - `retention_minutes` (integer, optional, default `10`): Retention cutoff in minutes. Set `0` for unexpired admin archive. - `livequery` (boolean, default `false`): Wait up to 60 seconds for a new email to arrive if none match immediately. - `pretty` (boolean, default `false`): Return formatted JSON. - **Response**: `200 OK` ```json { "result": "success", "message": null, "count": 1, "limit": 20, "offset": 0, "has_more": false, "next_offset": null, "prev_offset": null, "emails": [ { "id": "msg-8f92a10c", "from": "support@example.com", "from_parsed": [{"address": "support@example.com", "name": "Example Support"}], "to": "demo.auth-check@inbox.testmail.app", "subject": "Confirm your account", "tag": "auth-check", "timestamp": 1788936000000, "has_attachments": false, "has_html": true, "text_preview": "Welcome! Please verify your email by clicking the link inside..." } ] } ``` --- ### Endpoint: Real-Time Server-Sent Events (SSE) Stream - **Method**: `GET` - **Path**: `/api/emails/stream` - **Query Parameters**: - `client` (string, optional): Client identifier (e.g. `?client=official-web`). - **Headers**: - `Accept: text/event-stream` - **Events Emitted**: - `event: connected` — Emitted immediately upon connection. `data: {"message":"SSE connected","timestamp":1788936000000}` - `event: heartbeat` — Emitted every 30 seconds to keep HTTP connections alive through proxies and cloud firewalls. `data: {"timestamp":1788936030000}` - `event: new_email` — Broadcasts freshly received emails to all active subscribers. `data: { ...EmailSummaryModel JSON... }` - **Concurrency**: Capped at 10 concurrent subscribers. Exceeding returns `429 Rate Limited`. --- ### Endpoint: Get Email Detail by ID - **Method**: `GET` - **Path**: `/api/emails/{id}` - **Path Parameters**: - `id` (string, required): The unique identifier of the email. - **Response**: `200 OK` ```json { "id": "msg-8f92a10c", "from_addr": "support@example.com", "from_parsed": [{"address": "support@example.com", "name": "Example Support"}], "to_addr": "demo.auth-check@inbox.testmail.app", "subject": "Confirm your account", "timestamp": 1788936000000, "tag": "auth-check", "html": "
Click here
", "text": "Click here: https://example.com/verify?token=xyz", "headers": [ {"key": "date", "line": "Date: Tue, 08 Sep 2026 12:00:00 GMT"}, {"key": "message-id", "line": "Message-ID: