# Quickstart

> Verify a sending domain, create an API key, and send your first email.

This guide takes you from a new project to a delivered email. You need access to your domain's DNS settings.

### Add a sending domain

In the dashboard, open **Email → Domains** and add a subdomain you control, such as `mail.example.com`. Nexiom Connect sends from subdomains so your root domain's existing email keeps working.

You can also [create the domain with the API](/docs/api/email-domains/create).

### Publish the DNS records

Copy each record shown for the domain into your DNS provider: the DKIM records, the bounce-handling MX and SPF records, and the optional DMARC record. Use the exact names and values from your dashboard.

Records usually propagate within minutes. Nexiom Connect re-checks pending domains automatically, and you can select **Check status** at any time. Provider-specific steps are in [DNS provider setup](/docs/learn/dns-providers).

### Create an API key

Open **API keys** and create a key with the **Email send only** permission. Copy the key when it is shown — it starts with `nc_` and is displayed only once.

Store it as an environment variable on your server:

```env
NEXIOM_API_KEY=nc_your_api_key
```

### Send an email

Send from an address on your verified domain. The `Idempotency-Key` header makes the request safe to retry.

```typescript title="Node.js"
import { NexiomConnect } from '@nexiom/connect';

const nexiom = new NexiomConnect({ apiKey: process.env.NEXIOM_API_KEY });

const { data, error } = await nexiom.emails.send(
  {
    from: 'hello@mail.example.com',
    to: 'reader@example.com',
    subject: 'Welcome',
    text: 'Thanks for joining us.',
  },
  { idempotencyKey: 'welcome-user-123' },
);

if (error) {
  throw new Error(error.message);
}

console.log(data.messageId);
```

```shell title="cURL"
curl -X POST "https://api-connect.nxiom.com/api/v1/emails/send" \
  -H "Authorization: Bearer $NEXIOM_API_KEY" \
  -H "Idempotency-Key: welcome-user-123" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "hello@mail.example.com",
    "to": "reader@example.com",
    "subject": "Welcome",
    "text": "Thanks for joining us."
  }'
```

```php title="PHP"
<?php

use Nexiom\Connect\NexiomConnect;

$nexiom = new NexiomConnect(getenv('NEXIOM_API_KEY'));

$email = $nexiom->emails->send(
    [
        'from' => 'hello@mail.example.com',
        'to' => 'reader@example.com',
        'subject' => 'Welcome',
        'text' => 'Thanks for joining us.',
    ],
    ['idempotencyKey' => 'welcome-user-123'],
);

echo $email['messageId'];
```

A `202 Accepted` response means the email is queued. It includes a `messageId` and one delivery ID per recipient.

### Check the delivery

Open **Email → Email logs** to see the delivery move from `queued` to `delivered`, or [retrieve it with the API](/docs/api/emails/retrieve). To be notified instead, [add a webhook](/docs/webhooks) for `email.delivered` and `email.bounced`.

## Next steps

- [Sending email](/docs/learn/sending) Recipients, templates, metadata, and idempotency.
- [Production checklist](/docs/learn/production-checklist) Everything to confirm before you go live.
- [Webhooks](/docs/webhooks) React to deliveries, bounces, and complaints.

---

Source: https://connect.nxiom.com/docs/quickstart
