HTML version: https://cooperemail.com/create-email-address-programmatically

Programmatic email inbox

# Create email addresses programmatically, each with its own inbox

POST /api/v1/inboxes creates a working email address and its inbox in one call. Pick the username or let Cooper generate one, attach your own metadata, put it on your domain, and give it a TTL if it should disappear. The address can receive and send right away. Free is $0 a month with no card: 5 inboxes, 5,000 emails a month, and 1 custom domain.

## One call per address

Mailbox providers built for people make you create users in an admin console, pay per seat, and manage passwords. A programmatic email inbox is an API object instead: you create it from code when a customer signs up, a job starts, or an agent spins up, and you delete it when it is done.

username is 1 to 32 characters and becomes username@cooperemail.com. Omit it and Cooper picks box plus 8 hex characters. GET /api/v1/usernames/check?name= tells you whether a name is free before you try. client_id makes a retry return the original inbox instead of a duplicate.

```
AUTH=(-H "Authorization: Bearer $COOPER_API_KEY")
curl -s https://cooperemail.com/api/v1/inboxes "${AUTH[@]}" -H 'content-type: application/json' -d '{
  "username": "acme-support",
  "display_name": "Acme Support",
  "metadata": {"customer_id": "cus_123", "plan": "pro"},
  "client_id": "customer-cus_123"
}'
```

## Node and Python

There is no SDK to install. Any HTTP client works, and the response is JSON with id (inb_...) and email.

```
// Node 18+
const res = await fetch("https://cooperemail.com/api/v1/inboxes", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.COOPER_API_KEY,
             "content-type": "application/json" },
  body: JSON.stringify({ username: "job-8841", ttl_hours: 48 }),
});
const inbox = await res.json(); // { id: "inb_...", email: "job-8841@cooperemail.com", ... }

# Python
import os, requests
inbox = requests.post("https://cooperemail.com/api/v1/inboxes",
    headers={"Authorization": "Bearer " + os.environ["COOPER_API_KEY"]},
    json={"username": "job-8841", "ttl_hours": 48}).json()
```

## Addresses on your own domain

Add a domain with POST /api/v1/domains, publish the MX, SPF, DKIM, DMARC, and verify records it returns, and then POST /api/v1/inboxes with domain creates username@yourdomain. POST /api/v1/domains/:id/setup-link returns one link a person can open to see and copy every record. Free includes 1 custom domain, Starter 15, and Pro 200.

## Bulk, temporary, and aliases

POST /api/v1/inboxes/batch creates up to 5 at a time on Free, 25 on Starter, and 100 on Pro. ttl_hours or expires_at on either call makes inboxes temporary; the daily cron deletes them after the deadline.

If you only need many addresses for one mailbox, plus addresses are free: name+anything@cooperemail.com lands in the same inbox with the tag stored as alias. They are not extra inboxes and do not count toward the limit.

## Give each address its own key

An API key can be limited to one inbox and a set of permissions, so a sub-agent or a customer workspace cannot read other inboxes. Workspaces group inboxes under sub-accounts with their own quotas. Another account's inbox always returns HTTP 404 inbox_not_found.

## What you can do with the address right away

Receive: mail is stored within seconds and can be listed, searched, waited on, or pushed to a webhook. Send: POST /api/v1/inboxes/:id/messages with text, HTML, and attachments, with Idempotency-Key for safe retries. Reply in thread, forward, keep drafts for human approval, and set a per-inbox signature.

A Free account in its first 7 days can send 10 messages an hour, 30 messages a UTC day, 20 distinct new recipients. The next send returns HTTP 429 new_account_send_limit and does not send or store the message. Starter, Pro, and grandfathered accounts are exempt. After that window, Free has no standing daily cap.

## Naming and lookup patterns

Use a stable username derived from your own id (customer-123, job-8841) when people will see the address, and a random one when they will not. Put your ids in metadata and labels rather than in the address, then find inboxes again with GET /api/v1/inboxes?label=. display_name sets the From name that recipients see.

Use client_id when the create call runs inside a retrying job. The same client_id returns the original inbox with HTTP 200 and idempotent true, so a retry never creates a second address.

## FAQ

### Can I create addresses in bulk?

Yes. POST /api/v1/inboxes/batch with count, an optional prefix, labels, and a TTL creates up to 100 at a time on Pro.

### How do I create an email address with an API?

Get a key with POST https://cooperemail.com/api/v1/onboard (no auth), then POST /api/v1/inboxes with an optional username. The response includes the address and the inbox id.

### How many addresses can I create?

5 inboxes on Free, 25 on Starter, and 300 on Pro. Plus addresses on an inbox are unlimited and do not count.

### Can I create addresses on my own domain?

Yes, after the domain verifies. Pass domain on POST /api/v1/inboxes. Use a subdomain if your root domain already has another mail provider.

### Is there a password for each address?

No. Access is by API key or OAuth token. There is no IMAP or SMTP login per address.

## Related

[Inbound email API](/inbound-email-api) · [Temp mail API](/temp-mail-api) · [POST /inboxes](/docs/reference/inboxes-create) · [Plus addresses](/docs/aliases) · [Custom domains](/domains) · [Docs](/docs) · [Pricing](/pricing)

Operator: Avatar 8 LLC (ops@avatar33.com). Last updated 2026-11-22.

Canonical: https://cooperemail.com/create-email-address-programmatically
