> For a complete page index, fetch https://docs.transak.com/llms.txt # Refresh User Access Token GET https://api-gateway-stg.transak.com/api/v2/auth/refresh The **Refresh Access Token** is an **authenticated** API which should be used when access token is about to expire (not expired). If Access token is expired, it cannot be refreshed. In that case, Only OTP authentication is the way to generate a new access token Reference: https://docs.transak.com/api/whitelabel/user/refresh-user-access-token ## 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. - `authorization` (string, required) — Authorization token is the accessToken received from the API -` api/v2/auth/verify` ## Response ### 200 200 - Success - `data` (ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaData, required) ## Errors ### 500 Internal Server Error 500 - Internal Server Error - `error` (ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaError, required) ## Types ### ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaData - `accessToken` (string, required) ### ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaError - `statusCode` (integer, required) - `message` (string, required) ## Examples **Response** ```json { "data": { "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3RpdmUiOnRydWUsInBlcm1pc3Npb25zIjpbXSwicm9sZXMiOltdLCJ0b2tlbl90eXBlIjoiQmVhcmVyIiwic3ViIjoiYW5zaHVsLmdhcmcrdGVzdGFwaTFAdHJhbnNhay5jb20iLCJhdWQiOiI5OTVhY2RlZjhmYjQwNzRjNTFhYWY1N2ZhNjUwNDVmN21ham91Y2I0IiwiaXNzIjoiaHR0cHM6Ly90cmFuc2FrLmNvbS9hdXRoIiwianRpIjoiMGQyNGJmMTctNjMxNS00NjEzLTg1ZmItOTIxZGFlYjNkNWRlIiwiaWF0IjoxNzUwMzI5NzM1LCJleHAiOjE3NTI5MjE3MzV9.Z4L2myLTfccFLQ_aN6uHLdOSPBjTsm-VjfSHJeeD18A" } } ``` **SDK Code** ```python Success import requests url = "https://api-gateway-stg.transak.com/api/v2/auth/refresh" headers = { "authorization": "", "x-api-key": "", "x-user-ip": "" } response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript Success const url = 'https://api-gateway-stg.transak.com/api/v2/auth/refresh'; const options = {method: 'GET', headers: {authorization: '', 'x-api-key': '', 'x-user-ip': ''}}; 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" "net/http" "io" ) func main() { url := "https://api-gateway-stg.transak.com/api/v2/auth/refresh" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("authorization", "") req.Header.Add("x-api-key", "") req.Header.Add("x-user-ip", "") 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/refresh") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["authorization"] = '' request["x-api-key"] = '' request["x-user-ip"] = '' 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.get("https://api-gateway-stg.transak.com/api/v2/auth/refresh") .header("authorization", "") .header("x-api-key", "") .header("x-user-ip", "") .asString(); ``` ```php Success request('GET', 'https://api-gateway-stg.transak.com/api/v2/auth/refresh', [ 'headers' => [ 'authorization' => '', 'x-api-key' => '', 'x-user-ip' => '', ], ]); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api-gateway-stg.transak.com/api/v2/auth/refresh"); var request = new RestRequest(Method.GET); request.AddHeader("authorization", ""); request.AddHeader("x-api-key", ""); request.AddHeader("x-user-ip", ""); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = [ "authorization": "", "x-api-key": "", "x-user-ip": "" ] let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway-stg.transak.com/api/v2/auth/refresh")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```