> This page is for version 0.7.3.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo-helix/latest/llms.txt
> - 0.8.0: https://docs.nvidia.com/nemo-helix/v0.8.0/llms.txt
> - 0.7.3: https://docs.nvidia.com/nemo-helix/v0.7.3/llms.txt
> - 0.7.2: https://docs.nvidia.com/nemo-helix/v0.7.2/llms.txt
> - 0.7.1: https://docs.nvidia.com/nemo-helix/v0.7.1/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo-helix/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo-helix/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo-helix/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo-helix/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo-helix/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo-helix/v0.3.0/llms.txt
> - 0.2.0: https://docs.nvidia.com/nemo-helix/v0.2.0/llms.txt

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

# Broker Token

POST /apis/auth/v2/token
Content-Type: application/json

Reference: https://docs.nvidia.com/nemo-helix/documentation/reference/api-reference/authentication/broker-token-apis-auth-v-2-token-post

## Request

### Body (application/json)

This endpoint expects an Authentication_broker_token_apis_auth_v2_token_post_Request.

- `Authentication_broker_token_apis_auth_v2_token_post_Request`
  - `grant_type`: `authorization_code` (AuthorizationCodeBrokerTokenRequest)
    - `code` (string, required)
    - `code_verifier` (string, required)
  - `grant_type`: `refresh_token` (RefreshTokenBrokerTokenRequest)
    - `refresh_token` (string, required)

## Response

### 200

Successful Response

- `map from string to ApisAuthV2TokenPostResponsesContentApplicationJsonSchema`

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ApisAuthV2TokenPostResponsesContentApplicationJsonSchema

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (map from string to any, optional)

### ValidationErrorLocItems

## Examples

### Exchange an authorization code using PKCE

**Request**

```json
{
  "grant_type": "authorization_code",
  "code": "YOUR_AUTHORIZATION_CODE",
  "code_verifier": "YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG"
}
```

**Response**

```json
{}
```

**SDK Code**

```python Exchange an authorization code using PKCE
import requests

url = "https://api.example.com/apis/auth/v2/token"

payload = {
    "grant_type": "authorization_code",
    "code": "YOUR_AUTHORIZATION_CODE",
    "code_verifier": "YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Exchange an authorization code using PKCE
const url = 'https://api.example.com/apis/auth/v2/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"grant_type":"authorization_code","code":"YOUR_AUTHORIZATION_CODE","code_verifier":"YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG"}'
};

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

```go Exchange an authorization code using PKCE
package main

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

func main() {

	url := "https://api.example.com/apis/auth/v2/token"

	payload := strings.NewReader("{\n  \"grant_type\": \"authorization_code\",\n  \"code\": \"YOUR_AUTHORIZATION_CODE\",\n  \"code_verifier\": \"YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG\"\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 Exchange an authorization code using PKCE
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apis/auth/v2/token")

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  \"grant_type\": \"authorization_code\",\n  \"code\": \"YOUR_AUTHORIZATION_CODE\",\n  \"code_verifier\": \"YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG\"\n}"

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

```java Exchange an authorization code using PKCE
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/apis/auth/v2/token")
  .header("Content-Type", "application/json")
  .body("{\n  \"grant_type\": \"authorization_code\",\n  \"code\": \"YOUR_AUTHORIZATION_CODE\",\n  \"code_verifier\": \"YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG\"\n}")
  .asString();
```

```php Exchange an authorization code using PKCE
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/apis/auth/v2/token', [
  'body' => '{
  "grant_type": "authorization_code",
  "code": "YOUR_AUTHORIZATION_CODE",
  "code_verifier": "YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Exchange an authorization code using PKCE
using RestSharp;

var client = new RestClient("https://api.example.com/apis/auth/v2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"grant_type\": \"authorization_code\",\n  \"code\": \"YOUR_AUTHORIZATION_CODE\",\n  \"code_verifier\": \"YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Exchange an authorization code using PKCE
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "grant_type": "authorization_code",
  "code": "YOUR_AUTHORIZATION_CODE",
  "code_verifier": "YOUR_PKCE_CODE_VERIFIER_AT_LEAST_43_CHARACTERS_LONG"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/auth/v2/token")! 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()
```

### Refresh an access token

**Request**

```json
{
  "grant_type": "refresh_token",
  "refresh_token": "YOUR_REFRESH_TOKEN"
}
```

**Response**

```json
{}
```

**SDK Code**

```python Refresh an access token
import requests

url = "https://api.example.com/apis/auth/v2/token"

payload = {
    "grant_type": "refresh_token",
    "refresh_token": "YOUR_REFRESH_TOKEN"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Refresh an access token
const url = 'https://api.example.com/apis/auth/v2/token';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"grant_type":"refresh_token","refresh_token":"YOUR_REFRESH_TOKEN"}'
};

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

```go Refresh an access token
package main

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

func main() {

	url := "https://api.example.com/apis/auth/v2/token"

	payload := strings.NewReader("{\n  \"grant_type\": \"refresh_token\",\n  \"refresh_token\": \"YOUR_REFRESH_TOKEN\"\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 Refresh an access token
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apis/auth/v2/token")

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  \"grant_type\": \"refresh_token\",\n  \"refresh_token\": \"YOUR_REFRESH_TOKEN\"\n}"

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

```java Refresh an access token
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/apis/auth/v2/token")
  .header("Content-Type", "application/json")
  .body("{\n  \"grant_type\": \"refresh_token\",\n  \"refresh_token\": \"YOUR_REFRESH_TOKEN\"\n}")
  .asString();
```

```php Refresh an access token
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/apis/auth/v2/token', [
  'body' => '{
  "grant_type": "refresh_token",
  "refresh_token": "YOUR_REFRESH_TOKEN"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Refresh an access token
using RestSharp;

var client = new RestClient("https://api.example.com/apis/auth/v2/token");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"grant_type\": \"refresh_token\",\n  \"refresh_token\": \"YOUR_REFRESH_TOKEN\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Refresh an access token
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "grant_type": "refresh_token",
  "refresh_token": "YOUR_REFRESH_TOKEN"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/apis/auth/v2/token")! 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()
```