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

# Validate OTP API: Verify One-Time Password

> Confirm that the code entered by the user matches the OTP sent. Pass the code and optional reference to get a success or failure result for your flow.

### Request

```http [GET] theme={null}
{{baseUrl}}/api/v1/messaging/otp/validate
```

### Header

| Header        | Type   | Description                                                                                         |
| ------------- | ------ | --------------------------------------------------------------------------------------------------- |
| AppId         | string | Create an app to get your app ID on dashboard [here](https://app.dojah.io/developers/configuration) |
| Authorization | string | Private/secret key. Use `<key>` not `Bearer <key>`                                                  |

## Query parameter

| Parameter     | Type   | Description            | Required |
| ------------- | ------ | ---------------------- | -------- |
| code          | string | OTP received from user | required |
| reference\_id | string | ID to identify the OTP | required |

## Response Sample

```json Response theme={null}
{
  "entity": {
    "valid": true
  }
}
```

### Response Fields

| Field        | Type    | Description                                                              |
| ------------ | ------- | ------------------------------------------------------------------------ |
| entity       | object  | Contains the OTP validation result                                       |
| entity.valid | boolean | `true` if the OTP code is correct and has not expired; `false` otherwise |

### Test Credentials for Sandbox

Kindly use this Test OTP in sandbox Environment

OTP = `1234`
