Roll API key
Last updated September 8, 2026
/v1/api-keys/{keyId}/rollReplaces the secret of a key while keeping its name and ID in the key list. The previous secret stops working immediately. The new secret is minted with the current plan rate limit and is returned only once. Requires api-keys.write, a user token, and an admin or owner role; API keys cannot roll themselves.
Authentication
- bearerAuth
bearerAuth: http / bearer — Use an Inth API key or OAuth access token in the Authorization header. Every operation needs a capability. An OAuth access token carries the capabilities it was granted as scopes; an organization API key carries a fixed set (`organizations.read`, `projects.read`, `projects.write`, `api-keys.read`, `inbox.read`, `billing.read`). A credential without the capability an operation needs is answered with `403 INSUFFICIENT_SCOPE`. `GET /v1/me` reports the capabilities of the calling credential. OAuth scopes: - `organizations.read`: List the organizations you belong to. - `organizations.write`: Create organizations you will own. - `projects.read`: Read projects and their consent configuration. - `projects.write`: Create, update, and delete projects and their consent configuration. - `members.read`: Read member names, email addresses, profile images, roles, and pending invitation email addresses. - `members.write`: Invite members, change member roles, remove members, and cancel invitations. - `api-keys.read`: List organization API keys. - `api-keys.write`: Create, roll, and delete organization API keys. - `code-audit.read`: Read Code Audit scans, their findings, and connected repositories. - `code-audit.write`: Start Code Audit scans and unlock their reports. - `inbox.read`: Read Inbox findings. - `inbox.write`: Change the status of Inbox findings and open GitHub issues for them. - `billing.read`: Read the plan and credit balance of an organization.
Request
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
keyId | string | Required | API key ID. |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
organizationId | string | Optional | Organization the key belongs to. Defaults to the active organization of the credential. |
Responses
200
The rolled key. The plaintext secret is returned only once.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
data | object | Required | — |
data.id | string | Required | — |
data.key | string | Required | The plaintext secret. Returned once; store it now. |
View JSON schema
400
The request payload or parameters are invalid.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
401
Authentication is missing, invalid, or expired.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
403
The credential is valid but may not perform the operation. `INSUFFICIENT_SCOPE`: the credential was never granted the capability the operation needs. `details.requiredScope` names it, and the `WWW-Authenticate` header carries `Bearer error="insufficient_scope"`. An OAuth client fixes this by requesting the scope; an organization API key cannot gain it. `FORBIDDEN`: the capability is present but the membership behind the credential lacks the role, or the resource belongs to another organization.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
Headers
| Name | Type | Description |
|---|---|---|
WWW-Authenticate | string | Present on `INSUFFICIENT_SCOPE`: `Bearer error="insufficient_scope", scope="<required scope>"`. |
404
The requested resource was not found.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
429
The rate limit was exceeded. API key limits are set by plan tier (Starter 600/min, Pro 1500/min, Enterprise 3000/min). Check the Retry-After header before retrying.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
500
An unexpected internal error occurred.
Content type application/json
| Property | Type | Required | Description |
|---|---|---|---|
success | boolean | Required | — |
error | object | Required | — |
error.code | "UNAUTHORIZED" | "FORBIDDEN" | "INSUFFICIENT_SCOPE" | "PLAN_LIMIT_REACHED" | "PLAN_REQUIRED" | "INVALID_ORIGIN" | "INVALID_REGION" | "INVALID_PAYLOAD" | "NOT_FOUND" | "CONFLICT" | "KEY_LIMIT_REACHED" | "INSUFFICIENT_CREDITS" | "SCAN_IN_PROGRESS" | "UNLOCK_REQUIRED" | "REPOSITORY_NOT_LINKED" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" | Required | — |
error.message | string | Required | — |
error.details | unknown | Optional | Optional structured error details. |
View JSON schema
Related
- REST API overview: Every operation in this API.