Skip to main content

1. Create a workspace

curl -X POST https://api.torpedo.co.mz/api/v1/workspaces \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme Corp" }'
const res = await fetch('https://api.torpedo.co.mz/api/v1/workspaces', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Acme Corp' }),
})
const { data } = await res.json()
const apiKey = data.apiKey.key // store this — returned once only
Save the apiKey.key from the response. It is returned once only and cannot be recovered.

2. Add a domain

curl -X POST https://api.torpedo.co.mz/api/v1/domains \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "domain": "myapp.com" }'
const res = await fetch('https://api.torpedo.co.mz/api/v1/domains', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.TORPEDO_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ domain: 'myapp.com' }),
})
const { data } = await res.json()
// data.dns contains the DNS records to add
The response includes DNS records. Add all of them to your DNS provider:
TypeNameValue
CNAMEtorpedo1._domainkey.myapp.comtorpedo1.dkim.amazonses.com
CNAMEtorpedo2._domainkey.myapp.comtorpedo2.dkim.amazonses.com
CNAMEtorpedo3._domainkey.myapp.comtorpedo3.dkim.amazonses.com
TXTmyapp.comv=spf1 include:amazonses.com ~all
TXT_dmarc.myapp.comv=DMARC1; p=none;
DNS propagation can take a few minutes to a few hours depending on your provider’s TTL settings.

3. Verify the domain

Once DNS has propagated, trigger a verification check:
curl -X POST https://api.torpedo.co.mz/api/v1/domains/DOMAIN_ID/verification-checks \
  -H "X-API-Key: YOUR_API_KEY"
const res = await fetch(
  `https://api.torpedo.co.mz/api/v1/domains/${domainId}/verification-checks`,
  {
    method: 'POST',
    headers: { 'X-API-Key': process.env.TORPEDO_API_KEY },
  }
)
const { data } = await res.json()
console.log(data.status) // 'verified' when DNS is set up correctly

4. Send your first email

curl -X POST https://api.torpedo.co.mz/api/v1/emails \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <hello@myapp.com>",
    "to": "user@example.com",
    "subject": "Welcome to Acme",
    "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
    "text": "Welcome! Thanks for signing up."
  }'
const res = await fetch('https://api.torpedo.co.mz/api/v1/emails', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.TORPEDO_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: 'Acme <hello@myapp.com>',
    to: 'user@example.com',
    subject: 'Welcome to Acme',
    html: '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
    text: 'Welcome! Thanks for signing up.',
  }),
})
const { data } = await res.json()
console.log(data.id) // email ID
console.log(data.status) // 'queued'
import httpx

res = httpx.post(
    'https://api.torpedo.co.mz/api/v1/emails',
    headers={'X-API-Key': TORPEDO_API_KEY},
    json={
        'from': 'Acme <hello@myapp.com>',
        'to': 'user@example.com',
        'subject': 'Welcome to Acme',
        'html': '<h1>Welcome!</h1><p>Thanks for signing up.</p>',
        'text': 'Welcome! Thanks for signing up.',
    },
)
data = res.json()['data']
print(data['id'], data['status'])  # queued
The response is 202 Accepted — email is queued and will be delivered asynchronously.
You’ve sent your first email with Torpedo.

Next steps

Set up webhooks

Get notified on delivery, bounces, and complaints

Manage suppressions

Understand and manage the suppression list