# 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 ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: whitelabel-api version: 1.0.0 paths: /api/v2/auth/refresh: get: operationId: refresh-user-access-token summary: Refresh User Access Token description: >- 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 tags: - subpackage_user parameters: - name: authorization in: header description: >- Authorization token is the accessToken received from the API -` api/v2/auth/verify` required: true schema: type: string default: YOUR_USER_AUTH_TOKEN responses: '200': description: 200 - Success content: application/json: schema: $ref: >- #/components/schemas/User_refresh-user-access-token_Response_200 '500': description: 500 - Internal Server Error content: application/json: schema: $ref: >- #/components/schemas/Refresh-user-access-tokenRequestInternalServerError servers: - url: https://api-gateway-stg.transak.com components: schemas: ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaData: type: object properties: accessToken: type: string required: - accessToken title: ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaData User_refresh-user-access-token_Response_200: type: object properties: data: $ref: >- #/components/schemas/ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaData required: - data title: User_refresh-user-access-token_Response_200 ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaError: type: object properties: statusCode: type: integer name: type: string message: type: string required: - statusCode - name - message title: ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaError Refresh-user-access-tokenRequestInternalServerError: type: object properties: error: $ref: >- #/components/schemas/ApiV2AuthRefreshGetResponsesContentApplicationJsonSchemaError required: - error title: Refresh-user-access-tokenRequestInternalServerError ``` ## SDK Code Examples ```python Success import requests url = "https://api-gateway-stg.transak.com/api/v2/auth/refresh" headers = {"authorization": "YOUR_USER_AUTH_TOKEN"} 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: 'YOUR_USER_AUTH_TOKEN'}}; 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", "YOUR_USER_AUTH_TOKEN") 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"] = 'YOUR_USER_AUTH_TOKEN' 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", "YOUR_USER_AUTH_TOKEN") .asString(); ``` ```php Success request('GET', 'https://api-gateway-stg.transak.com/api/v2/auth/refresh', [ 'headers' => [ 'authorization' => 'YOUR_USER_AUTH_TOKEN', ], ]); 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", "YOUR_USER_AUTH_TOKEN"); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let headers = ["authorization": "YOUR_USER_AUTH_TOKEN"] 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() ```