> This page is for NT Prop.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://partner.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://partner.ninjatrader.com/_mcp/server.

# Renew Access Token

GET https://live.tradovateapi.com/v1/auth/renewaccesstoken

### Request a renewal for an existing access token.

Extends the current session without creating a new one. Using this function in a long-running application will ensure that you don't start a new session unless it is 100% necessary. This will prevent your application from kicking itself or dropping dependent services that share an Access Token. See the [`accessTokenRequest`](/prop/api/rest-api-endpoints/authentication/access-token-request) operation for more details.

```js

const { accessToken, expirationTime } = await fetch(TRADOVATELIVE+'/auth/accessTokenRequest', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    },
    body: JSON.stringify(myCredentials) //see auth/accessTokenRequest for more info on the request body
}).then(res => res.json());

sessionStorage.setItem(CURRENT_TOKEN_KEY, accessToken);
sessionStorage.setItem(TOKEN_EXPIRATION_KEY, expirationTime);

//in another file or function, keep the connection alive
//check every 2 mins using useInterval (WARNING on a browser
//this fn will be throttled. Consider using a WebWorker to maintain
//a connection even when tabbed away.)
setInterval(() => {
    const expiration = sessionStorage.getItem(TOKEN_EXPIRATION_KEY);
    const now = new Date().getTime();
    const exp = new Date(expiration).getTime();
    //if expiration is within 15 mins, renew
    if(exp - now < 15 * 60000) {
        const currentToken = sessionStorage.getItem(CURRENT_TOKEN_KEY);
        const renewal = await fetch(TRADOVATELIVE+'/auth/renewAccessToken', {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json',
                'Accept': 'application/json',
                'Authorization': `Bearer ${currentToken}` //send existing non-expired token
            }
        });
        //set new token and expiration
        sessionStorage.setItem(CURRENT_TOKEN_KEY, renewal.accessToken);
        sessionStorage.setItem(TOKEN_EXPIRATION_KEY, renewal.expirationTime);
    }
}, 120 * 60000)

```

Reference: https://partner.ninjatrader.com/prop/api/rest-api-endpoints/authentication/renew-access-token

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Response

### 200

AccessTokenResponse

- `errorText` (string, optional) — Non-empty if the request failed
- `hibpHint` (enum, optional) — EmailAndPasswordCompromised, PasswordCompromised
  - Allowed values: `EmailAndPasswordCompromised`, `PasswordCompromised`
- `accessToken` (string, optional)
- `expirationTime` (datetime, optional)
- `passwordExpirationTime` (datetime, optional)
- `userStatus` (enum, optional) — Active, Closed, Initiated, TemporaryLocked, UnconfirmedEmail
  - Allowed values: `Active`, `Closed`, `Initiated`, `TemporaryLocked`, `UnconfirmedEmail`
- `userId` (long, optional)
- `name` (string, optional)
- `hasLive` (boolean, optional)
- `ownsUnarchivedLive` (boolean, optional)
- `hasApprovedTradingPermission` (boolean, optional)
- `hasSimPlus` (boolean, optional)
- `showKIDs` (boolean, optional)

## Examples

**Response**

```json
{
  "errorText": "string",
  "hibpHint": "EmailAndPasswordCompromised",
  "accessToken": "string",
  "expirationTime": "2024-01-15T09:30:00Z",
  "passwordExpirationTime": "2024-01-15T09:30:00Z",
  "userStatus": "Active",
  "userId": 1,
  "name": "string",
  "hasLive": true,
  "ownsUnarchivedLive": true,
  "hasApprovedTradingPermission": true,
  "hasSimPlus": true,
  "showKIDs": true
}
```

**SDK Code**

```python
import requests

url = "https://live.tradovateapi.com/v1/auth/renewaccesstoken"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://live.tradovateapi.com/v1/auth/renewaccesstoken';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://live.tradovateapi.com/v1/auth/renewaccesstoken"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://live.tradovateapi.com/v1/auth/renewaccesstoken")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://live.tradovateapi.com/v1/auth/renewaccesstoken")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://live.tradovateapi.com/v1/auth/renewaccesstoken', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://live.tradovateapi.com/v1/auth/renewaccesstoken");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://live.tradovateapi.com/v1/auth/renewaccesstoken")! 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()
```