# Vend airtime

> POST /api/v1/airtime

Source: https://useroutegate.com/docs/api/public/vendAirtime

Authenticate with a bearer API key (`rg_test_` in test mode, `rg_live_` in live).

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | yes |  |
| `wait` | query | integer | no | Long-poll up to this many seconds for a final state; capped by the server |

## Request

```bash
curl -X POST https://api.useroutegate.com/api/v1/airtime \
  -H "Authorization: Bearer $ROUTEGATE_API_KEY" \
  -H "Idempotency-Key: ord-00042-a1" \
  -H "Content-Type: application/json" \
  -d '{
  "network": "mtn",
  "network_id": "<network_id>",
  "destination": "+2348012345678",
  "receiver_phone_number": "<receiver_phone_number>",
  "phone_number": "<phone_number>",
  "amount_kobo": 100000,
  "amount": 0,
  "product_code": "mtn-sme-1gb",
  "service_id": "<service_id>",
  "serviceid": "<serviceid>",
  "client_reference": "ord-00042",
  "metadata": {}
}'
```

## Response

`202`

```json
{}
```

## Error

`402` Error envelope

```json
{
  "success": false,
  "data": "<data>",
  "message": "<message>",
  "code": "<code>"
}
```

## Give this to your coding agent

Read `https://useroutegate.com/docs/api/public/vendAirtime.md` and implement this call. Keep one `Idempotency-Key` per attempt at the same order, treat `202` as accepted and resolve the final state from the webhook. Amounts are integers in kobo.
