Quickstart

Create an API key, verify a domain and send your first email in a few minutes.

1. Create an API key

Sign up, open Dashboard → API Keys and create a key. Keys start with tp_live_ and are shown once — store it in a secret manager or an environment variable such as BYTESMS_API_KEY. See Authentication for the permission levels.

2. Send a test email right away

Before you verify a domain you can already send from [email protected] — but only to members of your workspace and to the @test.bytesms.com test addresses:

# Send a test email
curl -X POST 'https://api.bytesms.com/api/v1/emails' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"from":"Bytesms <[email protected]>","to":["[email protected]"],"subject":"Hello from Bytesms","html":"<p>It works!</p>"}'
Response
{
  "id": "cmg4k2x7a0001l8v9h3q2d5rt"
}

3. Add and verify your domain

To send to anyone else, add a domain you own. Use a subdomain such as mail.example.com if you want to keep sending reputation separate from your root domain.

# Add a domain
curl -X POST 'https://api.bytesms.com/api/v1/domains' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"name":"example.com"}'

The response lists the DNS records to publish at your DNS provider — a DKIM TXT record and a return-path CNAME (plus recommended SPF and DMARC records). After publishing them, trigger a check:

# Verify the domain
curl -X POST 'https://api.bytesms.com/api/v1/domains/{domain_id}/verify' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx'

Verification is also re-checked automatically every few minutes; the domain moves from pending to verified once the DKIM record and the return path (or SPF) resolve. Details: Domains.

4. Send your first real email

# Send an email
curl -X POST 'https://api.bytesms.com/api/v1/emails' \
  -H 'Authorization: Bearer tp_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{"from":"Acme <[email protected]>","to":["[email protected]"],"subject":"Welcome to Acme","html":"<h1>Welcome!</h1><p>Thanks for signing up.</p>"}'

5. Track what happens

  1. Poll GET /api/v1/emails/{id} — its last_event becomes sent, then delivered (or bounced).
  2. Or add a webhook endpoint and receive email.delivered, email.bounced and the other events as they happen.

Keep keys on the server

Never ship an API key in browser or mobile code. For a key that can only send (and only from one domain), create a sending-access key.