> For a complete page index, fetch https://docs.transak.com/llms.txt # Verify User OTP POST https://api-gateway-stg.transak.com/api/v2/auth/verify Content-Type: application/json The **Verify User OTP** is a **non-authenticated API** that allows you to **verify a user’s email using an OTP** and retrieve an **access token** in return. Once you have successfully called `Send User OTP`, you need to pass the **email verification code** along with the user’s email to **verify the OTP**. **Access Token Usages (Received in response)** - This **access token is required** for all **authenticated API calls** (such as placing orders, fetching user details, and submitting KYC). - This **access token remains valid for 30 days from the time of generation**. Once expired, the user must restart the authentication process by requesting a new OTP. Reference: https://docs.transak.com/api/whitelabel/user/verify-user-otp ## Request ### Headers - `x-user-ip` (string, required) — End user's originating IP. More details [here](/guides/mandatory-security-changes#user-ip-header-in-apis) - `x-api-key` (string, required) — Partner API Key present in Transak Dashboard. ### Body (application/json) This endpoint expects an object. - `apiKey` (string, required) — Your API Key from Transak Dashboard - `email` (string, required) — Your Email address used to receive OTP. - `otp` (string, required) — Your OTP received in your Email inbox. - `stateToken` (string, required) — token received in api/v2/auth/login ## Response ### 200 200 - Verify User OTP - `data` (ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaData, required) ## Errors ### 400 Bad Request Error 400 - Bad Request - `error` (ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaError, required) ### 401 Unauthorized Error 401 - Unauthorized - `error` (ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaError, required) ### 500 Internal Server Error 500 - Internal Server Error - `error` (ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaError, required) ## Types ### ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaData - `ttl` (integer, required) - `created` (string, required) - `accessToken` (string, required) ### ApiV2AuthVerifyPostResponsesContentApplicationJsonSchemaError - `statusCode` (integer, required) - `message` (string, required) ## Examples **Request** ```json { "apiKey": "", "email": "test@transak.com", "otp": "123456", "stateToken": "" } ``` **Response** ```json { "data": { "ttl": 2592000, "created": "2025-04-07T08:05:30.432Z", "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3RpdmUiOnRydWUsInBlcm1pc3Npb25zIjpbXSwicm9sZXMiOltdLCJ0b2tlbl90eXBlIjoiQmVhcmVyIiwic3ViIjoicGFua2FqLmd1cHRhKzE0MDVAdHJhbnNhay5jb20iLCJwYXJ0bmVyX2FwaV9rZXkiOiI2YjdkN2RlZi0wMTgyLTRiMGItYTc1Ni1hMWVkZGQ2NjRiNGYiLCJhdWQiOiJhYjhhYTFjNzNhZGM1OGQ3ZmU1YWZjZTRkOWRjNjM5M20zem1uaCIsImlzcyI6Imh0dHBzOi8vdHJhbnNhay5jb20vYXV0aCIsImp0aSI6IjNkYjgwNWZhLTM5MDItNDdkOS1iZDdkLTJhZWM0ZGYwZmYxZCIsImlhdCI6MTc0NzIyNTk4MywiZXhwIjoxNzQ5ODE3OTgzfQ.QILSDW6xamPgx4nhJTotQPT9yWmKOFUzGP9CRT4B1Uc" } } ``` **SDK Code** ```python Verify User OTP import requests url = "https://api-gateway-stg.transak.com/api/v2/auth/verify" payload = { "apiKey": "", "email": "test@transak.com", "otp": "123456", "stateToken": "" } headers = { "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Verify User OTP const url = 'https://api-gateway-stg.transak.com/api/v2/auth/verify'; const options = { method: 'POST', headers: {'x-api-key': '', 'x-user-ip': '', 'Content-Type': 'application/json'}, body: '{"apiKey":"","email":"test@transak.com","otp":"123456","stateToken":""}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Verify User OTP package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-gateway-stg.transak.com/api/v2/auth/verify" payload := strings.NewReader("{\n \"apiKey\": \"\",\n \"email\": \"test@transak.com\",\n \"otp\": \"123456\",\n \"stateToken\": \"\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-api-key", "") req.Header.Add("x-user-ip", "") 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 Verify User OTP require 'uri' require 'net/http' url = URI("https://api-gateway-stg.transak.com/api/v2/auth/verify") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-api-key"] = '' request["x-user-ip"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"apiKey\": \"\",\n \"email\": \"test@transak.com\",\n \"otp\": \"123456\",\n \"stateToken\": \"\"\n}" response = http.request(request) puts response.read_body ``` ```java Verify User OTP import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-gateway-stg.transak.com/api/v2/auth/verify") .header("x-api-key", "") .header("x-user-ip", "") .header("Content-Type", "application/json") .body("{\n \"apiKey\": \"\",\n \"email\": \"test@transak.com\",\n \"otp\": \"123456\",\n \"stateToken\": \"\"\n}") .asString(); ``` ```php Verify User OTP request('POST', 'https://api-gateway-stg.transak.com/api/v2/auth/verify', [ 'body' => '{ "apiKey": "", "email": "test@transak.com", "otp": "123456", "stateToken": "" }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', 'x-user-ip' => '', ], ]); echo $response->getBody(); ``` ```csharp Verify User OTP using RestSharp; var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/auth/verify"); var request = new RestRequest(Method.POST); request.AddHeader("x-api-key", ""); request.AddHeader("x-user-ip", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"apiKey\": \"\",\n \"email\": \"test@transak.com\",\n \"otp\": \"123456\",\n \"stateToken\": \"\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Verify User OTP import Foundation let headers = [ "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" ] let parameters = [ "apiKey": "", "email": "test@transak.com", "otp": "123456", "stateToken": "" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway-stg.transak.com/api/v2/auth/verify")! 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() ```