# Numbers and Plans

> Missed call API for pricing, your numbers, enabling missed-call routing, and quoting, buying and auto-renewing prepaid plans.

Source: https://edesy.in/docs/missed-call/api-reference/numbers-and-plans

Plan codes:

| Code | Plan |
|---|---|
| `missed_call_payg` | Pay as you go: number rental plus a per-event price for webhook deliveries |
| `missed_call_unlimited` | Unlimited: number rental plus plan fee, events free up to the fair-use limit |

Terms are 1, 3, 6 or 12 months. Prices exclude GST. See [Choose a Plan](https://edesy.in/docs/missed-call/getting-started/choose-a-plan).

## Get pricing

```
GET /v1/missed-calls/pricing
```

The plan catalogue, for building your own pricing screen.

| Field | Description |
|---|---|
| `currency` | `INR` |
| `gst_rate` | GST rate applied on top |
| `payg.event_price` | Price per event delivered to your webhook |
| `payg.number_monthly` | Standard monthly number rental |
| `plans[]` | `code`, `name`, `description`, `monthly_price` (plan fee on top of rental), `fair_use_limit`, `overage_price` and `terms[]` |
| `plans[].terms[]` | `months`, `price`, `list_price`, `discount_pct`, `rental_amount`, `plan_amount` |

## List numbers

```
GET /v1/missed-calls/numbers
```

Your numbers with their routing and plan state.

| Field | Description |
|---|---|
| `id` | Number id (use as `:id` and `phone_number_id`) |
| `number` | The phone number |
| `friendly_name` | The name you gave it |
| `is_missed_call` | `true` when missed-call routing is on |
| `monthly_rate` | Monthly rental for this number |
| `rental_paid_until` | When the paid rental runs out |
| `rental_status` | Rental status |
| `usage_this_month` | Missed-call events this month |
| `plan` | The plan state, as in [Get a number's plan](#get-a-number-s-plan) |

## Enable missed-call routing

```
POST /v1/missed-calls/numbers/:id/enable
```

Switches one of your numbers to missed-call routing, so calls to it are rejected with a busy tone and logged. Numbers bought in the missed-call portal are already switched on. Returns the number in the same shape as [List numbers](#list-numbers).

```bash
curl -X POST https://voice-api.edesy.in/v1/missed-calls/numbers/5e229f03-af3c-47f5-be45-5b11583a7c55/enable \
  -H "Authorization: Bearer vp_your_api_key"
```

## Get a number's plan

```
GET /v1/missed-calls/numbers/:id/plan
```

| Field | Description |
|---|---|
| `plan_code`, `plan_name` | Current plan |
| `status` | `active`, or `none` when no prepaid plan is active |
| `period_start`, `paid_until` | The paid period |
| `auto_renew` | Whether the term renews from the wallet |
| `fair_use_limit`, `overage_price`, `event_price` | What events cost on this number |
| `usage_this_month` | Events this month |
| `rental_paid_until` | When the number rental runs out |

## Quote a term

```
POST /v1/missed-calls/numbers/:id/plan/quote
```

Prices a term without charging.

```bash
curl -X POST https://voice-api.edesy.in/v1/missed-calls/numbers/NUMBER_ID/plan/quote \
  -H "Authorization: Bearer vp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "plan_code": "missed_call_unlimited", "months": 3 }'
```

The quote includes `total`, `list_total`, `discount`, `discount_pct`, `rental_amount`, `plan_amount`, the current and new paid-until dates (`rental_paid_until`, `new_rental_paid_until`, `plan_paid_until`, `new_plan_paid_until`), `wallet_balance` and `shortfall`.

## Buy a term

```
POST /v1/missed-calls/numbers/:id/plan
```

Charges the term to your wallet. Send the `total` from your quote as `acknowledged_total`, so you never pay a price you did not see:

```json
{ "plan_code": "missed_call_unlimited", "months": 3, "acknowledged_total": 3999 }
```

Returns `plan` (the new plan state), `total_charged` and `new_wallet_balance`.

| Error | Meaning |
|---|---|
| `402 insufficient_balance` | Wallet too low. The error includes `shortfall`, `total` and `wallet_balance` |
| `409 quote_stale` | The price changed. Get a new quote |
| `409 number_not_active` | The rental is overdue. Recharge the wallet to restore the number, then prepay |

## Auto-renew

```
PATCH /v1/missed-calls/numbers/:id/plan
```

```json
{ "auto_renew": true }
```

`auto_renew` is required. Returns the updated plan state.
