# Line lifecycle

> Where a line is, and when billing starts.

Lines you order are created on the network when you order them. (You can also claim a ready
number from [stock](/docs/numbers-stock); it is live the moment you claim it.) Billing starts
when a line goes `active`: it is charged a month in advance, then every month until you release it.

```text
pending → active ⇄ suspended → released
port_pending → active
pending / port_pending → failed
pending / port_pending → released   (cancelled before going active)
```

## States

| State | Meaning |
| --- | --- |
| `pending` | Ordered and being set up on the network. Not billed. |
| `port_pending` | Waiting for your current carrier to release the number. Not billed. |
| `active` | The line has its number and, for an eSIM, its activation code. Billing starts. |
| `failed` | The line could not be set up. `failure.code` says why: `port_rejected` (a port-in the current carrier rejected), `payment_failed` (your card kept declining the line's charge), or `network_error`. Not billed. If a line failed with `network_error` while the network was still working on it, we keep checking for a week: if the network finishes after all, the line goes `active` and you get `line.active`. |
| `suspended` | Paused for a usage review or an unpaid balance. It can be reinstated. |
| `released` | You released the line, cancelled it while it was being set up, or ported it out. After you ask to release, the line keeps its state with `release_requested_at` set until the network confirms; billing stops when you ask. |

## Port-in failures

When the current carrier rejects a port-in, the line goes `failed` with
`failure.code = "port_rejected"` and `failure.fields` naming what did not match:
`account_number`, `transfer_pin`, `zip`, `first_name` or `last_name`. Fix them and order the
line again. `number` means another carrier already has a port pending for the number: cancel
that port first, then order again. You get a `line.failed` webhook either way.
