<!-- https://missblue.dev/docs/phone-verification -->

# Phone verification

The person texts a six-digit code to your number, so a signup form never spends your line's new contacts, and each verification starts a conversation they began. You get verification.completed with the phone it came from. Dedicated iMessage numbers only.

Base URL: `https://api.missblue.dev`

Every request carries `Authorization: Bearer $MISS_BLUE_KEY`.

### POST /v1/projects/{id}/verifications

Hand out a code for somebody to text in.

Send the person to `url` (the code, a QR code on a computer and an Open Messages button on a phone), or show `code` and `sms_link` on your own page. The prefilled text is just the six digits, and the text has to be the code and nothing else: a code inside a sentence is an ordinary message. When it arrives, `status` becomes `verified`, `verified_phone` is the phone it came from, `verification.completed` fires, and the line answers with `reply_text`. A code from another phone than `phone`, or past its time, verifies nothing.

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `number_id` | `uuid` | no | The number to text. May be left out when the project has one number that can take codes. |
| `phone` | `string` | no | Accept the code only from this phone (E.164, or ten North American digits). |
| `reference` | `string` | no | Your own id for it, up to 200 characters, handed back untouched. |
| `business_name` | `string` | no | What the page and the reply call you. Defaults to your organization's name. |
| `return_url` | `string` | no | https only. The hosted page sends them here once verified, with ?verification=<id> added. |
| `expires_in` | `integer` | no | Seconds the code lasts, 60 to 3600. Default 600. |
| `reply` | `boolean` | no | false sends no answer once it is done. |
| `reply_text` | `string` | no | The answer's words, up to 300 characters. Default: Thanks, you're verified with {business_name}. Reply here anytime. |

Request body:

```json
{
  "reference": "user_123",
  "phone": "+15551230002",
  "return_url": "https://example.com/welcome"
}
```

Example:

```bash
curl -X POST https://api.missblue.dev/v1/projects/3c9a1f77-2d64-4b0e-8a5c-7e1d4b2f9a60/verifications \
  -H "Authorization: Bearer $MISS_BLUE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "user_123",
    "phone": "+15551230002",
    "return_url": "https://example.com/welcome"
  }'
```

Response:

```json
{
  "id": "5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38",
  "status": "pending",
  "code": "482913",
  "number": { "id": "8f14e45f-ceea-467a-9a1b-1b1e5f9e2c3d", "handle": "+12025550100" },
  "sms_link": "sms:+12025550100?&body=482913",
  "url": "https://missblue.dev/v/hT3k9QzV0bW2mY7cR1sLpA",
  "business_name": "Hippo",
  "phone": "+15551230002",
  "verified_phone": null,
  "verified_service": null,
  "reference": "user_123",
  "expires_at": "2026-11-24T18:10:00Z",
  "verified_at": null
}
```

Errors:

- `400` — A number that cannot take codes (Twilio, shared), or a field that does not check out.
- `429` — More than 1,000 codes in an hour on this project.

### GET /v1/projects/{id}/verifications/{verification_id}

One verification, to poll until it is verified.

Example:

```bash
curl -X GET https://api.missblue.dev/v1/projects/3c9a1f77-2d64-4b0e-8a5c-7e1d4b2f9a60/verifications/5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38 \
  -H "Authorization: Bearer $MISS_BLUE_KEY"
```

Response:

```json
{ "id": "5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38", "status": "verified", "verified_phone": "+15551230002", "verified_service": "imessage", "reference": "user_123", "verified_at": "2026-11-24T18:01:12Z" }
```

### GET /v1/projects/{id}/verifications

The project's latest verifications, newest first.

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `limit` | `integer` | no | 1 to 200, default 50. |

Example:

```bash
curl -X GET https://api.missblue.dev/v1/projects/3c9a1f77-2d64-4b0e-8a5c-7e1d4b2f9a60/verifications \
  -H "Authorization: Bearer $MISS_BLUE_KEY"
```

Response:

```json
{ "data": [{ "id": "5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38", "status": "verified", "verified_phone": "+15551230002", "reference": "user_123" }] }
```

### DELETE /v1/projects/{id}/verifications/{verification_id}

Withdraw a code that has not been used.

One already used, withdrawn or past its time is returned as it is, so a retry is not an error.

Example:

```bash
curl -X DELETE https://api.missblue.dev/v1/projects/3c9a1f77-2d64-4b0e-8a5c-7e1d4b2f9a60/verifications/5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38 \
  -H "Authorization: Bearer $MISS_BLUE_KEY"
```

Response:

```json
{ "id": "5e0b7a3c-91d2-4f6e-8a47-2c1d9e6b0f38", "status": "cancelled" }
```
