docs
Getting started

Quickstart

Make an account, verify a domain, and send your first mail with cURL or an SDK.

Make an account

Open the console and sign in. A new workspace gets the credits of its first day at once: 100 mails, and 100 more each day.

Add your domain

In the console, open your app and add the domain you send from, for example acme.com. The console shows the DNS records to add:

TypeNameValue
TXT1billion._domainkey.acme.comthe DKIM public key of the domain
CNAME1billion.acme.comour return path, which holds the SPF and the MX
TXT_dmarc.acme.coma DMARC policy (recommended, not required)

The console checks the records for you. The domain can send when DKIM, SPF and MX pass. See Domains and DNS.

Make an API key

In the app, make an API key and keep it in an environment variable, ONEBILLION_API_KEY. The SDKs read it from there. Use it only on a server: an API key must never reach a browser.

Send

curl https://api.1billion.clowk.in/send \
  -H "Authorization: Bearer $ONEBILLION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <hi@acme.com>",
    "to": "jane@example.com",
    "subject": "Your code",
    "body": { "text": "Your code is 482 913" },
    "priority": "high"
  }'
# Gemfile
gem "1billion"

# config/environments/production.rb
config.action_mailer.delivery_method = :onebillion

That is all: the key comes from ONEBILLION_API_KEY. Your mailers do not change. Send with deliver_later.

import { OneBillion } from "@clowk/1billion"

const mail = new OneBillion() // the key of ONEBILLION_API_KEY

const { data, error } = await mail.emails.send({
  from: "Acme <hi@acme.com>",
  to: "jane@example.com",
  subject: "Your code",
  text: "Your code is 482 913",
  priority: "high",
})
client := onebillion.New("") // the key of ONEBILLION_API_KEY

_, err := client.Emails.Send(ctx, onebillion.Mail{
	From:     "Acme <hi@acme.com>",
	To:       []string{"jane@example.com"},
	Subject:  "Your code",
	Text:     "Your code is 482 913",
	Priority: "high",
})

The answer is 202, with the id of each message:

{ "messages": [{ "id": "9f2c…", "to": "jane@example.com", "status": "accepted" }] }

Follow the mail

Open the message in the console, call GET /messages/{id}, or add a webhook to get an event when it is delivered.

On this page