> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vlenseg.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vlenseg.com/_mcp/server.

# Confirm OTP

POST https://api.vlenseg.com/api/OtpRequests/ConfirmOtp
Content-Type: application/json

Confirms the action using the OTP sent in step 1. A successful confirmation returns no `error_code`.

Reference: https://docs.vlenseg.com/api-reference/vlens-api/post-otp-requests-confirm-otp

## Authentication

- `ApiKey` header (required) — Static API key issued to your tenant. Required on every request.
- `Authorization` header (bearer token, required) — End-user JWT from registration or login. Required for verification, signing, and user-scoped operations.

## Servers

- `https://api.vlenseg.com` (Production, default)
- `https://api.vlens.co` (Staging)

## Request

### Body (application/json)

This endpoint expects an object.

- `otpTypeId` (integer, required) — Must match the `otpTypeId` sent in step 1.
- `transactionId` (string, required) — Must match the `transactionId` sent in step 1.
- `phoneNumber` (string, required) — Must match the `phoneNumber` sent in step 1.
- `phoneNumberOtpRequestId` (string, required) — Returned by `POST /api/OtpRequests/RequestOtp`.
- `phoneNumberOtp` (string, required) — The OTP code the customer received via SMS.

## Response

### 200

Action confirmed.

- `data` (ApiOtpRequestsConfirmOtpPostResponsesContentApplicationJsonSchemaData, required, nullable) — **To complete in the docs:** the full success response body was not provided — only that a successful confirmation has no `error_code`.
- `error_code` (integer, required, nullable)
- `error_message` (string, required, nullable)
- `error_descriptions` (string, required, nullable)

## Types

### ApiOtpRequestsConfirmOtpPostResponsesContentApplicationJsonSchemaData

**To complete in the docs:** the full success response body was not provided — only that a successful confirmation has no `error_code`.

## Examples

**Request**

```json
{
  "otpTypeId": 1,
  "transactionId": "7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
  "phoneNumber": "01000000000",
  "phoneNumberOtpRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "phoneNumberOtp": "123456"
}
```

**Response**

```json
{
  "data": null,
  "error_code": null,
  "error_message": null,
  "error_descriptions": null
}
```

**SDK Code**

```python Purchase Authorization_postOtpRequestsConfirmOtp_example
import requests

url = "https://api.vlenseg.com/api/OtpRequests/ConfirmOtp"

payload = {
    "otpTypeId": 1,
    "transactionId": "7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
    "phoneNumber": "01000000000",
    "phoneNumberOtpRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "phoneNumberOtp": "123456"
}
headers = {
    "ApiKey": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Purchase Authorization_postOtpRequestsConfirmOtp_example
const url = 'https://api.vlenseg.com/api/OtpRequests/ConfirmOtp';
const options = {
  method: 'POST',
  headers: {ApiKey: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"otpTypeId":1,"transactionId":"7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b","phoneNumber":"01000000000","phoneNumberOtpRequestId":"3fa85f64-5717-4562-b3fc-2c963f66afa6","phoneNumberOtp":"123456"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Purchase Authorization_postOtpRequestsConfirmOtp_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.vlenseg.com/api/OtpRequests/ConfirmOtp"

	payload := strings.NewReader("{\n  \"otpTypeId\": 1,\n  \"transactionId\": \"7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b\",\n  \"phoneNumber\": \"01000000000\",\n  \"phoneNumberOtpRequestId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"phoneNumberOtp\": \"123456\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("ApiKey", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Purchase Authorization_postOtpRequestsConfirmOtp_example
require 'uri'
require 'net/http'

url = URI("https://api.vlenseg.com/api/OtpRequests/ConfirmOtp")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["ApiKey"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"otpTypeId\": 1,\n  \"transactionId\": \"7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b\",\n  \"phoneNumber\": \"01000000000\",\n  \"phoneNumberOtpRequestId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"phoneNumberOtp\": \"123456\"\n}"

response = http.request(request)
puts response.read_body
```

```java Purchase Authorization_postOtpRequestsConfirmOtp_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vlenseg.com/api/OtpRequests/ConfirmOtp")
  .header("ApiKey", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"otpTypeId\": 1,\n  \"transactionId\": \"7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b\",\n  \"phoneNumber\": \"01000000000\",\n  \"phoneNumberOtpRequestId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"phoneNumberOtp\": \"123456\"\n}")
  .asString();
```

```php Purchase Authorization_postOtpRequestsConfirmOtp_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vlenseg.com/api/OtpRequests/ConfirmOtp', [
  'body' => '{
  "otpTypeId": 1,
  "transactionId": "7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
  "phoneNumber": "01000000000",
  "phoneNumberOtpRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "phoneNumberOtp": "123456"
}',
  'headers' => [
    'ApiKey' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Purchase Authorization_postOtpRequestsConfirmOtp_example
using RestSharp;

var client = new RestClient("https://api.vlenseg.com/api/OtpRequests/ConfirmOtp");
var request = new RestRequest(Method.POST);
request.AddHeader("ApiKey", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"otpTypeId\": 1,\n  \"transactionId\": \"7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b\",\n  \"phoneNumber\": \"01000000000\",\n  \"phoneNumberOtpRequestId\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"phoneNumberOtp\": \"123456\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Purchase Authorization_postOtpRequestsConfirmOtp_example
import Foundation

let headers = [
  "ApiKey": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "otpTypeId": 1,
  "transactionId": "7d2f1a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
  "phoneNumber": "01000000000",
  "phoneNumberOtpRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "phoneNumberOtp": "123456"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vlenseg.com/api/OtpRequests/ConfirmOtp")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```