> This page is for version 0.10.
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo-helix/latest/llms.txt
> - 0.10: https://docs.nvidia.com/nemo-helix/v0.10/llms.txt
> - 0.9: https://docs.nvidia.com/nemo-helix/v0.9/llms.txt
> - 0.8: https://docs.nvidia.com/nemo-helix/v0.8/llms.txt
> - 0.7: https://docs.nvidia.com/nemo-helix/v0.7/llms.txt
> - 0.6: https://docs.nvidia.com/nemo-helix/v0.6/llms.txt
> - 0.5: https://docs.nvidia.com/nemo-helix/v0.5/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.

# Create Access Key

POST http://localhost:8080/apis/auth/v2/access-keys
Content-Type: application/json

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

## Authentication

- `Authorization` header (bearer token, required) — Supply a raw Helix access token. The Authorization header's Bearer prefix is added automatically.

## Request

### Body (application/json)

This endpoint expects an AccessKeyCreateRequest.

- `name` (string, optional, nullable) — Optional human-readable Scoped Access Key label. The token jti remains the stable identifier.
- `description` (string, optional, nullable) — Optional human-readable description of the Scoped Access Key.
- `expires_in_seconds` (integer, optional, nullable) — Scoped Access Key lifetime in seconds. Omit to use auth.access_keys.default_expires_in_seconds. Send explicit null to request a non-time-delimited key, which requires auth.access_keys.max_expires_in_seconds to be disabled.
- `service_account_id` (string, optional, nullable) — Optional non-human service account to bind the key to. Service-bound keys can only be created by a HelixAdmin and authenticate as service-account:\<id>.
- `scope` (list of string, optional, nullable) — Optional service names that restrict this key to read and write access for those services.
- `rotates` (string, optional, nullable) — JTI of a prior Scoped Access Key owned by the caller to revoke after creation. Intended primarily for personal keys without a service-account identity.
- `workspaces` (list of AccessKeyWorkspaceGrant, optional, nullable) — Optional workspace memberships to grant to the newly created key principal.
- `service_attributes` (map from string to any, optional, nullable) — Facts a platform service vouches for, signed into the token under that service's name in the nhx\_service\_attributes claim. Only a service principal, usually acting for a user, may set them. At most 32 names matching ^\[A-Za-z]\[A-Za-z0-9\_.-]\$, values nested at most one object or array deep, strings of at most 256 characters, and 2048 bytes as JSON.

## Response

### 200

Successful Response

- `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`
- `scope` (list of string, optional) — Services this key is restricted to. An empty list means the key is unscoped.
- `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.
- `service_attributes` (map from string to map from string to any, optional) — Attributes platform services signed into the key, by service name. Read-only to the key's owner.

## Errors

### 400 Bad Request Error

Scoped Access Key creation error

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

### 403 Forbidden Error

Service-bound Scoped Access Keys require HelixAdmin, or service_attributes were set by a caller that isn't a platform service

- `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

- `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

Concurrent access-key update conflict

- `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 ValidationError, optional)

### 501 Not Implemented Error

Not Implemented

- `detail` (string, required)

## Types

### AccessKeyWorkspaceGrant

Workspace membership to grant to a newly created access key principal.

- `workspace` (string, required) — Workspace name. Must not be blank.
- `roles` (list of string, optional, default: ["Editor"]) — Roles to grant in the workspace. Defaults to ['Editor'] when omitted.

### ValidationError

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

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "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",
  "scope": [
    "string"
  ],
  "expires_at": "2024-01-15T09:30:00Z",
  "grace_period_expires_at": "2024-01-15T09:30:00Z",
  "last_used_at": "2024-01-15T09:30:00Z",
  "service_attributes": {}
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/apis/auth/v2/access-keys"

payload = {}
headers = {
    "Authorization": "Bearer <accessToken>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'http://localhost:8080/apis/auth/v2/access-keys';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <accessToken>', '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);
}
```