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

# Quickstart

> Send your first email in under 5 minutes

## 1. Create a workspace

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.torpedo.co.mz/api/v1/workspaces \
    -H "Content-Type: application/json" \
    -d '{ "name": "Acme Corp" }'
  ```

  ```js Node.js theme={null}
  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
  ```
</CodeGroup>

Save the `apiKey.key` from the response. It is returned **once only** and cannot be recovered.

***

## 2. Add a domain

<CodeGroup>
  ```bash cURL theme={null}
  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" }'
  ```

  ```js Node.js theme={null}
  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
  ```
</CodeGroup>

The response includes DNS records. Add all of them to your DNS provider:

| Type  | Name                            | Value                               |
| ----- | ------------------------------- | ----------------------------------- |
| CNAME | `torpedo1._domainkey.myapp.com` | `torpedo1.dkim.amazonses.com`       |
| CNAME | `torpedo2._domainkey.myapp.com` | `torpedo2.dkim.amazonses.com`       |
| CNAME | `torpedo3._domainkey.myapp.com` | `torpedo3.dkim.amazonses.com`       |
| TXT   | `myapp.com`                     | `v=spf1 include:amazonses.com ~all` |
| TXT   | `_dmarc.myapp.com`              | `v=DMARC1; p=none;`                 |

<Note>
  DNS propagation can take a few minutes to a few hours depending on your provider's TTL settings.
</Note>

***

## 3. Verify the domain

Once DNS has propagated, trigger a verification check:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.torpedo.co.mz/api/v1/domains/DOMAIN_ID/verification-checks \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```js Node.js theme={null}
  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
  ```
</CodeGroup>

***

## 4. Send your first email

<CodeGroup>
  ```bash cURL theme={null}
  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."
    }'
  ```

  ```js Node.js theme={null}
  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'
  ```

  ```python Python theme={null}
  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
  ```
</CodeGroup>

The response is `202 Accepted` — email is queued and will be delivered asynchronously.

<Check>You've sent your first email with Torpedo.</Check>

## Next steps

<CardGroup cols={2}>
  <Card title="Set up webhooks" icon="webhook" href="/docs/guides/webhooks">
    Get notified on delivery, bounces, and complaints
  </Card>

  <Card title="Manage suppressions" icon="ban" href="/docs/guides/manage-suppressions">
    Understand and manage the suppression list
  </Card>
</CardGroup>
