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

# Rotate Access Key

POST /apis/auth/v2/access-keys/{jti}/rotate
Content-Type: application/json

Reference: https://docs.nvidia.com/nemo-platform/documentation/reference/api-reference/scoped-access-keys/rotate-access-key-apis-auth-v-2-access-keys-jti-rotate-post

## Request

### Path parameters

- `jti` (string, required) — Stable JWT ID of the Scoped Access Key for the lifecycle operation.

### Body (application/json)

This endpoint expects an object.

- `grace_period_seconds` (integer, optional, nullable) — Grace period in seconds for the rotated-out key. Omit to use auth.access_keys.rotation_grace_period_seconds. Subject to auth.access_keys.max_rotation_grace_period_seconds.

## Response

### 200

Successful Response

- `new_key` (object, required) — Newly minted successor Scoped Access Key. Its raw token is returned only once.
  - `jti` (string, required) — Stable JWT ID for this Scoped Access Key.
  - `principal` (string, required) — Principal ID stamped into the token.
  - `status` (enum, required)
    - Allowed values: `ACTIVE`, `EXPIRED`, `REVOKED`, `SUSPENDED`, `ROTATING`
  - `issuer` (string, required) — Issuer stamped into the Scoped Access Key JWT.
  - `audiences` (list of string, required) — Audiences accepted for the Scoped Access Key JWT.
  - `created_at` (datetime, required)
  - `token` (string, required)
  - `token_type` ("Bearer", required)
  - `name` (string, optional, nullable) — Optional human-readable Scoped Access Key label.
  - `description` (string, optional, nullable) — Human-readable description of the Scoped Access Key.
  - `entity_type` (enum, optional, default: USER) — Whether the key is bound to a user or a non-human service account.
    - Allowed values: `USER`, `SERVICE_ACCOUNT`
  - `expires_at` (datetime, optional, nullable)
  - `grace_period_expires_at` (datetime, optional, nullable) — Timestamp when the rotated-out key's grace period expires.
  - `last_used_at` (datetime, optional, nullable) — Timestamp of the most recent successful authentication with this Scoped Access Key.
- `previous_jti` (string, required) — Stable JWT ID of the Scoped Access Key that was rotated out.
- `previous_status` (enum, required) — Effective status of the rotated-out key immediately after this request. Normally ROTATING, but may already read as REVOKED or EXPIRED if reconciling this request's outcome was itself delayed past the grace deadline or a concurrent revoke.
  - Allowed values: `ACTIVE`, `EXPIRED`, `REVOKED`, `SUSPENDED`, `ROTATING`
- `grace_period_seconds` (integer, required) — Seconds the rotated-out key remains usable before it is treated as revoked.
- `grace_period_expires_at` (datetime, optional, nullable) — Timestamp when the rotated-out key's grace period expires.

## Errors

### 400 Bad Request Error

Scoped Access Key rotation error

- `detail` (string, required)
- `code` ("access_keys_disabled", optional, nullable) — Set to access_keys_disabled when the Scoped Access Key feature is disabled.

### 404 Not Found Error

Scoped Access Keys are not enabled or the key was not found

- `detail` (string, required)
- `code` ("access_keys_disabled", optional, nullable) — Set to access_keys_disabled when the Scoped Access Key feature is disabled.

### 409 Conflict Error

Invalid or concurrent access-key state transition

- `detail` (string, required)
- `code` ("access_keys_disabled", optional, nullable) — Set to access_keys_disabled when the Scoped Access Key feature is disabled.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of object, optional)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any, optional)
  - `ctx` (map from string to any, optional)

### 501 Not Implemented Error

Not Implemented

- `detail` (string, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "new_key": {
    "jti": "string",
    "principal": "string",
    "status": "ACTIVE",
    "issuer": "string",
    "audiences": [
      "string"
    ],
    "created_at": "2024-01-15T09:30:00Z",
    "token": "string",
    "token_type": "string",
    "name": "string",
    "description": "string",
    "entity_type": "USER",
    "expires_at": "2024-01-15T09:30:00Z",
    "grace_period_expires_at": "2024-01-15T09:30:00Z",
    "last_used_at": "2024-01-15T09:30:00Z"
  },
  "previous_jti": "string",
  "previous_status": "ACTIVE",
  "grace_period_seconds": 1,
  "grace_period_expires_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/apis/auth/v2/access-keys/jti/rotate"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/apis/auth/v2/access-keys/jti/rotate';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/apis/auth/v2/access-keys/jti/rotate"

	payload := strings.NewReader("{}")

	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
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apis/auth/v2/access-keys/jti/rotate")

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 = "{}"

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.post("https://api.example.com/apis/auth/v2/access-keys/jti/rotate")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/apis/auth/v2/access-keys/jti/rotate', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/apis/auth/v2/access-keys/jti/rotate");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

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