# Quickstart

Two calls: send a verification, then check the code the user typed. With a test key nothing is sent, nothing is billed and the code is always `000000`.

## 1. Send a code

```bash
curl https://api.authtext.com.au/v1/verifications \
  -H "Authorization: Bearer $AUTHTEXT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+61400000001", "channel": "sms"}'
```

```json
{
  "id": "ver_01JD3X9K2M7Q8R5T6V1W0XYZAB",
  "status": "pending",
  "channel": "sms",
  "to": "+61*****0001",
  "expires_at": "2026-11-20T00:10:00.000Z",
  "attempts_remaining": 5
}
```

Keep the `id`. The response never holds the code or the full number.

## 2. Check the code

```bash
curl https://api.authtext.com.au/v1/verifications/ver_01JD3X9K2M7Q8R5T6V1W0XYZAB/check \
  -H "Authorization: Bearer $AUTHTEXT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code": "000000"}'
```

```json
{ "id": "ver_01JD3X9K2M7Q8R5T6V1W0XYZAB", "status": "approved", "attempts_remaining": 0 }
```

`approved` means the user is verified. A wrong code is not an HTTP error: it returns 200 with status `denied` and the attempts left.

## Rules to build on

- Call the API from your server. Never put a key in a browser or a mobile app.
- Codes have 6 digits, last 10 minutes and allow 5 attempts. Then start a new verification.
- Numbers are in E.164 format: `+61412345678`. Australian mobiles by default.
- Send an `Idempotency-Key` header on the send call if you retry on network errors, so a retry cannot send a second SMS.
- Every error has a stable `type` and a `fix`. See [errors](errors.md).
- Going live is a key change only: swap the `at_test_` key for an `at_live_` key. See [pricing](pricing.md).

The full contract is the [OpenAPI spec](https://api.authtext.com.au/openapi.json).
