# Verify code

## Request

```
POST https://api.cm.com/otp/v2/otp/{id}/verify
```

### HTTP headers

| Header            | Description                                                                                 |
| :---------------- | :------------------------------------------------------------------------------------------ |
| X-CM-ProductToken | Your product token. Retrieve from [Messaging Gateway app](https://www.cm.com/app/gateway/). |
| Content-Type      | application/json                                                                            |

### Request body

```json
{
    "code": "12345"
}
```

### URL parameter

| Parameter | Type   | Description                                                                  |
| :-------- | :----- | :--------------------------------------------------------------------------- |
| id        | string | The identifier for the OTP, returned in the response after creating the OTP. |

### Parameter

| Parameter | Type   | Description                                  |
| :-------- | :----- | :------------------------------------------- |
| code      | string | The code received via the specified channel. |

## Response

```json
{
    "id": "1e12cb10-d14a-4cd6-8d86-e5263cf122ee",
    "channel": "sms",
    "verified": true,
    "createdAt": "2022-01-01T13:00:00+0000",
    "expiresAt": "2022-01-01T13:01:00+0000"
}
```

> 📘
>
> Once a code has been successfully validated, it cannot be validated again.

### Parameters

| Parameter | Description                        |
| :-------- | :--------------------------------- |
| id        | The identifier of the OTP.         |
| channel   | The channel used to send the code. |
| verified  | Indicates if the code was valid.   |
| createdAt | The date the OTP was created.      |
| expiresAt | The date the OTP will expire.      |