> ## Documentation Index
> Fetch the complete documentation index at: https://docs.otpbay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API reference

> The OTPBay REST API: base URL, authentication, and conventions.

The OTPBay API is a JSON REST API. Every endpoint page has a playground: paste your API key and send a real request.

## Base URL

```text theme={null}
https://api.otpbay.com/v1
```

All requests use HTTPS.

## Authentication

Send your project API key as a bearer token:

```bash theme={null}
curl https://api.otpbay.com/v1/project \
  -H "Authorization: Bearer otp_live_..."
```

See [Authentication](/authentication) to create a key and restrict it to your IP addresses.

<Warning>
  Requests from the playground are real. They send real messages and charge your balance.
</Warning>

## Endpoints

| Method | Path                                                                | Description                     |
| ------ | ------------------------------------------------------------------- | ------------------------------- |
| `POST` | [`/verifications`](/api-reference/verify/start)                     | Start a verification            |
| `GET`  | [`/verifications/{sid}`](/api-reference/verify/get)                 | Get a verification              |
| `POST` | [`/verifications/{sid}/check`](/api-reference/verify/check)         | Check a code                    |
| `POST` | [`/messages/sms`](/api-reference/sms/send)                          | Send an SMS                     |
| `GET`  | [`/messages/sms/{sid}`](/api-reference/sms/get)                     | Get an SMS                      |
| `POST` | [`/messages/telegram`](/api-reference/telegram/send)                | Send a Telegram code            |
| `GET`  | [`/messages/telegram/{sid}`](/api-reference/telegram/get)           | Get a Telegram code             |
| `POST` | [`/messages/telegram/{sid}/verify`](/api-reference/telegram/verify) | Verify a Telegram code          |
| `GET`  | [`/project`](/api-reference/project/get)                            | Get the project and its balance |

## Conventions

* **Requests** are JSON with `Content-Type: application/json`. Unknown fields are rejected.
* **Phone numbers** are international format and returned as E.164. See [IDs and formats](/concepts/formats).
* **IDs** are `sid` strings with a type prefix: `VE`, `SM` or `TG`.
* **Amounts** are US dollar strings with two decimals, such as `"0.02"`.
* **Errors** return `{ "error": { "code", "message" } }`. See [Errors](/errors).
* **Webhooks** send status updates to your `callback` URL. See [Webhooks](/webhooks).

## OpenAPI specification

The full API is described in an OpenAPI 3.1 file, `api-reference/openapi.yaml`, in this documentation's repository. Use it to generate a client or import the API into Postman or Insomnia.
