Skip to content
Docs

Update API Key

PATCH/v1/api_keys/{api_key_id}

Update an existing API key

Path ParametersExpand Collapse
api_key_id: string
Body ParametersJSONExpand Collapse
name: optional string

API Key name.

maxLength255
minLength1
permissions: optional array of object { permission, resource_type }

Scoped permissions for this API key. When provided, replaces the entire set. At least one is required.

permission: APIPermissionLevel

Permission level: “read” or “edit”.

One of the following:
"read"
"edit"

Resource type this permission applies to.

One of the following:
"vm"
"vpc"
"volume"
"connect_connection"
"rpc_node_dedicated"
"rpc_node_flex"
"nks_cluster"
"nks_node_pool"
"project"
"api_key"
"organization"
"audit_log"
"usage"
project_ids: optional array of string

Project IDs this API key is scoped to. When provided, replaces the entire set. At least one is required.

source_ip_rule: optional SourceIPRule { allowed, blocked }

IP filter rules.

allowed: optional array of string

List of IPv4 CIDR addresses to allow.

blocked: optional array of string

List of IPv4 CIDR addresses to deny.

tags: optional array of string

Tags to attach to the API Key.

ReturnsExpand Collapse
APIKey object { id, created_at, expires_at, 10 more }

API Key response.

id: string

API Key ID.

created_at: string

When the API Key was created.

formatdate-time
expires_at: string

When the API Key expires and is no longer valid.

formatdate-time
managed: boolean

Whether this API key is system-managed.

name: string

API Key name.

maxLength255
minLength1
permissions: array of APIKeyPermission { permission, resource_type }

Scoped permissions for this API key.

permission: APIPermissionLevel

Permission level: “read” or “edit”.

One of the following:
"read"
"edit"

Resource type this permission applies to.

One of the following:
"vm"
"vpc"
"volume"
"connect_connection"
"rpc_node_dedicated"
"rpc_node_flex"
"nks_cluster"
"nks_node_pool"
"project"
"api_key"
"organization"
"audit_log"
"usage"
project_ids: array of string

Project IDs this API key is scoped to.

source_ip_rule: SourceIPRuleResponse { allowed, blocked }

IP filter rules.

allowed: array of string

List of IPv4 CIDR addresses to allow.

blocked: array of string

List of IPv4 CIDR addresses to deny.

status: "active" or "inactive" or "expired"

Status of the API Key.

One of the following:
"active"
"inactive"
"expired"
tags: array of string

Tags to attach to the API Key.

updated_at: string

When the API Key was updated.

formatdate-time
key: optional string

API Key. Only returned on creation.

starts_at: optional string

When the API Key starts to be valid.

formatdate-time

Update API Key

curl https://api.nirvanalabs.io/v1/api_keys/$API_KEY_ID \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "My Updated API Key",
          "tags": [
            "production",
            "ethereum"
          ]
        }'
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "expires_at": "2025-01-01T00:00:00Z",
  "managed": false,
  "name": "My API Key",
  "permissions": [
    {
      "permission": "edit",
      "resource_type": "vm"
    }
  ],
  "project_ids": [
    "string"
  ],
  "source_ip_rule": {
    "allowed": [
      "192.168.1.0/24",
      "10.0.0.0/8"
    ],
    "blocked": [
      "192.168.1.100/32"
    ]
  },
  "status": "active",
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "key": "6r17s0jy_b0_RbSofrrNvawFQcaN-VbGtUM7cKCW7_k",
  "starts_at": "2025-01-01T00:00:00Z"
}
Returns Examples
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "expires_at": "2025-01-01T00:00:00Z",
  "managed": false,
  "name": "My API Key",
  "permissions": [
    {
      "permission": "edit",
      "resource_type": "vm"
    }
  ],
  "project_ids": [
    "string"
  ],
  "source_ip_rule": {
    "allowed": [
      "192.168.1.0/24",
      "10.0.0.0/8"
    ],
    "blocked": [
      "192.168.1.100/32"
    ]
  },
  "status": "active",
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "key": "6r17s0jy_b0_RbSofrrNvawFQcaN-VbGtUM7cKCW7_k",
  "starts_at": "2025-01-01T00:00:00Z"
}