# 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 ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: whitelabel-api version: 1.0.0 paths: /api/v2/auth/login: post: operationId: send-user-otp summary: Send User OTP description: >- 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. tags: - subpackage_user responses: '200': description: 200 - Confirm Payment Success content: application/json: schema: $ref: '#/components/schemas/User_send-user-otp_Response_200' '400': description: 400 - Missing Field content: application/json: schema: $ref: '#/components/schemas/Send-user-otpRequestBadRequestError' '401': description: 401 - Unauthorized content: application/json: schema: $ref: '#/components/schemas/Send-user-otpRequestUnauthorizedError' '500': description: 500 - Internal Server Error content: application/json: schema: $ref: '#/components/schemas/Send-user-otpRequestInternalServerError' requestBody: content: application/json: schema: type: object properties: apiKey: type: string default: YOUR_API_KEY description: Your API Key from Transak Dashboard email: type: string default: test@transak.com description: Your Email address used to receive OTP. required: - apiKey - email servers: - url: https://api-gateway-stg.transak.com components: schemas: ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaData: type: object properties: isTncAccepted: type: boolean stateToken: type: string email: type: string expiresIn: type: integer required: - isTncAccepted - stateToken - email - expiresIn title: ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaData User_send-user-otp_Response_200: type: object properties: data: $ref: >- #/components/schemas/ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaData required: - data title: User_send-user-otp_Response_200 ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError: type: object properties: statusCode: type: integer message: type: string required: - statusCode - message title: ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError Send-user-otpRequestBadRequestError: type: object properties: error: $ref: >- #/components/schemas/ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError required: - error title: Send-user-otpRequestBadRequestError Send-user-otpRequestUnauthorizedError: type: object properties: error: $ref: >- #/components/schemas/ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError required: - error title: Send-user-otpRequestUnauthorizedError Send-user-otpRequestInternalServerError: type: object properties: error: $ref: >- #/components/schemas/ApiV2AuthLoginPostResponsesContentApplicationJsonSchemaError required: - error title: Send-user-otpRequestInternalServerError ``` ## SDK Code Examples ```python Success import requests url = "https://api-gateway-stg.transak.com/api/v2/auth/login" payload = { "apiKey": "YOUR_API_KEY", "email": "test@transak.com" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Success const url = 'https://api-gateway-stg.transak.com/api/v2/auth/login'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"apiKey":"YOUR_API_KEY","email":"test@transak.com"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success 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\": \"YOUR_API_KEY\",\n \"email\": \"test@transak.com\"\n}") req, _ := http.NewRequest("POST", url, payload) 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 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["Content-Type"] = 'application/json' request.body = "{\n \"apiKey\": \"YOUR_API_KEY\",\n \"email\": \"test@transak.com\"\n}" response = http.request(request) puts response.read_body ``` ```java Success 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("Content-Type", "application/json") .body("{\n \"apiKey\": \"YOUR_API_KEY\",\n \"email\": \"test@transak.com\"\n}") .asString(); ``` ```php Success request('POST', 'https://api-gateway-stg.transak.com/api/v2/auth/login', [ 'body' => '{ "apiKey": "YOUR_API_KEY", "email": "test@transak.com" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/auth/login"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"apiKey\": \"YOUR_API_KEY\",\n \"email\": \"test@transak.com\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "apiKey": "YOUR_API_KEY", "email": "test@transak.com" ] 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() ```