# Idempotent sends: the options argument

```js
await resend.emails.send(
  {
    from: '[SENDER]',
    to: ['[RECIPIENT]'],
    subject: 'Welcome',
    html: '&lt;strong&gt;It works!&lt;/strong&gt;',
  },
  {
    idempotencyKey: 'welcome-user/[USER-ID]',
  },
);
```

## The rules, from the docs

- Include a key on any send you might retry, so the same request processed twice
  still sends once.
- The key must be unique per API request. Namespace it by what the email is:
  `welcome-user/[USER-ID]`, not a constant. A reused key for a different email
  is treated as a repeat of the first request.
- Keys expire after 24 hours. A retry three days later is a new send.
- Maximum length is 256 characters.
- Supported on the send endpoint and the batch endpoint.

## Checklist

- Build the key from the business event (user id, order id), never a hardcoded
  string shared across sends.
- Use idempotency keys wherever a timeout or retry could double-send: webhooks,
  queues, and anything with automatic retries.
- On retry-after-timeout, resend with the SAME key, not a new one. A new key
  defeats the whole mechanism.