Skip to content
Docs

API Keys

Create API Key
client.APIKeys.New(ctx, body) (*APIKey, error)
POST/v1/api_keys
Get API Key Details
client.APIKeys.Get(ctx, apiKeyID) (*APIKey, error)
GET/v1/api_keys/{api_key_id}
Update API Key
client.APIKeys.Update(ctx, apiKeyID, body) (*APIKey, error)
PATCH/v1/api_keys/{api_key_id}
Delete API Key
client.APIKeys.Delete(ctx, apiKeyID) error
DELETE/v1/api_keys/{api_key_id}
List API Keys
client.APIKeys.List(ctx, query) (*Cursor[APIKey], error)
GET/v1/api_keys
ModelsExpand Collapse
type APIKey struct{…}

API Key response.

ID string

API Key ID.

CreatedAt Time

When the API Key was created.

formatdate-time
ExpiresAt Time

When the API Key expires and is no longer valid.

formatdate-time
Managed bool

Whether this API key is system-managed.

Name string

API Key name.

maxLength255
minLength1
Permissions []APIKeyPermission

Scoped permissions for this API key.

Permission level: “read” or “edit”.

One of the following:
const APIPermissionLevelRead APIPermissionLevel = "read"
const APIPermissionLevelEdit APIPermissionLevel = "edit"

Resource type this permission applies to.

One of the following:
const APIPermissionResourceTypeVM APIPermissionResourceType = "vm"
const APIPermissionResourceTypeVPC APIPermissionResourceType = "vpc"
const APIPermissionResourceTypeVolume APIPermissionResourceType = "volume"
const APIPermissionResourceTypeConnectConnection APIPermissionResourceType = "connect_connection"
const APIPermissionResourceTypeRPCNodeDedicated APIPermissionResourceType = "rpc_node_dedicated"
const APIPermissionResourceTypeRPCNodeFlex APIPermissionResourceType = "rpc_node_flex"
const APIPermissionResourceTypeNKSCluster APIPermissionResourceType = "nks_cluster"
const APIPermissionResourceTypeNKSNodePool APIPermissionResourceType = "nks_node_pool"
const APIPermissionResourceTypeProject APIPermissionResourceType = "project"
const APIPermissionResourceTypeAPIKey APIPermissionResourceType = "api_key"
const APIPermissionResourceTypeOrganization APIPermissionResourceType = "organization"
const APIPermissionResourceTypeAuditLog APIPermissionResourceType = "audit_log"
const APIPermissionResourceTypeUsage APIPermissionResourceType = "usage"
ProjectIDs []string

Project IDs this API key is scoped to.

IP filter rules.

Allowed []string

List of IPv4 CIDR addresses to allow.

Blocked []string

List of IPv4 CIDR addresses to deny.

Status APIKeyStatus

Status of the API Key.

One of the following:
const APIKeyStatusActive APIKeyStatus = "active"
const APIKeyStatusInactive APIKeyStatus = "inactive"
const APIKeyStatusExpired APIKeyStatus = "expired"
Tags []string

Tags to attach to the API Key.

UpdatedAt Time

When the API Key was updated.

formatdate-time
Key stringOptional

API Key. Only returned on creation.

StartsAt TimeOptional

When the API Key starts to be valid.

formatdate-time
type APIKeyList struct{…}
Items []APIKey
ID string

API Key ID.

CreatedAt Time

When the API Key was created.

formatdate-time
ExpiresAt Time

When the API Key expires and is no longer valid.

formatdate-time
Managed bool

Whether this API key is system-managed.

Name string

API Key name.

maxLength255
minLength1
Permissions []APIKeyPermission

Scoped permissions for this API key.

Permission level: “read” or “edit”.

One of the following:
const APIPermissionLevelRead APIPermissionLevel = "read"
const APIPermissionLevelEdit APIPermissionLevel = "edit"

Resource type this permission applies to.

One of the following:
const APIPermissionResourceTypeVM APIPermissionResourceType = "vm"
const APIPermissionResourceTypeVPC APIPermissionResourceType = "vpc"
const APIPermissionResourceTypeVolume APIPermissionResourceType = "volume"
const APIPermissionResourceTypeConnectConnection APIPermissionResourceType = "connect_connection"
const APIPermissionResourceTypeRPCNodeDedicated APIPermissionResourceType = "rpc_node_dedicated"
const APIPermissionResourceTypeRPCNodeFlex APIPermissionResourceType = "rpc_node_flex"
const APIPermissionResourceTypeNKSCluster APIPermissionResourceType = "nks_cluster"
const APIPermissionResourceTypeNKSNodePool APIPermissionResourceType = "nks_node_pool"
const APIPermissionResourceTypeProject APIPermissionResourceType = "project"
const APIPermissionResourceTypeAPIKey APIPermissionResourceType = "api_key"
const APIPermissionResourceTypeOrganization APIPermissionResourceType = "organization"
const APIPermissionResourceTypeAuditLog APIPermissionResourceType = "audit_log"
const APIPermissionResourceTypeUsage APIPermissionResourceType = "usage"
ProjectIDs []string

Project IDs this API key is scoped to.

IP filter rules.

Allowed []string

List of IPv4 CIDR addresses to allow.

Blocked []string

List of IPv4 CIDR addresses to deny.

Status APIKeyStatus

Status of the API Key.

One of the following:
const APIKeyStatusActive APIKeyStatus = "active"
const APIKeyStatusInactive APIKeyStatus = "inactive"
const APIKeyStatusExpired APIKeyStatus = "expired"
Tags []string

Tags to attach to the API Key.

UpdatedAt Time

When the API Key was updated.

formatdate-time
Key stringOptional

API Key. Only returned on creation.

StartsAt TimeOptional

When the API Key starts to be valid.

formatdate-time
type APIKeyPermission struct{…}

API Key permission.

Permission level: “read” or “edit”.

One of the following:
const APIPermissionLevelRead APIPermissionLevel = "read"
const APIPermissionLevelEdit APIPermissionLevel = "edit"

Resource type this permission applies to.

One of the following:
const APIPermissionResourceTypeVM APIPermissionResourceType = "vm"
const APIPermissionResourceTypeVPC APIPermissionResourceType = "vpc"
const APIPermissionResourceTypeVolume APIPermissionResourceType = "volume"
const APIPermissionResourceTypeConnectConnection APIPermissionResourceType = "connect_connection"
const APIPermissionResourceTypeRPCNodeDedicated APIPermissionResourceType = "rpc_node_dedicated"
const APIPermissionResourceTypeRPCNodeFlex APIPermissionResourceType = "rpc_node_flex"
const APIPermissionResourceTypeNKSCluster APIPermissionResourceType = "nks_cluster"
const APIPermissionResourceTypeNKSNodePool APIPermissionResourceType = "nks_node_pool"
const APIPermissionResourceTypeProject APIPermissionResourceType = "project"
const APIPermissionResourceTypeAPIKey APIPermissionResourceType = "api_key"
const APIPermissionResourceTypeOrganization APIPermissionResourceType = "organization"
const APIPermissionResourceTypeAuditLog APIPermissionResourceType = "audit_log"
const APIPermissionResourceTypeUsage APIPermissionResourceType = "usage"
type APIPermissionLevel string

Permission level: “read” or “edit”.

One of the following:
const APIPermissionLevelRead APIPermissionLevel = "read"
const APIPermissionLevelEdit APIPermissionLevel = "edit"
type APIPermissionResourceType string

Resource type this permission applies to.

One of the following:
const APIPermissionResourceTypeVM APIPermissionResourceType = "vm"
const APIPermissionResourceTypeVPC APIPermissionResourceType = "vpc"
const APIPermissionResourceTypeVolume APIPermissionResourceType = "volume"
const APIPermissionResourceTypeConnectConnection APIPermissionResourceType = "connect_connection"
const APIPermissionResourceTypeRPCNodeDedicated APIPermissionResourceType = "rpc_node_dedicated"
const APIPermissionResourceTypeRPCNodeFlex APIPermissionResourceType = "rpc_node_flex"
const APIPermissionResourceTypeNKSCluster APIPermissionResourceType = "nks_cluster"
const APIPermissionResourceTypeNKSNodePool APIPermissionResourceType = "nks_node_pool"
const APIPermissionResourceTypeProject APIPermissionResourceType = "project"
const APIPermissionResourceTypeAPIKey APIPermissionResourceType = "api_key"
const APIPermissionResourceTypeOrganization APIPermissionResourceType = "organization"
const APIPermissionResourceTypeAuditLog APIPermissionResourceType = "audit_log"
const APIPermissionResourceTypeUsage APIPermissionResourceType = "usage"