> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zerodrop.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream emails via SSE

> Opens a Server-Sent Events stream for the given inbox. The server polls Redis with an exponential backoff strategy and pushes an event the moment an email arrives. The connection closes automatically after the first email or after 30 seconds (timeout).

**Backoff strategy:**
- 0–2s: polls every 500ms
- 2–10s: polls every 1000ms
- 10s+: polls every 2000ms

**Events:**
- `: connected` — connection established
- `: keepalive` — heartbeat every 10s to prevent proxy timeout
- `data: {email JSON}` — email arrived
- `data: __timeout__` — no email within 30s, connection closing

For Node.js environments, use `fetch()` with `ReadableStream` rather than `EventSource` (which is browser-only).



## OpenAPI

````yaml /openapi.json get /api/inbox/{name}/stream
openapi: 3.1.0
info:
  title: ZeroDrop API
  version: 1.0.0
  description: >-
    Disposable email inboxes for CI pipelines. No signup. No Docker. No SMTP
    config.


    Base URL: `https://zerodrop.dev`


    The ZeroDrop API is a REST API that allows you to fetch emails from
    disposable inboxes. Inboxes are generated client-side — no API call needed
    to create one. Emails are stored for 30 minutes then automatically deleted.


    For most use cases, use the [zerodrop-client
    SDK](https://npmjs.com/package/zerodrop-client) which handles polling, SSE,
    and OTP extraction automatically.
  contact:
    email: support@zerodrop.dev
    url: https://zerodrop.dev/contact
  license:
    name: MIT
    url: https://github.com/zerodrop-dev/zerodrop-sdk/blob/master/LICENSE
servers:
  - url: https://zerodrop.dev
    description: Production
security: []
tags:
  - name: Inbox
    description: Fetch and stream emails from disposable inboxes.
  - name: Waitlist
    description: Join the Workspaces waitlist.
paths:
  /api/inbox/{name}/stream:
    get:
      tags:
        - Inbox
      summary: Stream emails via SSE
      description: >-
        Opens a Server-Sent Events stream for the given inbox. The server polls
        Redis with an exponential backoff strategy and pushes an event the
        moment an email arrives. The connection closes automatically after the
        first email or after 30 seconds (timeout).


        **Backoff strategy:**

        - 0–2s: polls every 500ms

        - 2–10s: polls every 1000ms

        - 10s+: polls every 2000ms


        **Events:**

        - `: connected` — connection established

        - `: keepalive` — heartbeat every 10s to prevent proxy timeout

        - `data: {email JSON}` — email arrived

        - `data: __timeout__` — no email within 30s, connection closing


        For Node.js environments, use `fetch()` with `ReadableStream` rather
        than `EventSource` (which is browser-only).
      operationId: streamInbox
      parameters:
        - name: name
          in: path
          required: true
          description: The inbox name (without the domain).
          schema:
            type: string
            example: swift-x7k2m
      responses:
        '200':
          description: SSE stream opened successfully
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  Server-Sent Events stream. Each event is separated by double
                  newlines.
                example: |+
                  : connected

                  : keepalive

                  data: {"id":"...","from":"...","subject":"..."}


````