# Comprar dominios de envío

Source: https://won.dev/es/docs/email/domains-create

`POST https://api.won.dev/v1/email/domains`

Compra dominios de envío para un remitente: cada uno trae 3 buzones que ya están calentados, envía solo para ese remitente y suma 45 correos al día a lo que puede enviar. No hay nada que configurar: ni DNS, ni buzones en los que iniciar sesión, y las respuestas las leemos nosotros. Un dominio cuesta USD 0.9 al día, 30 días cada vez a partir de la fecha de renovación. Todos los dominios se renuevan el mismo día del mes, así que el primer período va de hoy hasta ese día: de 15 a 45 días, que se pagan ahora. Cada uno se renueva solo con tu saldo 3 días antes de `period_end`; si el saldo no alcanza, se vuelve a intentar hasta el día anterior, y después se deja el dominio. Sin `confirm: true` solo cotiza el precio, la fecha y cuántos hay disponibles, y no cambia nada. Un dominio nuevo queda listo en minutos (`domain.ready`) y envía 15 correos el primer día, hasta llegar a su máxima velocidad en 5 días. Las campañas del remitente que estaban pausadas por `no_domains` siguen solas en cuanto está listo. Falla con `out_of_stock` cuando no hay suficientes a la venta, antes de cobrar nada. Hasta 10 a la vez. Una clave de prueba solo recibe la cotización: en el sandbox cada remitente ya tiene un dominio simulado. Cada llamada que confirma vuelve a comprar: envía un `Idempotency-Key` para que un reintento sea seguro.

- **Cobro:** `email_domain_day` USD 0.9: un dominio de envío durante un día. Con `confirm: true` se cobran de inmediato los días hasta `period_end`, y después 30 cada vez, 3 días antes de cada renovación. Sin eso, la llamada solo cotiza, gratis.

Una clave de prueba (`won_test_...`) ejecuta esto en el [sandbox](/es/docs/email#sandbox): no se envía ni se cobra nada.

## Parámetros [#parameters]

Los parámetros van en el cuerpo JSON. Las solicitudes `POST` también aceptan el encabezado `Idempotency-Key`; consulta [Enviar una solicitud dos veces](/es/docs/email#idempotency).

| Parámetro | Tipo | Obligatorio | Descripción (texto original de la API) |
| --- | --- | --- | --- |
| `sender_id` | string | sí | The sender to buy them for, such as `snd_4k2m9x7p1q8w3e5r`. They never send for another. |
| `count` | integer | no | How many domains, 1 to 10. Default: `1`. |
| `confirm` | boolean | no | True buys them and charges this period. False, the default, only quotes it. Default: `false`. |
| `max_cost` | number | no | Spending cap for this call in US dollars. If the call could cost more, it fails with `budget_exceeded` before anything is charged. |

## Respuesta [#response]

Los errores se describen en [Errores](/es/docs/errors).

| Campo | Tipo | Descripción (texto original de la API) |
| --- | --- | --- |
| `data` | object | The domains and their price. |
| `data.confirmed` | boolean | True when the domains were bought. False on a quote: nothing changed. |
| `data.sender_id` | string |  |
| `data.count` | integer | How many domains. |
| `data.price` | number | What they cost now, together, in US dollars: this period, up to `period_end`. |
| `data.price_per_domain` | number | What one costs for this period, in US dollars. |
| `data.days` | integer | Days this period has, today included. |
| `data.period_end` | string | When this period ends and they renew, at `price_per_month` each, charged from your balance 3 days before. |
| `data.price_per_month` | number | What one domain costs for 30 days, from then on. |
| `data.daily_limit` | integer | What they add to the sender's day at full speed: 45 each. |
| `data.first_day_limit` | integer | What they send on their first day, together. |
| `data.days_to_full_speed` | integer | Days until they send at full speed. |
| `data.in_stock` | integer | How many domains can be bought right now. |
| `data.domains` | object[] | The domains bought, `setting_up` for a few minutes. Empty on a quote. |
| `data.domains[].id` | string | Domain ID, such as `dom_5r4k2m9x7p1q8w3e`. |
| `data.domains[].sender_id` | string | The sender it sends for. It never sends for another. |
| `data.domains[].domain` | string \| null | The domain name. Null for the minutes after it was paid for, until one is chosen and bought. |
| `data.domains[].status` | `setting_up` \| `ramping` \| `active` \| `paused` \| `ending` \| `released` \| `failed` | `setting_up` for the minutes it takes to buy it and set up its mailboxes. `ramping` while it sends a few emails a day more each day, for 5 days. `active` at full speed. `paused` while we hold it back. `ending` once it will not renew: it sends until 1 day before `period_end`. Final: `released` (its mailboxes are gone) and `failed` (it could not be bought; what it cost went back to the balance). |
| `data.domains[].end_reason` | `canceled` \| `unpaid` \| `replaced` \| `removed` \| null | Why it ends or ended: `canceled` by you, `unpaid` (the renewal could not be charged), `replaced` by a new domain, `removed` by us. Null while it renews. |
| `data.domains[].mailboxes` | object[] | Its mailboxes, 3 as a rule. Empty while it is set up. Replies to them are read for you: you never sign in to them. |
| `data.domains[].mailboxes[].address` | string | The address emails go out from, and replies come back to. |
| `data.domains[].mailboxes[].name` | string | The name it sends under, the one it was warmed up with. |
| `data.domains[].daily_limit` | integer | What its mailboxes may send today, together. |
| `data.domains[].full_daily_limit` | integer | What they send a day at full speed, together: 45. |
| `data.domains[].sent_today` | integer | Emails they sent since midnight UTC. Answers to replies are left out. |
| `data.domains[].full_speed_at` | string \| null | When it reaches full speed, while it is `ramping`. Null otherwise. |
| `data.domains[].price_per_month` | number | What a renewal costs, for 30 days, in US dollars. |
| `data.domains[].period_end` | string | When the paid period ends. The next one is charged from your balance a few days before, as an ISO 8601 time in UTC. |
| `data.domains[].renews` | boolean | Whether it renews at `period_end`. False once you canceled it. |
| `data.domains[].ends_at` | string \| null | When it stops sending and its mailboxes are given up, when it will not renew. Null while it renews. |
| `data.domains[].renewal_failed_at` | string \| null | When charging the renewal last failed for want of balance. It is tried again until the day before `period_end`, then the domain is given up. Null when nothing failed. |
| `data.domains[].stats` | object | The last 30 days. |
| `data.domains[].stats.sent` | integer | Emails sent. |
| `data.domains[].stats.bounced` | integer | Of them, how many bounced because the mailbox does not exist. |
| `data.domains[].stats.bounce_rate` | number | `bounced` over `sent`, 0 to 1. |
| `data.domains[].stats.complaints` | integer | Recipients who reported its emails as spam. |
| `data.domains[].test` | boolean | The simulated domain of a test key's sender: it never sends for real. |
| `data.domains[].created_at` | string | When it was bought, as an ISO 8601 time in UTC. |
| `data.domains[].ready_at` | string \| null | When its mailboxes could send. |
| `data.domains[].ended_at` | string \| null | When it was released, or failed. |
| `notice` | string \| null | A plain sentence when there is something to know about this answer. Null otherwise. |
| `usage` | object | What this call was charged, and the balance left. |
| `usage.cost` | number | What this call cost, in US dollars. |
| `usage.breakdown` | object[] | Every billing unit that came back, charged or not. Empty when nothing did. |
| `usage.breakdown[].unit` | `email_domain_day` | What is counted. |
| `usage.breakdown[].records` | integer | How many were returned and charged. |
| `usage.breakdown[].already_paid` | integer | How many more were returned for free, because this organization paid for them in the last 30 days. |
| `usage.breakdown[].cost` | number | What they cost, in US dollars. |
| `usage.balance` | number | The balance left after this call, in US dollars. |
| `usage.replayed` | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |

## Ejemplo [#example]

```bash
curl https://api.won.dev/v1/email/domains \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "sender_id": "snd_4k2m9x7p1q8w3e5r",
  "count": 1,
  "confirm": true,
  "max_cost": 30
}'
```

```json
{
  "data": {
    "confirmed": true,
    "sender_id": "snd_4k2m9x7p1q8w3e5r",
    "count": 1,
    "price": 28.8,
    "price_per_domain": 28.8,
    "days": 32,
    "period_end": "2026-12-28T00:00:00.000Z",
    "price_per_month": 27,
    "daily_limit": 45,
    "first_day_limit": 15,
    "days_to_full_speed": 5,
    "in_stock": 24,
    "domains": [
      {
        "id": "dom_5r4k2m9x7p1q8w3e",
        "sender_id": "snd_4k2m9x7p1q8w3e5r",
        "domain": null,
        "status": "setting_up",
        "end_reason": null,
        "mailboxes": [],
        "daily_limit": 0,
        "full_daily_limit": 45,
        "sent_today": 0,
        "full_speed_at": null,
        "price_per_month": 27,
        "period_end": "2026-12-28T00:00:00.000Z",
        "renews": true,
        "ends_at": null,
        "renewal_failed_at": null,
        "stats": {
          "sent": 0,
          "bounced": 0,
          "bounce_rate": 0,
          "complaints": 0
        },
        "test": false,
        "created_at": "2026-11-26T10:15:02.000Z",
        "ready_at": null,
        "ended_at": null
      }
    ]
  },
  "notice": null,
  "usage": {
    "cost": 28.8,
    "breakdown": [
      {
        "unit": "email_domain_day",
        "records": 32,
        "already_paid": 0,
        "cost": 28.8
      }
    ],
    "balance": 19.28,
    "replayed": false
  }
}
```