> For a complete page index, fetch https://docs.transak.com/llms.txt # Send User OTP POST https://api-gateway-stg.transak.com/api/v2/auth/login Content-Type: application/json The **Send User OTP** is a **non-authenticated** API method that allows you to initiate user authentication by sending an OTP to the provided email address. Reference: https://docs.transak.com/api/whitelabel/user/send-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. ## Response ### 200 200 - Success User OTP - `data` (ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaData, required) ## Errors ### 400 Bad Request Error 400 - Missing Field - `error` (ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError, required) ### 401 Unauthorized Error 401 - Unauthorized - `error` (ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError, required) ### 500 Internal Server Error 500 - Internal Server Error - `error` (ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError, required) ## Types ### ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaData - `isTncAccepted` (boolean, required) - `stateToken` (string, required) - `email` (string, required) - `expiresIn` (integer, required) ### ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError - `statusCode` (integer, required) - `message` (string, required) ## Examples **Request** ```json { "apiKey": "", "email": "" } ``` **Response** ```json { "data": { "isTncAccepted": false, "stateToken": "301fa4e02eb5b095b7f0173585ca628e", "email": "test@transak.com", "expiresIn": 600 } } ``` **SDK Code** ```python Success User OTP import requests url = "https://api-gateway-stg.transak.com/api/v2/auth/login" payload = { "apiKey": "", "email": "" } headers = { "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Success User OTP const url = 'https://api-gateway-stg.transak.com/api/v2/auth/login'; const options = { method: 'POST', headers: {'x-api-key': '', 'x-user-ip': '', 'Content-Type': 'application/json'}, body: '{"apiKey":"","email":""}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success User OTP package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-gateway-stg.transak.com/api/v2/auth/login" payload := strings.NewReader("{\n \"apiKey\": \"\",\n \"email\": \"\"\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 Success User OTP require 'uri' require 'net/http' url = URI("https://api-gateway-stg.transak.com/api/v2/auth/login") 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\": \"\"\n}" response = http.request(request) puts response.read_body ``` ```java Success 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/login") .header("x-api-key", "") .header("x-user-ip", "") .header("Content-Type", "application/json") .body("{\n \"apiKey\": \"\",\n \"email\": \"\"\n}") .asString(); ``` ```php Success User OTP request('POST', 'https://api-gateway-stg.transak.com/api/v2/auth/login', [ 'body' => '{ "apiKey": "", "email": "" }', 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => '', 'x-user-ip' => '', ], ]); echo $response->getBody(); ``` ```csharp Success User OTP using RestSharp; var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/auth/login"); 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\": \"\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Success User OTP import Foundation let headers = [ "x-api-key": "", "x-user-ip": "", "Content-Type": "application/json" ] let parameters = [ "apiKey": "", "email": "" ] 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/login")! 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() ```