> ## 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.

# Quickstart

> Send a one-time code to a phone number and check it with the Verify API.

In this guide you send a verification code to your own phone and check it. It takes about five minutes.

## Prerequisites

* An OTPBay account. [Sign up](https://app.otpbay.com/login) — new accounts get \$1.00 of free credit.
* A phone number with Telegram installed, or any phone that receives SMS.

## Verify a phone number

<Steps>
  <Step title="Create an API key">
    In the [dashboard](https://app.otpbay.com), open your project and go to **API Keys**. Click **New API key**, give it a name and copy the key.

    Keys start with `otp_live_`. OTPBay shows a key only once, so store it somewhere safe, such as an environment variable:

    ```bash theme={null}
    export OTPBAY_API_KEY="otp_live_..."
    ```
  </Step>

  <Step title="Start a verification">
    Send the phone number in international format. OTPBay generates a code and sends it over Telegram, falling back to SMS if Telegram can't deliver.

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.otpbay.com/v1/verifications \
        -H "Authorization: Bearer $OTPBAY_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{ "to": "+14155552671" }'
      ```

      ```javascript Node.js theme={null}
      const res = await fetch("https://api.otpbay.com/v1/verifications", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.OTPBAY_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ to: "+14155552671" }),
      });

      const verification = await res.json();
      console.log(verification.sid);
      ```

      ```python Python theme={null}
      import os
      import requests

      res = requests.post(
          "https://api.otpbay.com/v1/verifications",
          headers={"Authorization": f"Bearer {os.environ['OTPBAY_API_KEY']}"},
          json={"to": "+14155552671"},
      )

      verification = res.json()
      print(verification["sid"])
      ```
    </CodeGroup>

    The response includes a `sid`. Save it — you need it to check the code.

    ```json theme={null}
    {
      "sid": "VE6650c3a1b2c3d4e5f6a7b8c9",
      "status": "pending",
      "to": "+14155552671",
      "channel": "telegram",
      "checks_left": 5,
      "expires_at": "2026-09-26T10:25:01.873Z",
      ...
    }
    ```
  </Step>

  <Step title="Check the code">
    Enter the code you received, using the `sid` from the previous step:

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://api.otpbay.com/v1/verifications/VE6650c3a1b2c3d4e5f6a7b8c9/check \
        -H "Authorization: Bearer $OTPBAY_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{ "code": "482913" }'
      ```

      ```javascript Node.js theme={null}
      const res = await fetch(
        `https://api.otpbay.com/v1/verifications/${sid}/check`,
        {
          method: "POST",
          headers: {
            Authorization: `Bearer ${process.env.OTPBAY_API_KEY}`,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({ code: "482913" }),
        }
      );

      const { valid, status } = await res.json();
      ```

      ```python Python theme={null}
      res = requests.post(
          f"https://api.otpbay.com/v1/verifications/{sid}/check",
          headers={"Authorization": f"Bearer {os.environ['OTPBAY_API_KEY']}"},
          json={"code": "482913"},
      )

      result = res.json()
      print(result["valid"], result["status"])
      ```
    </CodeGroup>

    A correct code returns `"valid": true` and `"status": "approved"`. The phone number is verified.
  </Step>
</Steps>

<Note>
  A wrong code also returns HTTP `200`, with `"valid": false`. Always read `valid` rather than relying on the status code.
</Note>

## Next steps

<Columns cols={2}>
  <Card title="Verify guide" icon="shield-check" href="/guides/verify">
    Configure the channel, fallback, code length and expiry.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/webhooks">
    Get notified when a verification finishes.
  </Card>
</Columns>
