openapi

package
v0.12.14-0...-77740bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

README

Unkey OpenAPI Specification

This directory contains the Unkey API OpenAPI specification split into multiple files for better maintainability.

Structure

openapi/
├── openapi-split.yaml      # Main entry point with info, servers, security
└── spec/                   # All specification files
    ├── paths/              # Path definitions organized by API version
    │   └── v2/            # Version 2 API endpoints
    │       ├── apis/      # API management endpoints
    │       ├── identities/ # Identity management endpoints
    │       ├── keys/      # Key management endpoints
    │       ├── liveness/   # Health check endpoints
    │       ├── permissions/ # Permission and role management
    │       └── ratelimit/  # Rate limiting endpoints
    ├── common/             # Shared schemas (Meta.yaml, Pagination.yaml, etc.)
    └── error/             # Error-related schemas

Usage

Viewing the Split Specification

The split specification starts at openapi-split.yaml. Most OpenAPI tools support file references ($ref) and will automatically resolve them.

Bundling into a Single File

To bundle all files into a single OpenAPI specification and generate Go code:

# Bundle the specification and generate Go code
go generate

This creates openapi-bundled.yaml with all references resolved using libopenapi and generates Go code as configured.

Adding New Endpoints

  1. Create a new directory under the appropriate category in spec/paths/v2/ (e.g., spec/paths/v2/keys/newEndpoint/)
  2. Create the necessary files in the new directory using explicit naming:
    • index.yaml - Main path definition with operation details
    • V2CategoryOperationRequestBody.yaml - Request body schema
    • V2CategoryOperationResponseBody.yaml - Response body schema
    • Additional data schemas as needed (e.g., V2CategoryOperationResponseData.yaml)
  3. Update openapi-split.yaml to include your new endpoint in the paths section
  4. If needed, add shared schemas to spec/common/ or spec/error/

Example Endpoint Structure

See spec/paths/v2/apis/listKeys/ for a complete example:

spec/paths/v2/apis/listKeys/
├── index.yaml                        # Main operation definition
├── V2ApisListKeysRequestBody.yaml    # Request body schema
├── V2ApisListKeysResponseBody.yaml   # Response body schema
└── V2ApisListKeysResponseData.yaml   # Response data schema
index.yaml

Contains the main operation definition with references to request and response files:

post:
  summary: List API keys
  operationId: listKeys
  requestBody:
    content:
      application/json:
        schema:
          $ref: "./V2ApisListKeysRequestBody.yaml"
  responses:
    "200":
      content:
        application/json:
          schema:
            $ref: "./V2ApisListKeysResponseBody.yaml"
    "400":
      content:
        application/json:
          schema:
            $ref: "../../../../error/BadRequestErrorResponse.yaml"
V2ApisListKeysRequestBody.yaml

Contains the request body schema definition:

type: object
required:
  - apiId
properties:
  apiId:
    type: string
    minLength: 1
    description: The ID of the API whose keys you want to list
    example: api_1234
  limit:
    type: integer
    description: Maximum number of keys to return
    default: 100
    minimum: 1
    maximum: 100
  cursor:
    type: string
    description: Pagination cursor from a previous response
    example: cursor_eyJsYXN0S2V5SWQiOiJrZXlfMjNld3MiLCJsYXN0Q3JlYXRlZEF0IjoxNjcyNTI0MjM0MDAwfQ==
V2ApisListKeysResponseBody.yaml

Contains the response body schema definition:

type: object
required:
  - meta
  - data
properties:
  meta:
    $ref: "../../../../common/Meta.yaml"
  data:
    $ref: "./V2ApisListKeysResponseData.yaml"
  pagination:
    $ref: "../../../../common/Pagination.yaml"

Benefits of Split Structure

  • Better organization: Related endpoints and schemas are grouped together
  • Easier collaboration: Multiple developers can work on different endpoints without conflicts
  • Improved maintainability: Changes to one endpoint don't affect others
  • Reusability: Common schemas and responses are defined once and referenced
  • Version control: Smaller files mean clearer diffs and easier code reviews

Documentation

Overview

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerScopes        = "bearer.Scopes"
	PortalSessionScopes = "portalSession.Scopes"
)

Variables

View Source
var Spec []byte

Spec is the OpenAPI specification for the service It's loaded from our openapi file and embedded into the binary

Functions

This section is empty.

Types

type AnalyticsGetVerificationsJSONRequestBody

type AnalyticsGetVerificationsJSONRequestBody = V2AnalyticsGetVerificationsRequestBody

AnalyticsGetVerificationsJSONRequestBody defines body for AnalyticsGetVerifications for application/json ContentType.

type ApisCreateApiJSONRequestBody

type ApisCreateApiJSONRequestBody = V2ApisCreateApiRequestBody

ApisCreateApiJSONRequestBody defines body for ApisCreateApi for application/json ContentType.

type ApisDeleteApiJSONRequestBody

type ApisDeleteApiJSONRequestBody = V2ApisDeleteApiRequestBody

ApisDeleteApiJSONRequestBody defines body for ApisDeleteApi for application/json ContentType.

type ApisGetApiJSONRequestBody

type ApisGetApiJSONRequestBody = V2ApisGetApiRequestBody

ApisGetApiJSONRequestBody defines body for ApisGetApi for application/json ContentType.

type ApisListKeysJSONRequestBody

type ApisListKeysJSONRequestBody = V2ApisListKeysRequestBody

ApisListKeysJSONRequestBody defines body for ApisListKeys for application/json ContentType.

type App

type App struct {
	// CreatedAt Unix timestamp in milliseconds when the app was created.
	CreatedAt int64 `json:"createdAt"`

	// CurrentDeploymentId The identifier of the deployment currently serving this app.
	// Omitted if the app has no active deployment yet.
	CurrentDeploymentId string `json:"currentDeploymentId,omitempty"`

	// DefaultBranch The default git branch deployments track for this app.
	DefaultBranch string `json:"defaultBranch"`

	// DeleteProtection Whether delete protection is enabled for this app.
	// When true, the app cannot be deleted until protection is disabled.
	DeleteProtection bool `json:"deleteProtection"`

	// Id The unique identifier of the app, generated by Unkey.
	Id string `json:"id"`

	// IsRolledBack Whether the app is currently serving a rolled-back deployment rather than its latest one.
	IsRolledBack bool `json:"isRolledBack"`

	// Name Human-readable name for this app.
	Name string `json:"name"`

	// Slug URL-safe handle for this app, unique within its project.
	// Chosen at creation time.
	Slug string `json:"slug"`

	// UpdatedAt Unix timestamp in milliseconds when the app was last updated.
	// Omitted if the app has never been updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

App defines model for App.

type AppsCreateAppJSONRequestBody

type AppsCreateAppJSONRequestBody = V2AppsCreateAppRequestBody

AppsCreateAppJSONRequestBody defines body for AppsCreateApp for application/json ContentType.

type AppsDeleteAppJSONRequestBody

type AppsDeleteAppJSONRequestBody = V2AppsDeleteAppRequestBody

AppsDeleteAppJSONRequestBody defines body for AppsDeleteApp for application/json ContentType.

type AppsGetAppJSONRequestBody

type AppsGetAppJSONRequestBody = V2AppsGetAppRequestBody

AppsGetAppJSONRequestBody defines body for AppsGetApp for application/json ContentType.

type AppsListAppsJSONRequestBody

type AppsListAppsJSONRequestBody = V2AppsListAppsRequestBody

AppsListAppsJSONRequestBody defines body for AppsListApps for application/json ContentType.

type AppsUpdateAppJSONRequestBody

type AppsUpdateAppJSONRequestBody = V2AppsUpdateAppRequestBody

AppsUpdateAppJSONRequestBody defines body for AppsUpdateApp for application/json ContentType.

type AuthenticatedSubjectKey

type AuthenticatedSubjectKey = map[string]interface{}

AuthenticatedSubjectKey Rate limit by the authenticated subject (e.g. the verified key).

type BadRequestErrorDetails

type BadRequestErrorDetails struct {
	// Detail A human-readable explanation specific to this occurrence of the problem. This provides detailed information about what went wrong and potential remediation steps. The message is intended to be helpful for developers troubleshooting the issue.
	Detail string `json:"detail"`

	// Errors List of individual validation errors that occurred in the request. Each error provides specific details about what failed validation, where the error occurred in the request, and suggestions for fixing it. This granular information helps developers quickly identify and resolve multiple issues in a single request without having to make repeated API calls.
	Errors []ValidationError `json:"errors"`

	// Status HTTP status code that corresponds to this error. This will match the status code in the HTTP response. Common codes include `400` (Bad Request), `401` (Unauthorized), `403` (Forbidden), `404` (Not Found), `409` (Conflict), and `500` (Internal Server Error).
	Status int `json:"status"`

	// Title A short, human-readable summary of the problem type. This remains constant from occurrence to occurrence of the same problem and should be used for programmatic handling.
	Title string `json:"title"`

	// Type A URI reference that identifies the problem type. This provides a stable identifier for the error that can be used for documentation lookups and programmatic error handling. When followed, this URI should provide human-readable documentation for the problem type.
	Type string `json:"type"`
}

BadRequestErrorDetails defines model for BadRequestErrorDetails.

type BadRequestErrorResponse

type BadRequestErrorResponse struct {
	// Error Extended error details specifically for bad request (400) errors. This builds on the BaseError structure by adding an array of individual validation errors, making it easy to identify and fix multiple issues at once.
	Error BadRequestErrorDetails `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

BadRequestErrorResponse Error response for invalid requests that cannot be processed due to client-side errors. This typically occurs when request parameters are missing, malformed, or fail validation rules. The response includes detailed information about the specific errors in the request, including the location of each error and suggestions for fixing it. When receiving this error, check the 'errors' array in the response for specific validation issues that need to be addressed before retrying.

type BaseError

type BaseError struct {
	// Detail A human-readable explanation specific to this occurrence of the problem. This provides detailed information about what went wrong and potential remediation steps. The message is intended to be helpful for developers troubleshooting the issue.
	Detail string `json:"detail"`

	// Status HTTP status code that corresponds to this error. This will match the status code in the HTTP response. Common codes include `400` (Bad Request), `401` (Unauthorized), `403` (Forbidden), `404` (Not Found), `409` (Conflict), and `500` (Internal Server Error).
	Status int `json:"status"`

	// Title A short, human-readable summary of the problem type. This remains constant from occurrence to occurrence of the same problem and should be used for programmatic handling.
	Title string `json:"title"`

	// Type A URI reference that identifies the problem type. This provides a stable identifier for the error that can be used for documentation lookups and programmatic error handling. When followed, this URI should provide human-readable documentation for the problem type.
	Type string `json:"type"`
}

BaseError Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.

type BearerTokenLocation

type BearerTokenLocation = map[string]interface{}

BearerTokenLocation Extract the key from the `Authorization Bearer` header.

type ConflictErrorResponse

type ConflictErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

ConflictErrorResponse Error response when the request conflicts with the current state of the resource. This occurs when: - Attempting to create a resource that already exists - Modifying a resource that has been changed by another operation - Violating unique constraints or business rules

To resolve this error, check the current state of the resource and adjust your request accordingly.

type DeployCreateDeploymentJSONRequestBody

type DeployCreateDeploymentJSONRequestBody = V2DeployCreateDeploymentRequestBody

DeployCreateDeploymentJSONRequestBody defines body for DeployCreateDeployment for application/json ContentType.

type DeployGetDeploymentJSONRequestBody

type DeployGetDeploymentJSONRequestBody = V2DeployGetDeploymentRequestBody

DeployGetDeploymentJSONRequestBody defines body for DeployGetDeployment for application/json ContentType.

type Deployment

type Deployment struct {
	// App Slug of the app this deployment belongs to.
	App string `json:"app"`

	// AvailableActions Lifecycle operations you are allowed to call on this deployment right now.
	// Empty when none apply (e.g. while building or in a terminal state).
	AvailableActions []DeploymentAction `json:"availableActions"`

	// CreatedAt Unix timestamp in milliseconds when the deployment was created.
	CreatedAt int64             `json:"createdAt"`
	Docker    *DeploymentDocker `json:"docker,omitempty"`

	// Domains Public hostnames this deployment is reachable at.
	Domains *[]string `json:"domains,omitempty"`

	// Environment Slug of the environment this deployment belongs to.
	Environment string           `json:"environment"`
	Error       *DeploymentError `json:"error,omitempty"`
	Git         *DeploymentGit   `json:"git,omitempty"`

	// Id The unique identifier of the deployment, generated by Unkey.
	Id string `json:"id"`

	// IsCurrent True when this is the production deployment currently serving traffic, i.e.
	// on api.acme.com. Only production deployments can be current, and at most one
	// deployment is current. Rollbacks and promotions change which deployment is
	// current and serves requests to api.acme.com.
	IsCurrent bool `json:"isCurrent"`

	// Project Slug of the project this deployment belongs to.
	Project string `json:"project"`

	// Regions Regions this deployment is configured to run in. Empty while the deployment
	// has no scheduled regions yet.
	Regions []string          `json:"regions"`
	Runtime DeploymentRuntime `json:"runtime"`

	// Status Current lifecycle status of the deployment. Poll until it reaches a
	// terminal state: ready (serving), failed, skipped, superseded, stopped,
	// or cancelled.
	Status DeploymentStatus `json:"status"`

	// UpdatedAt Unix timestamp in milliseconds when the deployment was last updated.
	// Omitted if the deployment has never been updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

Deployment defines model for Deployment.

type DeploymentAction

type DeploymentAction string

DeploymentAction A lifecycle operation that can be performed on the deployment in its current state, given its status, environment, and whether it is the current deployment.

const (
	DeploymentActionPromote  DeploymentAction = "promote"
	DeploymentActionRollback DeploymentAction = "rollback"
	DeploymentActionStart    DeploymentAction = "start"
	DeploymentActionStop     DeploymentAction = "stop"
)

Defines values for DeploymentAction.

type DeploymentDocker

type DeploymentDocker struct {
	// Image The Docker image this deployment runs.
	Image string `json:"image"`
}

DeploymentDocker defines model for DeploymentDocker.

type DeploymentError

type DeploymentError struct {
	// Code The reason a deployment failed. `unknown` means Unkey could not classify the
	// failure; see `message` for details.
	Code DeploymentErrorCode `json:"code"`

	// Message Human-readable description of why the deployment failed. For programmatic
	// handling, use `code`.
	Message string `json:"message"`

	// Step The pipeline step that failed (e.g. `building`, `deploying`, `starting`).
	Step string `json:"step"`
}

DeploymentError defines model for DeploymentError.

type DeploymentErrorCode

type DeploymentErrorCode string

DeploymentErrorCode The reason a deployment failed. `unknown` means Unkey could not classify the failure; see `message` for details.

const (
	DeploymentErrorCodeBuildFailed            DeploymentErrorCode = "build_failed"
	DeploymentErrorCodeCpuQuotaExceeded       DeploymentErrorCode = "cpu_quota_exceeded"
	DeploymentErrorCodeInvalidRuntimeSettings DeploymentErrorCode = "invalid_runtime_settings"
	DeploymentErrorCodeMemoryQuotaExceeded    DeploymentErrorCode = "memory_quota_exceeded"
	DeploymentErrorCodeNoSchedulableRegions   DeploymentErrorCode = "no_schedulable_regions"
	DeploymentErrorCodeStorageQuotaExceeded   DeploymentErrorCode = "storage_quota_exceeded"
	DeploymentErrorCodeUnknown                DeploymentErrorCode = "unknown"
)

Defines values for DeploymentErrorCode.

type DeploymentGit

type DeploymentGit struct {
	// Branch The git branch this deployment was built from. Omitted when unknown.
	Branch *string `json:"branch,omitempty"`

	// CommitSha The git commit SHA this deployment was built from.
	CommitSha string `json:"commitSha"`
}

DeploymentGit defines model for DeploymentGit.

type DeploymentRuntime

type DeploymentRuntime struct {
	// Command Container entrypoint command override. Empty when none is set.
	Command     []string                `json:"command"`
	Healthcheck *EnvironmentHealthcheck `json:"healthcheck,omitempty"`

	// MemoryMib Memory allocation in mebibytes.
	MemoryMib int `json:"memoryMib"`

	// Port Port the container listens on.
	Port int `json:"port"`

	// ShutdownSignal Signal sent to the container on shutdown.
	ShutdownSignal EnvironmentShutdownSignal `json:"shutdownSignal"`

	// StorageMib Ephemeral storage allocation in mebibytes.
	StorageMib int `json:"storageMib"`

	// UpstreamProtocol Protocol used to reach the container.
	UpstreamProtocol EnvironmentUpstreamProtocol `json:"upstreamProtocol"`

	// VCpus CPU allocation in vCPUs (1 = one vCPU, 0.5 = half a vCPU).
	VCpus float64 `json:"vCpus"`
}

DeploymentRuntime defines model for DeploymentRuntime.

type DeploymentSourceDeployment

type DeploymentSourceDeployment struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

DeploymentSourceDeployment Re-run an existing deployment.

type DeploymentSourceGit

type DeploymentSourceGit struct {
	// Branch Branch to build (its HEAD). Omit branch and commitSha to use the app's default branch.
	Branch *string `json:"branch,omitempty"`

	// CommitSha Commit to build (full or abbreviated SHA). Takes precedence over branch.
	CommitSha *string `json:"commitSha,omitempty"`

	// Repository Build from a fork instead of the app's connected repository, as "owner/repo". Requires commitSha.
	Repository *string `json:"repository,omitempty"`
}

DeploymentSourceGit Build from the app's connected GitHub repository.

type DeploymentSourceImage

type DeploymentSourceImage struct {
	// DockerImage Docker image to deploy as-is.
	DockerImage string `json:"dockerImage"`
}

DeploymentSourceImage Deploy a prebuilt Docker image as-is.

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus Current lifecycle status of the deployment. Poll until it reaches a terminal state: ready (serving), failed, skipped, superseded, stopped, or cancelled.

const (
	DeploymentStatusAwaitingApproval DeploymentStatus = "awaiting_approval"
	DeploymentStatusBuilding         DeploymentStatus = "building"
	DeploymentStatusCancelled        DeploymentStatus = "cancelled"
	DeploymentStatusDeploying        DeploymentStatus = "deploying"
	DeploymentStatusFailed           DeploymentStatus = "failed"
	DeploymentStatusFinalizing       DeploymentStatus = "finalizing"
	DeploymentStatusNetwork          DeploymentStatus = "network"
	DeploymentStatusPending          DeploymentStatus = "pending"
	DeploymentStatusReady            DeploymentStatus = "ready"
	DeploymentStatusSkipped          DeploymentStatus = "skipped"
	DeploymentStatusStarting         DeploymentStatus = "starting"
	DeploymentStatusStopped          DeploymentStatus = "stopped"
	DeploymentStatusSuperseded       DeploymentStatus = "superseded"
)

Defines values for DeploymentStatus.

type DeploymentsCreateDeploymentJSONRequestBody

type DeploymentsCreateDeploymentJSONRequestBody = V2DeploymentsCreateDeploymentRequestBody

DeploymentsCreateDeploymentJSONRequestBody defines body for DeploymentsCreateDeployment for application/json ContentType.

type DeploymentsGetDeploymentJSONRequestBody

type DeploymentsGetDeploymentJSONRequestBody = V2DeploymentsGetDeploymentRequestBody

DeploymentsGetDeploymentJSONRequestBody defines body for DeploymentsGetDeployment for application/json ContentType.

type DeploymentsListDeploymentsJSONRequestBody

type DeploymentsListDeploymentsJSONRequestBody = V2DeploymentsListDeploymentsRequestBody

DeploymentsListDeploymentsJSONRequestBody defines body for DeploymentsListDeployments for application/json ContentType.

type DeploymentsPromoteDeploymentJSONRequestBody

type DeploymentsPromoteDeploymentJSONRequestBody = V2DeploymentsPromoteDeploymentRequestBody

DeploymentsPromoteDeploymentJSONRequestBody defines body for DeploymentsPromoteDeployment for application/json ContentType.

type DeploymentsRollbackDeploymentJSONRequestBody

type DeploymentsRollbackDeploymentJSONRequestBody = V2DeploymentsRollbackDeploymentRequestBody

DeploymentsRollbackDeploymentJSONRequestBody defines body for DeploymentsRollbackDeployment for application/json ContentType.

type DeploymentsStartDeploymentJSONRequestBody

type DeploymentsStartDeploymentJSONRequestBody = V2DeploymentsStartDeploymentRequestBody

DeploymentsStartDeploymentJSONRequestBody defines body for DeploymentsStartDeployment for application/json ContentType.

type DeploymentsStopDeploymentJSONRequestBody

type DeploymentsStopDeploymentJSONRequestBody = V2DeploymentsStopDeploymentRequestBody

DeploymentsStopDeploymentJSONRequestBody defines body for DeploymentsStopDeployment for application/json ContentType.

type EmptyResponse

type EmptyResponse = map[string]interface{}

EmptyResponse Empty response object by design. A successful response indicates this operation was successfully executed.

type Environment

type Environment struct {
	// Build Build settings that control how the app is built.
	// Omitted until the environment has build settings.
	Build *EnvironmentBuild `json:"build,omitempty"`

	// CreatedAt Unix timestamp in milliseconds when the environment was created.
	CreatedAt int64 `json:"createdAt"`

	// DeleteProtection Whether delete protection is enabled for this environment.
	// When true, the environment cannot be deleted until protection is disabled.
	DeleteProtection bool `json:"deleteProtection"`

	// Description Human-readable description of this environment.
	// Empty string if none was provided.
	Description string `json:"description"`

	// Id The unique identifier of the environment, generated by Unkey.
	Id string `json:"id"`

	// Regions Per-region deployment settings for this environment.
	// Empty until regional settings are configured.
	Regions *[]EnvironmentRegion `json:"regions,omitempty"`

	// Runtime Runtime settings that control how the container runs.
	// Omitted until the environment has runtime settings.
	Runtime *EnvironmentRuntime `json:"runtime,omitempty"`

	// Slug Human-readable slug of the environment, unique within its app.
	Slug string `json:"slug"`

	// UpdatedAt Unix timestamp in milliseconds when the environment was last updated.
	// Omitted if the environment has never been updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

Environment defines model for Environment.

type EnvironmentBuild

type EnvironmentBuild struct {
	// AutoDeploy Whether pushes automatically trigger a deployment.
	AutoDeploy bool `json:"autoDeploy"`

	// BuildCommand Overrides the build command auto-detected by Railpack, so monorepos can
	// scope the build to a single app. Omitted when left to auto-detection or
	// for Dockerfile builds.
	BuildCommand *string `json:"buildCommand,omitempty"`

	// Dockerfile Path to the Dockerfile used to build the app, if any.
	Dockerfile *string `json:"dockerfile,omitempty"`

	// RootDirectory The directory the app is built from. "." for the repository root.
	RootDirectory string `json:"rootDirectory"`

	// WatchPaths Paths that trigger a rebuild when changed.
	WatchPaths []string `json:"watchPaths"`
}

EnvironmentBuild Build settings that control how the app is built. Omitted until the environment has build settings.

type EnvironmentHealthcheck

type EnvironmentHealthcheck struct {
	// FailureThreshold Consecutive failures before the container is restarted. Defaults to 3 when omitted.
	FailureThreshold *int `json:"failureThreshold,omitempty"`

	// InitialDelaySeconds Delay before the first probe runs, in seconds. Defaults to 0 when omitted.
	InitialDelaySeconds *int `json:"initialDelaySeconds,omitempty"`

	// IntervalSeconds How often the probe runs, in seconds. Defaults to 10 when omitted.
	IntervalSeconds *int `json:"intervalSeconds,omitempty"`

	// Method HTTP method used to probe the container.
	Method EnvironmentHealthcheckMethod `json:"method"`

	// Path HTTP path probed on the container. Must start with a slash.
	Path string `json:"path"`

	// TimeoutSeconds Per-probe timeout, in seconds. Defaults to 5 when omitted.
	TimeoutSeconds *int `json:"timeoutSeconds,omitempty"`
}

EnvironmentHealthcheck defines model for EnvironmentHealthcheck.

type EnvironmentHealthcheckMethod

type EnvironmentHealthcheckMethod string

EnvironmentHealthcheckMethod HTTP method used to probe the container.

const (
	EnvironmentHealthcheckMethodGET  EnvironmentHealthcheckMethod = "GET"
	EnvironmentHealthcheckMethodPOST EnvironmentHealthcheckMethod = "POST"
)

Defines values for EnvironmentHealthcheckMethod.

type EnvironmentRegion

type EnvironmentRegion struct {
	// Name Region name, such as us-east-1.
	Name string `json:"name"`

	// Replicas Min and max replica bounds for autoscaling in a region.
	Replicas Replicas `json:"replicas"`
}

EnvironmentRegion Replica bounds for a single region the environment deploys to.

type EnvironmentRuntime

type EnvironmentRuntime struct {
	// Command Container entrypoint command override.
	Command     []string                `json:"command"`
	Healthcheck *EnvironmentHealthcheck `json:"healthcheck,omitempty"`

	// MemoryMib Memory allocation in mebibytes.
	MemoryMib int `json:"memoryMib"`

	// OpenapiSpecPath Path to the OpenAPI spec served by the container, if any.
	OpenapiSpecPath *string `json:"openapiSpecPath,omitempty"`

	// Port Port the container listens on.
	Port int `json:"port"`

	// ShutdownSignal Signal sent to the container on shutdown.
	ShutdownSignal EnvironmentShutdownSignal `json:"shutdownSignal"`

	// StorageMib Ephemeral storage allocation in mebibytes.
	StorageMib int `json:"storageMib"`

	// UpstreamProtocol Protocol used to reach the container.
	UpstreamProtocol EnvironmentUpstreamProtocol `json:"upstreamProtocol"`

	// VCpus CPU allocation in vCPUs (1 = one vCPU, 0.5 = half a vCPU).
	VCpus float64 `json:"vCpus"`
}

EnvironmentRuntime Runtime settings that control how the container runs. Omitted until the environment has runtime settings.

type EnvironmentShutdownSignal

type EnvironmentShutdownSignal string

EnvironmentShutdownSignal Signal sent to the container on shutdown.

const (
	SIGINT  EnvironmentShutdownSignal = "SIGINT"
	SIGKILL EnvironmentShutdownSignal = "SIGKILL"
	SIGQUIT EnvironmentShutdownSignal = "SIGQUIT"
	SIGTERM EnvironmentShutdownSignal = "SIGTERM"
)

Defines values for EnvironmentShutdownSignal.

type EnvironmentUpstreamProtocol

type EnvironmentUpstreamProtocol string

EnvironmentUpstreamProtocol Protocol used to reach the container.

const (
	H2c   EnvironmentUpstreamProtocol = "h2c"
	Http1 EnvironmentUpstreamProtocol = "http1"
)

Defines values for EnvironmentUpstreamProtocol.

type EnvironmentVariable

type EnvironmentVariable struct {
	// CreatedAt Unix timestamp in milliseconds when the variable was created.
	CreatedAt int64 `json:"createdAt"`

	// Description Human-readable description. Omitted if none was provided.
	Description string `json:"description,omitempty"`

	// Key The variable name.
	Key string `json:"key"`

	// Kind How the value may be read back. `writeonly` values can never be read back
	// through the API; `recoverable` values can be decrypted. Values are encrypted
	// at rest either way.
	Kind EnvironmentVariableKind `json:"kind"`

	// Value The decrypted plaintext value. Present only for `recoverable` variables.
	// Omitted for `writeonly` variables, which can never be read back.
	Value string `json:"value,omitempty"`
}

EnvironmentVariable defines model for EnvironmentVariable.

type EnvironmentVariableInput

type EnvironmentVariableInput struct {
	// Description Human-readable description of the variable.
	Description *string `json:"description,omitempty"`

	// Key The variable name. Must be a POSIX shell name: letters, digits, and
	// underscores only, and must not start with a digit. Other names are
	// unreachable from shells and most runtimes.
	Key string `json:"key"`

	// Kind How the value may be read back. Defaults to `writeonly`.
	Kind *EnvironmentVariableKind `json:"kind,omitempty"`

	// Value The variable value. Always encrypted at rest. The limit is enforced
	// server-side in UTF-8 bytes, so a multibyte value may be rejected before
	// it reaches this code-point maximum.
	Value string `json:"value"`
}

EnvironmentVariableInput A single environment variable to set.

type EnvironmentVariableKind

type EnvironmentVariableKind string

EnvironmentVariableKind How the value may be read back. `writeonly` values can never be read back through the API; `recoverable` values can be decrypted. Values are encrypted at rest either way.

const (
	Recoverable EnvironmentVariableKind = "recoverable"
	Writeonly   EnvironmentVariableKind = "writeonly"
)

Defines values for EnvironmentVariableKind.

type EnvironmentsGetEnvironmentJSONRequestBody

type EnvironmentsGetEnvironmentJSONRequestBody = V2EnvironmentsGetEnvironmentRequestBody

EnvironmentsGetEnvironmentJSONRequestBody defines body for EnvironmentsGetEnvironment for application/json ContentType.

type EnvironmentsListEnvironmentVariablesJSONRequestBody

type EnvironmentsListEnvironmentVariablesJSONRequestBody = V2EnvironmentsListEnvironmentVariablesRequestBody

EnvironmentsListEnvironmentVariablesJSONRequestBody defines body for EnvironmentsListEnvironmentVariables for application/json ContentType.

type EnvironmentsListEnvironmentsJSONRequestBody

type EnvironmentsListEnvironmentsJSONRequestBody = V2EnvironmentsListEnvironmentsRequestBody

EnvironmentsListEnvironmentsJSONRequestBody defines body for EnvironmentsListEnvironments for application/json ContentType.

type EnvironmentsRemoveEnvironmentVariablesJSONRequestBody

type EnvironmentsRemoveEnvironmentVariablesJSONRequestBody = V2EnvironmentsRemoveEnvironmentVariablesRequestBody

EnvironmentsRemoveEnvironmentVariablesJSONRequestBody defines body for EnvironmentsRemoveEnvironmentVariables for application/json ContentType.

type EnvironmentsSetEnvironmentVariablesJSONRequestBody

type EnvironmentsSetEnvironmentVariablesJSONRequestBody = V2EnvironmentsSetEnvironmentVariablesRequestBody

EnvironmentsSetEnvironmentVariablesJSONRequestBody defines body for EnvironmentsSetEnvironmentVariables for application/json ContentType.

type EnvironmentsUpdateSettingsJSONRequestBody

type EnvironmentsUpdateSettingsJSONRequestBody = V2EnvironmentsUpdateSettingsRequestBody

EnvironmentsUpdateSettingsJSONRequestBody defines body for EnvironmentsUpdateSettings for application/json ContentType.

type FieldMatch

type FieldMatch struct {
	Name string `json:"name"`

	// Present Matches when the field is present, regardless of value.
	Present *FieldMatchPresent `json:"present,omitempty"`

	// Value String matcher. Exactly one of `exact`, `prefix` or `regex` must be set.
	Value *StringMatch `json:"value,omitempty"`
}

FieldMatch Matches a named request field (header or query parameter). Exactly one of `present` or `value` must be set.

type FieldMatchPresent

type FieldMatchPresent bool

FieldMatchPresent Matches when the field is present, regardless of value.

const (
	True FieldMatchPresent = true
)

Defines values for FieldMatchPresent.

type FirewallPolicy

type FirewallPolicy struct {
	// Action What to do with matching requests.
	Action FirewallPolicyAction `json:"action"`
}

FirewallPolicy Blocks matching requests.

type FirewallPolicyAction

type FirewallPolicyAction string

FirewallPolicyAction What to do with matching requests.

const (
	ACTIONDENY FirewallPolicyAction = "ACTION_DENY"
)

Defines values for FirewallPolicyAction.

type ForbiddenErrorResponse

type ForbiddenErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

ForbiddenErrorResponse Error response when the provided credentials are valid but lack sufficient permissions for the requested operation. This occurs when: - The root key doesn't have the required permissions for this endpoint - The operation requires elevated privileges that the current key lacks - Access to the requested resource is restricted based on workspace settings

To resolve this error, ensure your root key has the necessary permissions or contact your workspace administrator.

type GatewayListPoliciesJSONRequestBody

type GatewayListPoliciesJSONRequestBody = V2GatewayListPoliciesRequestBody

GatewayListPoliciesJSONRequestBody defines body for GatewayListPolicies for application/json ContentType.

type GatewaySetPoliciesJSONRequestBody

type GatewaySetPoliciesJSONRequestBody = V2GatewaySetPoliciesRequestBody

GatewaySetPoliciesJSONRequestBody defines body for GatewaySetPolicies for application/json ContentType.

type GatewayUpdatePolicyJSONRequestBody

type GatewayUpdatePolicyJSONRequestBody = V2GatewayUpdatePolicyRequestBody

GatewayUpdatePolicyJSONRequestBody defines body for GatewayUpdatePolicy for application/json ContentType.

type GoneErrorResponse

type GoneErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

GoneErrorResponse Error response when the requested resource has been soft-deleted and is no longer available. This occurs when: - The resource has been marked as deleted but still exists in the database - The resource is intentionally unavailable but could potentially be restored - The resource cannot be restored through the API or dashboard

To resolve this error, contact support if you need the resource restored.

type HeaderKey

type HeaderKey struct {
	Name string `json:"name"`
}

HeaderKey Rate limit by the value of a request header.

type HeaderKeyLocation

type HeaderKeyLocation struct {
	Name string `json:"name"`

	// StripPrefix Optional prefix removed from the header value before verification.
	StripPrefix *string `json:"stripPrefix,omitempty"`
}

HeaderKeyLocation Extract the key from a custom header.

type IdentitiesCreateIdentityJSONRequestBody

type IdentitiesCreateIdentityJSONRequestBody = V2IdentitiesCreateIdentityRequestBody

IdentitiesCreateIdentityJSONRequestBody defines body for IdentitiesCreateIdentity for application/json ContentType.

type IdentitiesDeleteIdentityJSONRequestBody

type IdentitiesDeleteIdentityJSONRequestBody = V2IdentitiesDeleteIdentityRequestBody

IdentitiesDeleteIdentityJSONRequestBody defines body for IdentitiesDeleteIdentity for application/json ContentType.

type IdentitiesGetIdentityJSONRequestBody

type IdentitiesGetIdentityJSONRequestBody = V2IdentitiesGetIdentityRequestBody

IdentitiesGetIdentityJSONRequestBody defines body for IdentitiesGetIdentity for application/json ContentType.

type IdentitiesListIdentitiesJSONRequestBody

type IdentitiesListIdentitiesJSONRequestBody = V2IdentitiesListIdentitiesRequestBody

IdentitiesListIdentitiesJSONRequestBody defines body for IdentitiesListIdentities for application/json ContentType.

type IdentitiesUpdateIdentityJSONRequestBody

type IdentitiesUpdateIdentityJSONRequestBody = V2IdentitiesUpdateIdentityRequestBody

IdentitiesUpdateIdentityJSONRequestBody defines body for IdentitiesUpdateIdentity for application/json ContentType.

type Identity

type Identity struct {
	// ExternalId External identity ID
	ExternalId string `json:"externalId"`

	// Id Identity ID
	Id string `json:"id"`

	// Meta Identity metadata
	Meta map[string]interface{} `json:"meta,omitempty"`

	// Ratelimits Identity ratelimits
	Ratelimits []RatelimitResponse `json:"ratelimits,omitempty"`
}

Identity defines model for Identity.

type InternalServerErrorResponse

type InternalServerErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

InternalServerErrorResponse Error response when an unexpected error occurs on the server. This indicates a problem with Unkey's systems rather than your request.

When you encounter this error: - The request ID in the response can help Unkey support investigate the issue - The error is likely temporary and retrying may succeed - If the error persists, contact Unkey support with the request ID

type KeyCreditsData

type KeyCreditsData struct {
	// Refill Configuration for automatic credit refill behavior.
	Refill *KeyCreditsRefill `json:"refill,omitempty"`

	// Remaining Number of credits remaining (null for unlimited).
	Remaining nullable.Nullable[int64] `json:"remaining"`
}

KeyCreditsData Credit configuration and remaining balance for this key.

type KeyCreditsRefill

type KeyCreditsRefill struct {
	// Amount Number of credits to add during each refill cycle.
	Amount int64 `json:"amount"`

	// Interval How often credits are automatically refilled.
	Interval KeyCreditsRefillInterval `json:"interval"`

	// RefillDay Day of the month for monthly refills (1-31).
	// Only required when interval is 'monthly'.
	// For days beyond the month's length, refill occurs on the last day of the month.
	RefillDay int `json:"refillDay,omitempty"`
}

KeyCreditsRefill Configuration for automatic credit refill behavior.

type KeyCreditsRefillInterval

type KeyCreditsRefillInterval string

KeyCreditsRefillInterval How often credits are automatically refilled.

const (
	KeyCreditsRefillIntervalDaily   KeyCreditsRefillInterval = "daily"
	KeyCreditsRefillIntervalMonthly KeyCreditsRefillInterval = "monthly"
)

Defines values for KeyCreditsRefillInterval.

type KeyLocation

type KeyLocation struct {
	// Bearer Extract the key from the `Authorization Bearer` header.
	Bearer *BearerTokenLocation `json:"bearer,omitempty"`

	// Header Extract the key from a custom header.
	Header *HeaderKeyLocation `json:"header,omitempty"`

	// QueryParam Extract the key from a query parameter.
	QueryParam *QueryParamKeyLocation `json:"queryParam,omitempty"`
}

KeyLocation Where to look for the API key on incoming requests. Exactly one of `bearer`, `header` or `queryParam` must be set.

type KeyRatelimit

type KeyRatelimit struct {
	// Cost Cost charged against the limit per request. Defaults to 1.
	Cost *int64 `json:"cost,omitempty"`

	// Duration Inline override: window duration in milliseconds. Must be set together
	// with `limit`.
	Duration *int64 `json:"duration,omitempty"`

	// Limit Inline override: maximum number of operations per window. Must be set
	// together with `duration`.
	Limit *int64 `json:"limit,omitempty"`

	// Name Name of a rate limit configured on the key or its identity, or the name
	// of the inline override defined by `limit` and `duration`.
	Name string `json:"name"`
}

KeyRatelimit A rate limit applied during key verification. `limit` and `duration` must be set together or both omitted; a partial pair is rejected.

type KeyResponseData

type KeyResponseData struct {
	// CreatedAt Unix timestamp in milliseconds when key was created.
	CreatedAt int64 `json:"createdAt"`

	// Credits Credit configuration and remaining balance for this key.
	Credits *KeyCreditsData `json:"credits,omitempty"`

	// Enabled Whether the key is enabled or disabled.
	Enabled bool `json:"enabled"`

	// Expires Unix timestamp in milliseconds when key expires (if set).
	Expires  int64     `json:"expires,omitempty"`
	Identity *Identity `json:"identity,omitempty"`

	// KeyId Unique identifier for this key.
	KeyId string `json:"keyId"`

	// LastUsedAt Unix timestamp in milliseconds when key was last used for verification. This is an approximated value, accurate to within 5 minutes.
	LastUsedAt int64 `json:"lastUsedAt,omitempty"`

	// Meta Custom metadata associated with this key.
	Meta map[string]interface{} `json:"meta,omitempty"`

	// Name Human-readable name for this key.
	Name        string   `json:"name,omitempty"`
	Permissions []string `json:"permissions,omitempty"`

	// Plaintext Decrypted key value (only when decrypt=true).
	Plaintext  string              `json:"plaintext,omitempty"`
	Ratelimits []RatelimitResponse `json:"ratelimits,omitempty"`
	Roles      []string            `json:"roles,omitempty"`

	// Start First few characters of the key for identification.
	Start string `json:"start"`

	// UpdatedAt Unix timestamp in milliseconds when key was last updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

KeyResponseData defines model for KeyResponseData.

type KeyauthPolicy

type KeyauthPolicy struct {
	// Keyspaces Keyspaces to verify keys against, referenced by id. All keyspaces must
	// belong to your workspace.
	Keyspaces []string `json:"keyspaces"`

	// Locations Where to look for the key on incoming requests, tried in order. Defaults
	// to the `Authorization Bearer` header when omitted.
	Locations *[]KeyLocation `json:"locations,omitempty"`

	// PermissionQuery Optional permission query the verified key must satisfy, e.g.
	// `documents.read AND documents.write`.
	PermissionQuery *string `json:"permissionQuery,omitempty"`

	// Ratelimits Rate limits applied during key verification.
	Ratelimits *[]KeyRatelimit `json:"ratelimits,omitempty"`
}

KeyauthPolicy Verifies Unkey API keys on matching requests.

type KeysAddPermissionsJSONRequestBody

type KeysAddPermissionsJSONRequestBody = V2KeysAddPermissionsRequestBody

KeysAddPermissionsJSONRequestBody defines body for KeysAddPermissions for application/json ContentType.

type KeysAddRolesJSONRequestBody

type KeysAddRolesJSONRequestBody = V2KeysAddRolesRequestBody

KeysAddRolesJSONRequestBody defines body for KeysAddRoles for application/json ContentType.

type KeysCreateKeyJSONRequestBody

type KeysCreateKeyJSONRequestBody = V2KeysCreateKeyRequestBody

KeysCreateKeyJSONRequestBody defines body for KeysCreateKey for application/json ContentType.

type KeysDeleteKeyJSONRequestBody

type KeysDeleteKeyJSONRequestBody = V2KeysDeleteKeyRequestBody

KeysDeleteKeyJSONRequestBody defines body for KeysDeleteKey for application/json ContentType.

type KeysGetKeyJSONRequestBody

type KeysGetKeyJSONRequestBody = V2KeysGetKeyRequestBody

KeysGetKeyJSONRequestBody defines body for KeysGetKey for application/json ContentType.

type KeysMigrateKeysJSONRequestBody

type KeysMigrateKeysJSONRequestBody = V2KeysMigrateKeysRequestBody

KeysMigrateKeysJSONRequestBody defines body for KeysMigrateKeys for application/json ContentType.

type KeysRemovePermissionsJSONRequestBody

type KeysRemovePermissionsJSONRequestBody = V2KeysRemovePermissionsRequestBody

KeysRemovePermissionsJSONRequestBody defines body for KeysRemovePermissions for application/json ContentType.

type KeysRemoveRolesJSONRequestBody

type KeysRemoveRolesJSONRequestBody = V2KeysRemoveRolesRequestBody

KeysRemoveRolesJSONRequestBody defines body for KeysRemoveRoles for application/json ContentType.

type KeysRerollKeyJSONRequestBody

type KeysRerollKeyJSONRequestBody = V2KeysRerollKeyRequestBody

KeysRerollKeyJSONRequestBody defines body for KeysRerollKey for application/json ContentType.

type KeysSetPermissionsJSONRequestBody

type KeysSetPermissionsJSONRequestBody = V2KeysSetPermissionsRequestBody

KeysSetPermissionsJSONRequestBody defines body for KeysSetPermissions for application/json ContentType.

type KeysSetRolesJSONRequestBody

type KeysSetRolesJSONRequestBody = V2KeysSetRolesRequestBody

KeysSetRolesJSONRequestBody defines body for KeysSetRoles for application/json ContentType.

type KeysUpdateCreditsJSONRequestBody

type KeysUpdateCreditsJSONRequestBody = V2KeysUpdateCreditsRequestBody

KeysUpdateCreditsJSONRequestBody defines body for KeysUpdateCredits for application/json ContentType.

type KeysUpdateKeyJSONRequestBody

type KeysUpdateKeyJSONRequestBody = V2KeysUpdateKeyRequestBody

KeysUpdateKeyJSONRequestBody defines body for KeysUpdateKey for application/json ContentType.

type KeysVerifyKeyCredits

type KeysVerifyKeyCredits struct {
	// Cost Sets how many credits to deduct for this verification request.
	// Use 0 for read-only operations or free tier access, higher values for premium features.
	// Credits are deducted after all security checks pass.
	// Essential for implementing usage-based pricing with different operation costs.
	Cost int64 `json:"cost"`
}

KeysVerifyKeyCredits Controls credit consumption for usage-based billing and quota enforcement. Omitting this field uses the default cost of 1 credit per verification. Credits provide globally consistent usage tracking, essential for paid APIs with strict quotas.

type KeysVerifyKeyJSONRequestBody

type KeysVerifyKeyJSONRequestBody = V2KeysVerifyKeyRequestBody

KeysVerifyKeyJSONRequestBody defines body for KeysVerifyKey for application/json ContentType.

type KeysVerifyKeyRatelimit

type KeysVerifyKeyRatelimit struct {
	// Cost Optionally override how expensive this operation is and how many tokens are deducted from the current limit.
	Cost *int `json:"cost,omitempty"`

	// Duration Optionally override the duration of the rate limit window duration.
	Duration *int `json:"duration,omitempty"`

	// Limit Optionally override the maximum number of requests allowed within the specified interval.
	Limit *int `json:"limit,omitempty"`

	// Name References an existing ratelimit by its name. Key Ratelimits will take precedence over identifier-based limits.
	Name string `json:"name"`
}

KeysVerifyKeyRatelimit defines model for KeysVerifyKeyRatelimit.

type KeysWhoamiJSONRequestBody

type KeysWhoamiJSONRequestBody = V2KeysWhoamiRequestBody

KeysWhoamiJSONRequestBody defines body for KeysWhoami for application/json ContentType.

type MatchExpr

type MatchExpr struct {
	// Header Matches a named request field (header or query parameter). Exactly one of
	// `present` or `value` must be set.
	Header *FieldMatch `json:"header,omitempty"`

	// Method Matches when the request method is one of the listed methods.
	Method *MethodMatch `json:"method,omitempty"`

	// Path Matches on the request path.
	Path *PathMatch `json:"path,omitempty"`

	// QueryParam Matches a named request field (header or query parameter). Exactly one of
	// `present` or `value` must be set.
	QueryParam *FieldMatch `json:"queryParam,omitempty"`
}

MatchExpr A single request match expression. Exactly one of `path`, `method`, `header` or `queryParam` must be set.

type Meta

type Meta struct {
	// RequestId A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
	RequestId string `json:"requestId"`
}

Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.

type MethodMatch

type MethodMatch struct {
	Methods []MethodMatchMethods `json:"methods"`
}

MethodMatch Matches when the request method is one of the listed methods.

type MethodMatchMethods

type MethodMatchMethods string

MethodMatchMethods defines model for MethodMatch.Methods.

const (
	MethodMatchMethodsDELETE  MethodMatchMethods = "DELETE"
	MethodMatchMethodsGET     MethodMatchMethods = "GET"
	MethodMatchMethodsHEAD    MethodMatchMethods = "HEAD"
	MethodMatchMethodsOPTIONS MethodMatchMethods = "OPTIONS"
	MethodMatchMethodsPATCH   MethodMatchMethods = "PATCH"
	MethodMatchMethodsPOST    MethodMatchMethods = "POST"
	MethodMatchMethodsPUT     MethodMatchMethods = "PUT"
)

Defines values for MethodMatchMethods.

type NotFoundErrorResponse

type NotFoundErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

NotFoundErrorResponse Error response when the requested resource cannot be found. This occurs when: - The specified resource ID doesn't exist in your workspace - The resource has been deleted or moved - The resource exists but is not accessible with current permissions

To resolve this error, verify the resource ID is correct and that you have access to it.

type OpenapiPolicy

type OpenapiPolicy = map[string]interface{}

OpenapiPolicy Validates matching requests against the app's uploaded OpenAPI spec. Has no configuration of its own. If no spec has been uploaded for the deployment, the policy is a no-op and requests pass through unvalidated.

type Pagination

type Pagination struct {
	// Cursor Opaque pagination token for retrieving the next page of results.
	// Include this exact value in the cursor field of subsequent requests.
	// Cursors are temporary and may expire after extended periods.
	Cursor *string `json:"cursor,omitempty"`

	// HasMore Indicates whether additional results exist beyond this page.
	// When true, use the cursor to fetch the next page.
	// When false, you have reached the end of the result set.
	HasMore bool `json:"hasMore"`
}

Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.

type PathKey

type PathKey = map[string]interface{}

PathKey Rate limit by the request path.

type PathMatch

type PathMatch struct {
	// Path String matcher. Exactly one of `exact`, `prefix` or `regex` must be set.
	Path StringMatch `json:"path"`
}

PathMatch Matches on the request path.

type Permission

type Permission struct {
	// Description Optional detailed explanation of what this permission grants access to.
	// Helps team members understand the scope and implications of granting this permission.
	// Include information about what resources can be accessed and what actions can be performed.
	// Not visible to end users - this is for internal documentation and team clarity.
	Description string `json:"description,omitempty"`

	// Id The unique identifier for this permission within Unkey's system.
	// Generated automatically when the permission is created and used to reference this permission in API operations.
	// Always begins with 'perm_' followed by alphanumeric characters and underscores.
	Id string `json:"id"`

	// Name The human-readable name for this permission that describes its purpose.
	// Should be descriptive enough for developers to understand what access it grants.
	// Use clear, semantic names that reflect the resources or actions being permitted.
	// Names must be unique within your workspace to avoid confusion and conflicts.
	Name string `json:"name"`

	// Slug The unique URL-safe identifier for this permission.
	Slug string `json:"slug"`
}

Permission defines model for Permission.

type PermissionsCreatePermissionJSONRequestBody

type PermissionsCreatePermissionJSONRequestBody = V2PermissionsCreatePermissionRequestBody

PermissionsCreatePermissionJSONRequestBody defines body for PermissionsCreatePermission for application/json ContentType.

type PermissionsCreateRoleJSONRequestBody

type PermissionsCreateRoleJSONRequestBody = V2PermissionsCreateRoleRequestBody

PermissionsCreateRoleJSONRequestBody defines body for PermissionsCreateRole for application/json ContentType.

type PermissionsDeletePermissionJSONRequestBody

type PermissionsDeletePermissionJSONRequestBody = V2PermissionsDeletePermissionRequestBody

PermissionsDeletePermissionJSONRequestBody defines body for PermissionsDeletePermission for application/json ContentType.

type PermissionsDeleteRoleJSONRequestBody

type PermissionsDeleteRoleJSONRequestBody = V2PermissionsDeleteRoleRequestBody

PermissionsDeleteRoleJSONRequestBody defines body for PermissionsDeleteRole for application/json ContentType.

type PermissionsGetPermissionJSONRequestBody

type PermissionsGetPermissionJSONRequestBody = V2PermissionsGetPermissionRequestBody

PermissionsGetPermissionJSONRequestBody defines body for PermissionsGetPermission for application/json ContentType.

type PermissionsGetRoleJSONRequestBody

type PermissionsGetRoleJSONRequestBody = V2PermissionsGetRoleRequestBody

PermissionsGetRoleJSONRequestBody defines body for PermissionsGetRole for application/json ContentType.

type PermissionsListPermissionsJSONRequestBody

type PermissionsListPermissionsJSONRequestBody = V2PermissionsListPermissionsRequestBody

PermissionsListPermissionsJSONRequestBody defines body for PermissionsListPermissions for application/json ContentType.

type PermissionsListRolesJSONRequestBody

type PermissionsListRolesJSONRequestBody = V2PermissionsListRolesRequestBody

PermissionsListRolesJSONRequestBody defines body for PermissionsListRoles for application/json ContentType.

type Policy

type Policy struct {
	// Enabled Disabled policies are stored but skipped during evaluation.
	Enabled bool `json:"enabled"`

	// Firewall Blocks matching requests.
	Firewall *FirewallPolicy `json:"firewall,omitempty"`

	// Keyauth Verifies Unkey API keys on matching requests.
	Keyauth *KeyauthPolicy `json:"keyauth,omitempty"`

	// Match Optional request matchers. The policy applies only to requests matching
	// all expressions; omit to apply to every request.
	Match *[]MatchExpr `json:"match,omitempty"`

	// Name Human-readable name shown in the dashboard.
	Name string `json:"name"`

	// Openapi Validates matching requests against the app's uploaded OpenAPI spec. Has no
	// configuration of its own. If no spec has been uploaded for the deployment,
	// the policy is a no-op and requests pass through unvalidated.
	Openapi *OpenapiPolicy `json:"openapi,omitempty"`

	// Ratelimit Rate limits matching requests.
	Ratelimit *RatelimitPolicy `json:"ratelimit,omitempty"`
}

Policy A gateway policy. Exactly one of `keyauth`, `ratelimit`, `firewall` or `openapi` must be set. The server generates an id for every policy it stores.

type PolicyResponse

type PolicyResponse struct {
	// Enabled Disabled policies are stored but skipped during evaluation.
	Enabled bool `json:"enabled"`

	// Firewall Blocks matching requests.
	Firewall *FirewallPolicy `json:"firewall,omitempty"`

	// Id Server-generated policy id. Regenerated on every `gateway.setPolicies` call, so treat it as stable only until the environment's policies are next replaced.
	Id string `json:"id"`

	// Keyauth Verifies Unkey API keys on matching requests.
	Keyauth *KeyauthPolicy `json:"keyauth,omitempty"`

	// Match Optional request matchers. The policy applies only to requests matching
	// all expressions; omitted when the policy applies to every request.
	Match *[]MatchExpr `json:"match,omitempty"`

	// Name Human-readable name shown in the dashboard.
	Name string `json:"name"`

	// Openapi Validates matching requests against the app's uploaded OpenAPI spec. Has no
	// configuration of its own. If no spec has been uploaded for the deployment,
	// the policy is a no-op and requests pass through unvalidated.
	Openapi *OpenapiPolicy `json:"openapi,omitempty"`

	// Ratelimit Rate limits matching requests.
	Ratelimit *RatelimitPolicy `json:"ratelimit,omitempty"`
}

PolicyResponse A stored gateway policy as returned by list endpoints. Exactly one of `keyauth`, `ratelimit`, `firewall` or `openapi` is set.

type PortalCreateSessionJSONRequestBody

type PortalCreateSessionJSONRequestBody = V2PortalCreateSessionRequestBody

PortalCreateSessionJSONRequestBody defines body for PortalCreateSession for application/json ContentType.

type PortalExchangeSessionJSONRequestBody

type PortalExchangeSessionJSONRequestBody = V2PortalExchangeSessionRequestBody

PortalExchangeSessionJSONRequestBody defines body for PortalExchangeSession for application/json ContentType.

type PortalGetVerificationsJSONRequestBody

type PortalGetVerificationsJSONRequestBody = V2PortalGetVerificationsRequestBody

PortalGetVerificationsJSONRequestBody defines body for PortalGetVerifications for application/json ContentType.

type PortalListKeysJSONRequestBody

type PortalListKeysJSONRequestBody = V2PortalListKeysRequestBody

PortalListKeysJSONRequestBody defines body for PortalListKeys for application/json ContentType.

type PortalRerollKeyJSONRequestBody

type PortalRerollKeyJSONRequestBody = V2KeysRerollKeyRequestBody

PortalRerollKeyJSONRequestBody defines body for PortalRerollKey for application/json ContentType.

type PreconditionFailedErrorResponse

type PreconditionFailedErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

PreconditionFailedErrorResponse Error response when one or more conditions specified in the request headers are not met. This typically occurs when: - Using conditional requests with If-Match or If-None-Match headers - The resource version doesn't match the expected value - Optimistic concurrency control detects a conflict

To resolve this error, fetch the latest version of the resource and retry with updated conditions.

type PrincipalFieldKey

type PrincipalFieldKey struct {
	Path string `json:"path"`
}

PrincipalFieldKey Rate limit by a field extracted from the authenticated principal.

type Project

type Project struct {
	// CreatedAt Unix timestamp in milliseconds when the project was created.
	CreatedAt int64 `json:"createdAt"`

	// DeleteProtection Whether delete protection is enabled for this project.
	// When true, the project cannot be deleted until protection is disabled.
	DeleteProtection bool `json:"deleteProtection"`

	// Id The unique identifier of the project, generated by Unkey.
	Id string `json:"id"`

	// Name Human-readable name for this project.
	Name string `json:"name"`

	// Slug URL-safe handle for this project, unique within your workspace.
	// This is the caller-defined identifier used to reference the project in get, update, and delete operations.
	Slug string `json:"slug"`

	// UpdatedAt Unix timestamp in milliseconds when the project was last updated.
	// Omitted if the project has never been updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

Project defines model for Project.

type ProjectsCreateProjectJSONRequestBody

type ProjectsCreateProjectJSONRequestBody = V2ProjectsCreateProjectRequestBody

ProjectsCreateProjectJSONRequestBody defines body for ProjectsCreateProject for application/json ContentType.

type ProjectsDeleteProjectJSONRequestBody

type ProjectsDeleteProjectJSONRequestBody = V2ProjectsDeleteProjectRequestBody

ProjectsDeleteProjectJSONRequestBody defines body for ProjectsDeleteProject for application/json ContentType.

type ProjectsGetProjectJSONRequestBody

type ProjectsGetProjectJSONRequestBody = V2ProjectsGetProjectRequestBody

ProjectsGetProjectJSONRequestBody defines body for ProjectsGetProject for application/json ContentType.

type ProjectsListProjectsJSONRequestBody

type ProjectsListProjectsJSONRequestBody = V2ProjectsListProjectsRequestBody

ProjectsListProjectsJSONRequestBody defines body for ProjectsListProjects for application/json ContentType.

type ProjectsUpdateProjectJSONRequestBody

type ProjectsUpdateProjectJSONRequestBody = V2ProjectsUpdateProjectRequestBody

ProjectsUpdateProjectJSONRequestBody defines body for ProjectsUpdateProject for application/json ContentType.

type QueryParamKeyLocation

type QueryParamKeyLocation struct {
	Name string `json:"name"`
}

QueryParamKeyLocation Extract the key from a query parameter.

type RatelimitDeleteOverrideJSONRequestBody

type RatelimitDeleteOverrideJSONRequestBody = V2RatelimitDeleteOverrideRequestBody

RatelimitDeleteOverrideJSONRequestBody defines body for RatelimitDeleteOverride for application/json ContentType.

type RatelimitGetOverrideJSONRequestBody

type RatelimitGetOverrideJSONRequestBody = V2RatelimitGetOverrideRequestBody

RatelimitGetOverrideJSONRequestBody defines body for RatelimitGetOverride for application/json ContentType.

type RatelimitIdentifier

type RatelimitIdentifier struct {
	// AuthenticatedSubject Rate limit by the authenticated subject (e.g. the verified key).
	AuthenticatedSubject *AuthenticatedSubjectKey `json:"authenticatedSubject,omitempty"`

	// Header Rate limit by the value of a request header.
	Header *HeaderKey `json:"header,omitempty"`

	// Path Rate limit by the request path.
	Path *PathKey `json:"path,omitempty"`

	// PrincipalField Rate limit by a field extracted from the authenticated principal.
	PrincipalField *PrincipalFieldKey `json:"principalField,omitempty"`

	// RemoteIp Rate limit by the client's IP address.
	RemoteIp *RemoteIpKey `json:"remoteIp,omitempty"`
}

RatelimitIdentifier How requests are grouped for rate limiting. Exactly one of `remoteIp`, `header`, `authenticatedSubject`, `path` or `principalField` must be set.

type RatelimitLimitJSONRequestBody

type RatelimitLimitJSONRequestBody = V2RatelimitLimitRequestBody

RatelimitLimitJSONRequestBody defines body for RatelimitLimit for application/json ContentType.

type RatelimitListOverridesJSONRequestBody

type RatelimitListOverridesJSONRequestBody = V2RatelimitListOverridesRequestBody

RatelimitListOverridesJSONRequestBody defines body for RatelimitListOverrides for application/json ContentType.

type RatelimitMultiLimitJSONRequestBody

type RatelimitMultiLimitJSONRequestBody = V2RatelimitMultiLimitRequestBody

RatelimitMultiLimitJSONRequestBody defines body for RatelimitMultiLimit for application/json ContentType.

type RatelimitOverride

type RatelimitOverride struct {
	// Duration The duration in milliseconds for this override's rate limit window. This may differ from the default duration for the namespace, allowing custom time windows for specific entities. After this duration elapses, the rate limit counter for affected identifiers resets to zero.
	Duration int64 `json:"duration"`

	// Identifier The identifier pattern this override applies to. This determines which entities receive the custom rate limit.
	//
	// This can be:
	// - An exact identifier for a specific entity
	// - A pattern with wildcards for matching multiple entities
	//
	// Wildcard examples:
	// - 'admin_*' matches any identifier starting with 'admin_'
	// - '*_test' matches any identifier ending with '_test'
	// - '*premium*' matches any identifier containing 'premium'
	//
	// More complex patterns can combine multiple wildcards. Detailed documentation on pattern matching rules is available at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules
	Identifier string `json:"identifier"`

	// Limit The maximum number of requests allowed for entities matching this override. This replaces the default limit for the namespace when applied.
	//
	// Common use cases:
	// - Higher limits for premium customers
	// - Reduced limits for abusive or suspicious entities
	// - Zero limit to completely block specific patterns
	// - Custom tier-based limits for different customer segments
	Limit int64 `json:"limit"`

	// OverrideId The unique identifier of this specific rate limit override. This ID is generated when the override is created and can be used for management operations like updating or deleting the override.
	OverrideId string `json:"overrideId"`
}

RatelimitOverride defines model for RatelimitOverride.

type RatelimitPolicy

type RatelimitPolicy struct {
	// Identifier How requests are grouped for rate limiting. Exactly one of `remoteIp`,
	// `header`, `authenticatedSubject`, `path` or `principalField` must be set.
	Identifier RatelimitIdentifier `json:"identifier"`

	// Limit Maximum number of requests per window.
	Limit int64 `json:"limit"`

	// WindowMs Window duration in milliseconds.
	WindowMs int64 `json:"windowMs"`
}

RatelimitPolicy Rate limits matching requests.

type RatelimitRequest

type RatelimitRequest struct {
	// AutoApply Whether this ratelimit should be automatically applied when verifying a key.
	AutoApply bool `json:"autoApply"`

	// Duration The duration for each ratelimit window in milliseconds.
	//
	// This controls how long the rate limit counter accumulates before resetting. Common values include:
	// - 1000 (1 second): For strict per-second limits on high-frequency operations
	// - 60000 (1 minute): For moderate API usage control
	// - 3600000 (1 hour): For less frequent but costly operations
	// - 86400000 (24 hours): For daily quotas
	//
	// Shorter windows provide more frequent resets but may allow large burst usage. Longer windows provide more consistent usage patterns but take longer to reset after limit exhaustion.
	Duration int64 `json:"duration"`

	// Limit The maximum number of operations allowed within the specified time window.
	//
	// When this limit is reached, verification requests will fail with `code=RATE_LIMITED` until the window resets. The limit should reflect:
	// - Your infrastructure capacity and scaling limitations
	// - Fair usage expectations for your service
	// - Different tier levels for various user types
	// - The relative cost of the operations being limited
	//
	// Higher values allow more frequent access but may impact service performance.
	Limit int64 `json:"limit"`

	// Name The name of this rate limit. This name is used to identify which limit to check during key verification.
	//
	// Best practices for limit names:
	// - Use descriptive, semantic names like 'api_requests', 'heavy_operations', or 'downloads'
	// - Be consistent with naming conventions across your application
	// - Create separate limits for different resource types or operation costs
	// - Consider using namespaced names for better organization (e.g., 'files.downloads', 'compute.training')
	//
	// You will reference this exact name when verifying keys to check against this specific limit.
	Name string `json:"name"`
}

RatelimitRequest defines model for RatelimitRequest.

type RatelimitResponse

type RatelimitResponse struct {
	// AutoApply Whether this rate limit was automatically applied when verifying the key.
	AutoApply bool `json:"autoApply"`

	// Duration Rate limit window duration in milliseconds.
	Duration int64 `json:"duration"`

	// Id Unique identifier for this rate limit configuration.
	Id string `json:"id"`

	// Limit Maximum requests allowed within the time window.
	Limit int64 `json:"limit"`

	// Name Human-readable name for this rate limit.
	Name string `json:"name"`
}

RatelimitResponse defines model for RatelimitResponse.

type RatelimitSetOverrideJSONRequestBody

type RatelimitSetOverrideJSONRequestBody = V2RatelimitSetOverrideRequestBody

RatelimitSetOverrideJSONRequestBody defines body for RatelimitSetOverride for application/json ContentType.

type RemoteIpKey

type RemoteIpKey = map[string]interface{}

RemoteIpKey Rate limit by the client's IP address.

type Replicas

type Replicas struct {
	// Max Maximum number of replicas.
	Max int `json:"max"`

	// Min Minimum number of replicas.
	Min int `json:"min"`
}

Replicas Min and max replica bounds for autoscaling in a region.

type ResourceIdentifier

type ResourceIdentifier = string

ResourceIdentifier Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.

type Role

type Role struct {
	// Description Optional detailed explanation of what this role encompasses and what access it provides.
	// Helps team members understand the role's scope, intended use cases, and security implications.
	// Include information about what types of users should receive this role and what they can accomplish.
	// Not visible to end users - this is for internal documentation and access control audits.
	Description string `json:"description,omitempty"`

	// Id The unique identifier for this role within Unkey's system.
	// Generated automatically when the role is created and used to reference this role in API operations.
	// Always begins with 'role_' followed by alphanumeric characters and underscores.
	Id string `json:"id"`

	// Name The human-readable name for this role that describes its function.
	// Should be descriptive enough for administrators to understand what access this role provides.
	// Use clear, semantic names that reflect the job function or responsibility level.
	// Names must be unique within your workspace to avoid confusion during role assignment.
	Name string `json:"name"`

	// Permissions Complete list of permissions currently assigned to this role.
	// Each permission grants specific access rights that will be inherited by any keys or users assigned this role.
	// Use this list to understand the full scope of access provided by this role.
	// Permissions can be added or removed from roles without affecting the role's identity or other properties.
	// Empty array indicates a role with no permissions currently assigned.
	Permissions []Permission `json:"permissions,omitempty"`
}

Role defines model for Role.

type ServiceUnavailableErrorResponse

type ServiceUnavailableErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

ServiceUnavailableErrorResponse Error response when a required service is temporarily unavailable. This indicates that the service exists but cannot be reached or is not responding.

When you encounter this error: - The service is likely experiencing temporary issues - Retrying the request after a short delay may succeed - If the error persists, the service may be undergoing maintenance - Contact Unkey support if the issue continues

type StringMatch

type StringMatch struct {
	// Exact Matches when the input equals this value.
	Exact *string `json:"exact,omitempty"`

	// IgnoreCase Compare case-insensitively. May accompany any match mode.
	IgnoreCase *bool `json:"ignoreCase,omitempty"`

	// Prefix Matches when the input starts with this value.
	Prefix *string `json:"prefix,omitempty"`

	// Regex Matches when the input satisfies this RE2 regular expression. Invalid
	// patterns are rejected when the policy is created.
	Regex *string `json:"regex,omitempty"`
}

StringMatch String matcher. Exactly one of `exact`, `prefix` or `regex` must be set.

type TooManyRequestsErrorResponse

type TooManyRequestsErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

TooManyRequestsErrorResponse Error response when the client has sent too many requests in a given time period. This occurs when you've exceeded a rate limit or quota for the resource you're accessing.

The rate limit resets automatically after the time window expires. To avoid this error: - Implement exponential backoff when retrying requests - Cache results where appropriate to reduce request frequency - Check the error detail message for specific quota information - Contact support if you need a higher quota for your use case

type UnauthorizedErrorResponse

type UnauthorizedErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

UnauthorizedErrorResponse Error response when authentication has failed or credentials are missing. This occurs when: - No authentication token is provided in the request - The provided token is invalid, expired, or malformed - The token format doesn't match expected patterns

To resolve this error, ensure you're including a valid root key in the Authorization header.

type UnprocessableEntityErrorResponse

type UnprocessableEntityErrorResponse struct {
	// Error Base error structure following Problem Details for HTTP APIs (RFC 7807). This provides a standardized way to carry machine-readable details of errors in HTTP response content.
	Error BaseError `json:"error"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

UnprocessableEntityErrorResponse Error response when the request is syntactically valid but cannot be processed due to semantic constraints or resource limitations. This occurs when: - A query exceeds execution time limits - A query uses more memory than allowed - A query scans too many rows - A query result exceeds size limits

The request syntax is correct, but the operation cannot be completed due to business rules or resource constraints. Review the error details for specific limitations and adjust your request accordingly.

type UpdateKeyCreditsData

type UpdateKeyCreditsData struct {
	// Refill Configuration for automatic credit refill behavior.
	Refill nullable.Nullable[UpdateKeyCreditsRefill] `json:"refill,omitempty"`

	// Remaining Number of credits remaining (null for unlimited). This also clears the refilling schedule.
	Remaining nullable.Nullable[int64] `json:"remaining,omitempty"`
}

UpdateKeyCreditsData Credit configuration and remaining balance for this key.

type UpdateKeyCreditsRefill

type UpdateKeyCreditsRefill struct {
	// Amount Number of credits to add during each refill cycle.
	Amount int64 `json:"amount"`

	// Interval How often credits are automatically refilled.
	Interval UpdateKeyCreditsRefillInterval `json:"interval"`

	// RefillDay Day of the month for monthly refills (1-31).
	// Only required when interval is 'monthly'.
	// For days beyond the month's length, refill occurs on the last day of the month.
	RefillDay *int `json:"refillDay,omitempty"`
}

UpdateKeyCreditsRefill Configuration for automatic credit refill behavior.

type UpdateKeyCreditsRefillInterval

type UpdateKeyCreditsRefillInterval string

UpdateKeyCreditsRefillInterval How often credits are automatically refilled.

const (
	UpdateKeyCreditsRefillIntervalDaily   UpdateKeyCreditsRefillInterval = "daily"
	UpdateKeyCreditsRefillIntervalMonthly UpdateKeyCreditsRefillInterval = "monthly"
)

Defines values for UpdateKeyCreditsRefillInterval.

type V2AnalyticsGetVerificationsRequestBody

type V2AnalyticsGetVerificationsRequestBody struct {
	// Query SQL query to execute against your analytics data.
	// Only SELECT queries are allowed.
	Query string `json:"query"`
}

V2AnalyticsGetVerificationsRequestBody defines model for V2AnalyticsGetVerificationsRequestBody.

type V2AnalyticsGetVerificationsResponseBody

type V2AnalyticsGetVerificationsResponseBody struct {
	// Data Array of verification rows returned by the query. Fields vary based on the SQL SELECT clause.
	Data V2AnalyticsGetVerificationsResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2AnalyticsGetVerificationsResponseBody defines model for V2AnalyticsGetVerificationsResponseBody.

type V2AnalyticsGetVerificationsResponseData

type V2AnalyticsGetVerificationsResponseData = []map[string]interface{}

V2AnalyticsGetVerificationsResponseData Array of verification rows returned by the query. Fields vary based on the SQL SELECT clause.

type V2ApisCreateApiRequestBody

type V2ApisCreateApiRequestBody struct {
	// Name Unique identifier for this API namespace within your workspace.
	// Use descriptive names like 'payment-service-prod' or 'user-api-dev' to clearly identify purpose and environment.
	Name string `json:"name"`
}

V2ApisCreateApiRequestBody defines model for V2ApisCreateApiRequestBody.

type V2ApisCreateApiResponseBody

type V2ApisCreateApiResponseBody struct {
	Data V2ApisCreateApiResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ApisCreateApiResponseBody defines model for V2ApisCreateApiResponseBody.

type V2ApisCreateApiResponseData

type V2ApisCreateApiResponseData struct {
	// ApiId The unique identifier assigned to the newly created API.
	// Use this ID for all subsequent operations including key creation, verification, and API management.
	// Always begins with 'api_' followed by a unique alphanumeric sequence.
	//
	// Store this ID securely as it's required when:
	// - Creating API keys within this namespace
	// - Verifying keys associated with this API
	// - Managing API settings and metadata
	// - Listing keys belonging to this API
	//
	// This identifier is permanent and cannot be changed after creation.
	ApiId string `json:"apiId"`
}

V2ApisCreateApiResponseData defines model for V2ApisCreateApiResponseData.

type V2ApisDeleteApiRequestBody

type V2ApisDeleteApiRequestBody struct {
	// ApiId Specifies which API namespace to permanently delete from your workspace.
	// Must be a valid API ID that begins with 'api_' and exists within your workspace.
	//
	// Before proceeding, ensure you have the correct API ID and understand that this action cannot be undone. If you need to migrate functionality, create replacement keys in a new API namespace and update client applications before deletion.
	ApiId string `json:"apiId"`
}

V2ApisDeleteApiRequestBody defines model for V2ApisDeleteApiRequestBody.

type V2ApisDeleteApiResponseBody

type V2ApisDeleteApiResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ApisDeleteApiResponseBody defines model for V2ApisDeleteApiResponseBody.

type V2ApisGetApiRequestBody

type V2ApisGetApiRequestBody struct {
	// ApiId Specifies which API to retrieve by its unique identifier.
	// Must be a valid API ID that begins with 'api_' and exists within your workspace.
	ApiId string `json:"apiId"`
}

V2ApisGetApiRequestBody defines model for V2ApisGetApiRequestBody.

type V2ApisGetApiResponseBody

type V2ApisGetApiResponseBody struct {
	Data V2ApisGetApiResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ApisGetApiResponseBody defines model for V2ApisGetApiResponseBody.

type V2ApisGetApiResponseData

type V2ApisGetApiResponseData struct {
	// Id The unique identifier of this API within Unkey's system.
	// Used in all operations related to this API including key creation, verification, and management.
	// Always begins with 'api_' followed by alphanumeric characters and underscores.
	// This identifier is permanent and never changes after API creation.
	Id string `json:"id"`

	// Name The internal name of this API as specified during creation.
	// Used for organization and identification within your workspace.
	// Helps distinguish between different environments, services, or access tiers.
	// Not visible to end users - this is purely for administrative purposes.
	Name string `json:"name"`
}

V2ApisGetApiResponseData defines model for V2ApisGetApiResponseData.

type V2ApisListKeysRequestBody

type V2ApisListKeysRequestBody struct {
	// ApiId The API namespace whose keys you want to list.
	// Returns all keys in this API, subject to pagination and filters.
	ApiId string `json:"apiId"`

	// Cursor Pagination cursor from previous response to fetch next page.
	// Use when `hasMore: true` in previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Decrypt When true, attempts to include the plaintext key value in the response. SECURITY WARNING:
	// - This requires special permissions on the calling root key
	// - Only works for keys created with 'recoverable: true'
	// - Exposes sensitive key material in the response
	// - Should only be used in secure administrative contexts
	// - Never enable this in user-facing applications
	Decrypt *bool `json:"decrypt,omitempty"`

	// ExternalId Filter keys by external ID to find keys for a specific user or entity.
	// Must exactly match the externalId set during key creation.
	ExternalId *string `json:"externalId,omitempty"`

	// Limit Maximum number of keys to return per request.
	// Balance between response size and number of pagination calls needed.
	Limit *int `json:"limit,omitempty"`

	// RevalidateKeysCache EXPERIMENTAL: Skip the cache and fetch the keys directly from the database. This ensures you see the most recent state, including keys created moments ago. Use this when:
	// - You've just created a key and need to display it immediately
	// - You need absolute certainty about the current key state
	// - You're debugging cache consistency issues
	//
	// This parameter comes with a performance cost and should be used sparingly.
	RevalidateKeysCache *bool `json:"revalidateKeysCache,omitempty"`
}

V2ApisListKeysRequestBody defines model for V2ApisListKeysRequestBody.

type V2ApisListKeysResponseBody

type V2ApisListKeysResponseBody struct {
	// Data Array of API keys with complete configuration and metadata.
	Data V2ApisListKeysResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2ApisListKeysResponseBody defines model for V2ApisListKeysResponseBody.

type V2ApisListKeysResponseData

type V2ApisListKeysResponseData = []KeyResponseData

V2ApisListKeysResponseData Array of API keys with complete configuration and metadata.

type V2AppsCreateAppRequestBody

type V2AppsCreateAppRequestBody struct {
	// Name Human-readable name for this app.
	// Use a descriptive name like 'Payments API' to identify its purpose.
	Name string `json:"name"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Slug Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Slug ResourceIdentifier `json:"slug"`
}

V2AppsCreateAppRequestBody defines model for V2AppsCreateAppRequestBody.

type V2AppsCreateAppResponseBody

type V2AppsCreateAppResponseBody struct {
	Data V2AppsCreateAppResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2AppsCreateAppResponseBody defines model for V2AppsCreateAppResponseBody.

type V2AppsCreateAppResponseData

type V2AppsCreateAppResponseData struct {
	// AppId The unique identifier of the newly created app, generated by Unkey.
	// Always begins with 'app_' followed by a unique alphanumeric sequence.
	AppId string `json:"appId"`
}

V2AppsCreateAppResponseData defines model for V2AppsCreateAppResponseData.

type V2AppsDeleteAppRequestBody

type V2AppsDeleteAppRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2AppsDeleteAppRequestBody defines model for V2AppsDeleteAppRequestBody.

type V2AppsDeleteAppResponseBody

type V2AppsDeleteAppResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2AppsDeleteAppResponseBody defines model for V2AppsDeleteAppResponseBody.

type V2AppsGetAppRequestBody

type V2AppsGetAppRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2AppsGetAppRequestBody defines model for V2AppsGetAppRequestBody.

type V2AppsGetAppResponseBody

type V2AppsGetAppResponseBody struct {
	Data App `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2AppsGetAppResponseBody defines model for V2AppsGetAppResponseBody.

type V2AppsListAppsRequestBody

type V2AppsListAppsRequestBody struct {
	// Cursor Pagination cursor from a previous response to fetch the next page.
	// Use when `hasMore: true` in the previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of apps to return per request.
	// Balance between response size and number of pagination calls needed.
	Limit *int `json:"limit,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Search Free-form text to filter apps. Returns apps whose ID, name, or slug contains the search string. Matching is case-insensitive.
	Search *string `json:"search,omitempty"`
}

V2AppsListAppsRequestBody defines model for V2AppsListAppsRequestBody.

type V2AppsListAppsResponseBody

type V2AppsListAppsResponseBody struct {
	// Data Array of apps in the project, ordered by app id.
	Data []App `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2AppsListAppsResponseBody defines model for V2AppsListAppsResponseBody.

type V2AppsUpdateAppRequestBody

type V2AppsUpdateAppRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// DefaultBranch New default git branch deployments track for this app.
	// Omit this field to leave the current branch unchanged.
	DefaultBranch *string `json:"defaultBranch,omitempty"`

	// DeleteProtection Enable or disable delete protection for the app.
	// Omit this field to leave the current setting unchanged.
	DeleteProtection *bool `json:"deleteProtection,omitempty"`

	// Name New human-readable name for the app.
	// Omit this field to leave the current name unchanged.
	Name *string `json:"name,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Slug Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Slug *ResourceIdentifier `json:"slug,omitempty"`
}

V2AppsUpdateAppRequestBody defines model for V2AppsUpdateAppRequestBody.

type V2AppsUpdateAppResponseBody

type V2AppsUpdateAppResponseBody struct {
	Data App `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2AppsUpdateAppResponseBody defines model for V2AppsUpdateAppResponseBody.

type V2DeployCreateDeploymentRequestBody

type V2DeployCreateDeploymentRequestBody struct {
	// App App slug within the project
	App string `json:"app"`

	// Branch Git branch name
	Branch string `json:"branch"`

	// DockerImage Docker image reference to deploy
	DockerImage string `json:"dockerImage"`

	// EnvironmentSlug Environment slug (e.g., "production", "staging")
	EnvironmentSlug string `json:"environmentSlug"`

	// GitCommit Optional git commit information
	GitCommit *V2DeployGitCommit `json:"gitCommit,omitempty"`

	// KeyspaceId Optional keyspace ID for authentication context
	KeyspaceId *string `json:"keyspaceId,omitempty"`

	// Project Project slug
	Project string `json:"project"`
}

V2DeployCreateDeploymentRequestBody Create a deployment from a pre-built Docker image

type V2DeployCreateDeploymentResponseBody

type V2DeployCreateDeploymentResponseBody struct {
	Data V2DeployCreateDeploymentResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeployCreateDeploymentResponseBody defines model for V2DeployCreateDeploymentResponseBody.

type V2DeployCreateDeploymentResponseData

type V2DeployCreateDeploymentResponseData struct {
	// DeploymentId Unique deployment identifier
	DeploymentId string `json:"deploymentId"`
}

V2DeployCreateDeploymentResponseData defines model for V2DeployCreateDeploymentResponseData.

type V2DeployDeploymentStep

type V2DeployDeploymentStep struct {
	// CreatedAt Unix timestamp in milliseconds
	CreatedAt *int64 `json:"createdAt,omitempty"`

	// ErrorMessage Error message if step failed
	ErrorMessage *string `json:"errorMessage,omitempty"`

	// Message Step message
	Message *string `json:"message,omitempty"`

	// Status Step status
	Status *string `json:"status,omitempty"`
}

V2DeployDeploymentStep defines model for V2DeployDeploymentStep.

type V2DeployGetDeploymentRequestBody

type V2DeployGetDeploymentRequestBody struct {
	// DeploymentId Unique deployment identifier to retrieve
	DeploymentId string `json:"deploymentId"`
}

V2DeployGetDeploymentRequestBody defines model for V2DeployGetDeploymentRequestBody.

type V2DeployGetDeploymentResponseBody

type V2DeployGetDeploymentResponseBody struct {
	Data V2DeployGetDeploymentResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeployGetDeploymentResponseBody defines model for V2DeployGetDeploymentResponseBody.

type V2DeployGetDeploymentResponseData

type V2DeployGetDeploymentResponseData struct {
	// ErrorMessage Error message if deployment failed
	ErrorMessage *string `json:"errorMessage,omitempty"`

	// Hostnames Hostnames associated with this deployment
	Hostnames *[]string `json:"hostnames,omitempty"`

	// Id Unique deployment identifier
	Id string `json:"id"`

	// Status Current deployment status
	Status V2DeployGetDeploymentResponseDataStatus `json:"status"`

	// Steps Deployment steps with status and messages
	Steps *[]V2DeployDeploymentStep `json:"steps,omitempty"`
}

V2DeployGetDeploymentResponseData defines model for V2DeployGetDeploymentResponseData.

type V2DeployGetDeploymentResponseDataStatus

type V2DeployGetDeploymentResponseDataStatus string

V2DeployGetDeploymentResponseDataStatus Current deployment status

Defines values for V2DeployGetDeploymentResponseDataStatus.

type V2DeployGitCommit

type V2DeployGitCommit struct {
	// AuthorAvatarUrl Git author avatar URL
	AuthorAvatarUrl *string `json:"authorAvatarUrl,omitempty"`

	// AuthorHandle Git author handle/username
	AuthorHandle *string `json:"authorHandle,omitempty"`

	// CommitMessage Git commit message
	CommitMessage *string `json:"commitMessage,omitempty"`

	// CommitSha Git commit SHA
	CommitSha *string `json:"commitSha,omitempty"`

	// Timestamp Commit timestamp in milliseconds
	Timestamp *int64 `json:"timestamp,omitempty"`
}

V2DeployGitCommit Optional git commit information

type V2DeploymentsCreateDeploymentRequestBody

type V2DeploymentsCreateDeploymentRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Deployment Re-run an existing deployment.
	Deployment *DeploymentSourceDeployment `json:"deployment,omitempty"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Git Build from the app's connected GitHub repository.
	Git *DeploymentSourceGit `json:"git,omitempty"`

	// Image Deploy a prebuilt Docker image as-is.
	Image *DeploymentSourceImage `json:"image,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
	// contains filtered or unexported fields
}

V2DeploymentsCreateDeploymentRequestBody Create a deployment. Provide exactly one of git, image, or deployment.

func (V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody0

func (t V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody0() (V2DeploymentsCreateDeploymentRequestBody0, error)

AsV2DeploymentsCreateDeploymentRequestBody0 returns the union data inside the V2DeploymentsCreateDeploymentRequestBody as a V2DeploymentsCreateDeploymentRequestBody0

func (V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody1

func (t V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody1() (V2DeploymentsCreateDeploymentRequestBody1, error)

AsV2DeploymentsCreateDeploymentRequestBody1 returns the union data inside the V2DeploymentsCreateDeploymentRequestBody as a V2DeploymentsCreateDeploymentRequestBody1

func (V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody2

func (t V2DeploymentsCreateDeploymentRequestBody) AsV2DeploymentsCreateDeploymentRequestBody2() (V2DeploymentsCreateDeploymentRequestBody2, error)

AsV2DeploymentsCreateDeploymentRequestBody2 returns the union data inside the V2DeploymentsCreateDeploymentRequestBody as a V2DeploymentsCreateDeploymentRequestBody2

func (*V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody0

func (t *V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody0(v V2DeploymentsCreateDeploymentRequestBody0) error

FromV2DeploymentsCreateDeploymentRequestBody0 overwrites any union data inside the V2DeploymentsCreateDeploymentRequestBody as the provided V2DeploymentsCreateDeploymentRequestBody0

func (*V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody1

func (t *V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody1(v V2DeploymentsCreateDeploymentRequestBody1) error

FromV2DeploymentsCreateDeploymentRequestBody1 overwrites any union data inside the V2DeploymentsCreateDeploymentRequestBody as the provided V2DeploymentsCreateDeploymentRequestBody1

func (*V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody2

func (t *V2DeploymentsCreateDeploymentRequestBody) FromV2DeploymentsCreateDeploymentRequestBody2(v V2DeploymentsCreateDeploymentRequestBody2) error

FromV2DeploymentsCreateDeploymentRequestBody2 overwrites any union data inside the V2DeploymentsCreateDeploymentRequestBody as the provided V2DeploymentsCreateDeploymentRequestBody2

func (V2DeploymentsCreateDeploymentRequestBody) MarshalJSON

func (*V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody0

func (t *V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody0(v V2DeploymentsCreateDeploymentRequestBody0) error

MergeV2DeploymentsCreateDeploymentRequestBody0 performs a merge with any union data inside the V2DeploymentsCreateDeploymentRequestBody, using the provided V2DeploymentsCreateDeploymentRequestBody0

func (*V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody1

func (t *V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody1(v V2DeploymentsCreateDeploymentRequestBody1) error

MergeV2DeploymentsCreateDeploymentRequestBody1 performs a merge with any union data inside the V2DeploymentsCreateDeploymentRequestBody, using the provided V2DeploymentsCreateDeploymentRequestBody1

func (*V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody2

func (t *V2DeploymentsCreateDeploymentRequestBody) MergeV2DeploymentsCreateDeploymentRequestBody2(v V2DeploymentsCreateDeploymentRequestBody2) error

MergeV2DeploymentsCreateDeploymentRequestBody2 performs a merge with any union data inside the V2DeploymentsCreateDeploymentRequestBody, using the provided V2DeploymentsCreateDeploymentRequestBody2

func (*V2DeploymentsCreateDeploymentRequestBody) UnmarshalJSON

func (t *V2DeploymentsCreateDeploymentRequestBody) UnmarshalJSON(b []byte) error

type V2DeploymentsCreateDeploymentRequestBody0

type V2DeploymentsCreateDeploymentRequestBody0 = interface{}

V2DeploymentsCreateDeploymentRequestBody0 defines model for .

type V2DeploymentsCreateDeploymentRequestBody1

type V2DeploymentsCreateDeploymentRequestBody1 = interface{}

V2DeploymentsCreateDeploymentRequestBody1 defines model for .

type V2DeploymentsCreateDeploymentRequestBody2

type V2DeploymentsCreateDeploymentRequestBody2 = interface{}

V2DeploymentsCreateDeploymentRequestBody2 defines model for .

type V2DeploymentsCreateDeploymentResponseBody

type V2DeploymentsCreateDeploymentResponseBody struct {
	Data V2DeploymentsCreateDeploymentResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsCreateDeploymentResponseBody defines model for V2DeploymentsCreateDeploymentResponseBody.

type V2DeploymentsCreateDeploymentResponseData

type V2DeploymentsCreateDeploymentResponseData struct {
	// DeploymentId Unique deployment identifier. Poll deployments.getDeployment with this id to watch status.
	DeploymentId string `json:"deploymentId"`
}

V2DeploymentsCreateDeploymentResponseData defines model for V2DeploymentsCreateDeploymentResponseData.

type V2DeploymentsGetDeploymentRequestBody

type V2DeploymentsGetDeploymentRequestBody struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

V2DeploymentsGetDeploymentRequestBody Retrieve a single deployment, including its status and runtime configuration.

type V2DeploymentsGetDeploymentResponseBody

type V2DeploymentsGetDeploymentResponseBody struct {
	Data Deployment `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsGetDeploymentResponseBody defines model for V2DeploymentsGetDeploymentResponseBody.

type V2DeploymentsListDeploymentsRequestBody

type V2DeploymentsListDeploymentsRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App *ResourceIdentifier `json:"app,omitempty"`

	// Cursor Pagination cursor from a previous response to fetch the next page.
	// Use when `hasMore: true` in the previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment *ResourceIdentifier `json:"environment,omitempty"`

	// Limit Maximum number of deployments to return per request.
	// Balance between response size and number of pagination calls needed.
	Limit *int `json:"limit,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project *ResourceIdentifier `json:"project,omitempty"`

	// Status Restrict results to deployments in any of the given lifecycle statuses.
	// Omit to return deployments in every status.
	Status *[]DeploymentStatus `json:"status,omitempty"`
}

V2DeploymentsListDeploymentsRequestBody Filter deployments within a workspace. All filters are optional; with none set, every deployment in the workspace is returned, newest first.

type V2DeploymentsListDeploymentsResponseBody

type V2DeploymentsListDeploymentsResponseBody struct {
	// Data Array of deployments, ordered newest first.
	Data []Deployment `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2DeploymentsListDeploymentsResponseBody defines model for V2DeploymentsListDeploymentsResponseBody.

type V2DeploymentsPromoteDeploymentRequestBody

type V2DeploymentsPromoteDeploymentRequestBody struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

V2DeploymentsPromoteDeploymentRequestBody Promote a ready deployment to become the current deployment for its environment.

type V2DeploymentsPromoteDeploymentResponseBody

type V2DeploymentsPromoteDeploymentResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsPromoteDeploymentResponseBody defines model for V2DeploymentsPromoteDeploymentResponseBody.

type V2DeploymentsRollbackDeploymentRequestBody

type V2DeploymentsRollbackDeploymentRequestBody struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

V2DeploymentsRollbackDeploymentRequestBody Roll live traffic back to a previous deployment.

type V2DeploymentsRollbackDeploymentResponseBody

type V2DeploymentsRollbackDeploymentResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsRollbackDeploymentResponseBody defines model for V2DeploymentsRollbackDeploymentResponseBody.

type V2DeploymentsStartDeploymentRequestBody

type V2DeploymentsStartDeploymentRequestBody struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

V2DeploymentsStartDeploymentRequestBody Start a stopped preview deployment so it serves traffic again.

type V2DeploymentsStartDeploymentResponseBody

type V2DeploymentsStartDeploymentResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsStartDeploymentResponseBody defines model for V2DeploymentsStartDeploymentResponseBody.

type V2DeploymentsStopDeploymentRequestBody

type V2DeploymentsStopDeploymentRequestBody struct {
	// DeploymentId Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	DeploymentId ResourceIdentifier `json:"deploymentId"`
}

V2DeploymentsStopDeploymentRequestBody Stop a running preview deployment to free up resources.

type V2DeploymentsStopDeploymentResponseBody

type V2DeploymentsStopDeploymentResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2DeploymentsStopDeploymentResponseBody defines model for V2DeploymentsStopDeploymentResponseBody.

type V2EnvironmentsGetEnvironmentRequestBody

type V2EnvironmentsGetEnvironmentRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2EnvironmentsGetEnvironmentRequestBody defines model for V2EnvironmentsGetEnvironmentRequestBody.

type V2EnvironmentsGetEnvironmentResponseBody

type V2EnvironmentsGetEnvironmentResponseBody struct {
	Data Environment `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2EnvironmentsGetEnvironmentResponseBody defines model for V2EnvironmentsGetEnvironmentResponseBody.

type V2EnvironmentsListEnvironmentVariablesRequestBody

type V2EnvironmentsListEnvironmentVariablesRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Cursor Pagination cursor from a previous response to fetch the next page.
	// Use when `hasMore: true` in the previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Limit Maximum number of variables to return per request.
	Limit *int `json:"limit,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2EnvironmentsListEnvironmentVariablesRequestBody defines model for V2EnvironmentsListEnvironmentVariablesRequestBody.

type V2EnvironmentsListEnvironmentVariablesResponseBody

type V2EnvironmentsListEnvironmentVariablesResponseBody struct {
	Data []EnvironmentVariable `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2EnvironmentsListEnvironmentVariablesResponseBody defines model for V2EnvironmentsListEnvironmentVariablesResponseBody.

type V2EnvironmentsListEnvironmentsRequestBody

type V2EnvironmentsListEnvironmentsRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2EnvironmentsListEnvironmentsRequestBody defines model for V2EnvironmentsListEnvironmentsRequestBody.

type V2EnvironmentsListEnvironmentsResponseBody

type V2EnvironmentsListEnvironmentsResponseBody struct {
	// Data Array of environments in the app, ordered by environment id.
	Data []Environment `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2EnvironmentsListEnvironmentsResponseBody defines model for V2EnvironmentsListEnvironmentsResponseBody.

type V2EnvironmentsRemoveEnvironmentVariablesRequestBody

type V2EnvironmentsRemoveEnvironmentVariablesRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Variables The names of the variables to remove. Keys that exist are deleted; keys
	// that are not present are ignored, since their absence already matches the
	// requested state.
	//
	// Duplicate keys collapse to a single removal. The whole operation is atomic:
	// if any part fails the environment is left unchanged. Limited to 50
	// variables per request.
	Variables []string `json:"variables"`
}

V2EnvironmentsRemoveEnvironmentVariablesRequestBody defines model for V2EnvironmentsRemoveEnvironmentVariablesRequestBody.

type V2EnvironmentsRemoveEnvironmentVariablesResponseBody

type V2EnvironmentsRemoveEnvironmentVariablesResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2EnvironmentsRemoveEnvironmentVariablesResponseBody defines model for V2EnvironmentsRemoveEnvironmentVariablesResponseBody.

type V2EnvironmentsSetEnvironmentVariablesRequestBody

type V2EnvironmentsSetEnvironmentVariablesRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Prune Optional. Defaults to false. When false, the variables above are upserted
	// and any existing variable not in the list is kept. When true, this becomes
	// a full replace: after upserting, every variable not in the list is deleted.
	// Combined with an empty `variables` list, `prune: true` resets the entire
	// environment by deleting every variable.
	Prune *bool `json:"prune,omitempty"`

	// Variables The variables to upsert. Each entry is created if its key is new or fully
	// overwritten if the key already exists. Existing variables whose keys are
	// not in this list are left untouched, unless `prune` is true.
	//
	// Each entry is written exactly as sent, never merged with the current
	// state. Only `value` is required; omitted optional fields (`kind`,
	// `description`) fall back to their defaults rather than any previous value,
	// so overwriting a variable without a `description` clears it.
	//
	// Each key may appear at most once; a duplicate key is rejected with a 400.
	// The whole operation is atomic: if any part fails the environment is left
	// unchanged. All values are encrypted at rest. Limited to 50 variables per
	// request.
	Variables []EnvironmentVariableInput `json:"variables"`
}

V2EnvironmentsSetEnvironmentVariablesRequestBody defines model for V2EnvironmentsSetEnvironmentVariablesRequestBody.

type V2EnvironmentsSetEnvironmentVariablesResponseBody

type V2EnvironmentsSetEnvironmentVariablesResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2EnvironmentsSetEnvironmentVariablesResponseBody defines model for V2EnvironmentsSetEnvironmentVariablesResponseBody.

type V2EnvironmentsUpdateSettingsRequestBody

type V2EnvironmentsUpdateSettingsRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// AutoDeploy Whether pushes auto-deploy.
	// Omit to leave unchanged.
	AutoDeploy *bool `json:"autoDeploy,omitempty"`

	// BuildCommand Overrides the build command auto-detected by Railpack.
	// Omit to leave unchanged; set null to clear and fall back to auto-detection.
	BuildCommand nullable.Nullable[string] `json:"buildCommand,omitempty"`

	// Command Override container entrypoint command.
	// Omit to leave unchanged.
	Command *[]string `json:"command,omitempty"`

	// Dockerfile Path to the Dockerfile used for builds.
	// Omit to leave unchanged; set null to clear and fall back to Railpack.
	Dockerfile nullable.Nullable[string] `json:"dockerfile,omitempty"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Healthcheck HTTP healthcheck configuration.
	// Omit to leave unchanged; set null to remove.
	Healthcheck nullable.Nullable[EnvironmentHealthcheck] `json:"healthcheck,omitempty"`

	// MemoryMib Memory allocation in MiB. Minimum 256, in steps of 256.
	// The upper bound is your workspace's per-instance quota; exceeding it returns 400.
	// Omit to leave unchanged.
	MemoryMib *int `json:"memoryMib,omitempty"`

	// OpenapiSpecPath Path to the OpenAPI spec file within the build. Must start with a slash.
	// Omit to leave unchanged; set null to clear.
	OpenapiSpecPath nullable.Nullable[string] `json:"openapiSpecPath,omitempty"`

	// Port Container port the app listens on.
	// Omit to leave unchanged.
	Port *int `json:"port,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Regions Desired set of regions with per-region replica bounds.
	// Omit to leave regions unchanged; when present, this replaces the full set
	// (regions absent from the list are removed). At least one region is required;
	// an empty list is rejected because an environment cannot have zero regions.
	Regions *[]EnvironmentRegion `json:"regions,omitempty"`

	// RootDirectory The directory your app lives in. Unkey builds from here.
	// Use "." for the repository root, or set a subdirectory when your app
	// is nested (e.g., services/api). Omit to leave unchanged.
	RootDirectory *string `json:"rootDirectory,omitempty"`

	// ShutdownSignal Signal sent to the container on shutdown.
	ShutdownSignal *EnvironmentShutdownSignal `json:"shutdownSignal,omitempty"`

	// StorageMib Ephemeral storage allocation in MiB, in steps of 512 (0 for none).
	// The upper bound is your workspace's per-instance quota; exceeding it returns 400.
	// Omit to leave unchanged.
	StorageMib *int `json:"storageMib,omitempty"`

	// UpstreamProtocol Protocol used to reach the container.
	UpstreamProtocol *EnvironmentUpstreamProtocol `json:"upstreamProtocol,omitempty"`

	// VCpus CPU allocation in vCPUs. Minimum 0.25 (1/4 vCPU), in steps of 0.25.
	// The upper bound is your workspace's per-instance quota; exceeding it returns 400.
	// Omit to leave unchanged.
	VCpus *float64 `json:"vCpus,omitempty"`

	// WatchPaths Glob paths that trigger auto-deploys when changed.
	// Omit to leave unchanged.
	WatchPaths *[]string `json:"watchPaths,omitempty"`
}

V2EnvironmentsUpdateSettingsRequestBody defines model for V2EnvironmentsUpdateSettingsRequestBody.

type V2EnvironmentsUpdateSettingsResponseBody

type V2EnvironmentsUpdateSettingsResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2EnvironmentsUpdateSettingsResponseBody defines model for V2EnvironmentsUpdateSettingsResponseBody.

type V2GatewayListPoliciesRequestBody

type V2GatewayListPoliciesRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2GatewayListPoliciesRequestBody defines model for V2GatewayListPoliciesRequestBody.

type V2GatewayListPoliciesResponseBody

type V2GatewayListPoliciesResponseBody struct {
	// Data The environment's gateway policies in evaluation order.
	Data V2GatewayListPoliciesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2GatewayListPoliciesResponseBody defines model for V2GatewayListPoliciesResponseBody.

type V2GatewayListPoliciesResponseData

type V2GatewayListPoliciesResponseData = []PolicyResponse

V2GatewayListPoliciesResponseData The environment's gateway policies in evaluation order.

type V2GatewaySetPoliciesRequestBody

type V2GatewaySetPoliciesRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Policies The environment's complete policy list, in evaluation order. Every call
	// replaces all stored policies with exactly this list; an empty list
	// removes every policy. The operation is atomic: if any policy is
	// invalid, nothing is written. An environment can hold at most 50
	// policies.
	Policies []Policy `json:"policies"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2GatewaySetPoliciesRequestBody defines model for V2GatewaySetPoliciesRequestBody.

type V2GatewaySetPoliciesResponseBody

type V2GatewaySetPoliciesResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2GatewaySetPoliciesResponseBody defines model for V2GatewaySetPoliciesResponseBody.

type V2GatewayUpdatePolicyRequestBody

type V2GatewayUpdatePolicyRequestBody struct {
	// App Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	App ResourceIdentifier `json:"app"`

	// Enabled Enable or disable the policy. Disabled policies are stored but skipped
	// during evaluation. Omit to keep the current setting.
	Enabled *bool `json:"enabled,omitempty"`

	// Environment Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Environment ResourceIdentifier `json:"environment"`

	// Firewall Blocks matching requests.
	Firewall *FirewallPolicy `json:"firewall,omitempty"`

	// Keyauth Verifies Unkey API keys on matching requests.
	Keyauth *KeyauthPolicy `json:"keyauth,omitempty"`

	// Match Replaces all match expressions. Set null to remove them so the policy
	// applies to every request. Omit to keep the current expressions.
	Match nullable.Nullable[[]MatchExpr] `json:"match,omitempty"`

	// Name New human-readable name. Omit to keep the current name.
	Name *string `json:"name,omitempty"`

	// Openapi Validates matching requests against the app's uploaded OpenAPI spec. Has no
	// configuration of its own. If no spec has been uploaded for the deployment,
	// the policy is a no-op and requests pass through unvalidated.
	Openapi *OpenapiPolicy `json:"openapi,omitempty"`

	// PolicyId Id of the policy to update, as returned by `gateway.listPolicies`.
	// Ids are regenerated whenever `gateway.setPolicies` replaces the list,
	// so list the policies first if you are unsure the id is current.
	PolicyId string `json:"policyId"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Ratelimit Rate limits matching requests.
	Ratelimit *RatelimitPolicy `json:"ratelimit,omitempty"`
}

V2GatewayUpdatePolicyRequestBody Partial update of a single policy. Omitted fields keep their stored values; at least one updatable field must be provided. Providing one of `keyauth`, `ratelimit`, `firewall` or `openapi` replaces the policy's rule entirely, including switching its type; at most one may be set.

type V2GatewayUpdatePolicyResponseBody

type V2GatewayUpdatePolicyResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2GatewayUpdatePolicyResponseBody defines model for V2GatewayUpdatePolicyResponseBody.

type V2IdentitiesCreateIdentityRequestBody

type V2IdentitiesCreateIdentityRequestBody struct {
	// ExternalId Creates an identity using your system's unique identifier for a user, organization, or entity.
	// Must be stable and unique across your workspace - duplicate externalIds return CONFLICT errors.
	// This identifier links Unkey identities to your authentication system, database records, or tenant structure.
	//
	// Avoid changing externalIds after creation as this breaks the link between your systems.
	// Use consistent identifier patterns across your application for easier management and debugging.
	// Accepts letters, numbers, underscores, dots, and hyphens for flexible identifier formats.
	// Essential for implementing proper multi-tenant isolation and user-specific rate limiting.
	ExternalId string `json:"externalId"`

	// Meta Stores arbitrary JSON metadata returned during key verification for contextual information.
	// Eliminates additional database lookups during verification, improving performance for stateless services.
	// Avoid storing sensitive data here as it's returned in verification responses.
	//
	// Large metadata objects increase verification latency and should stay under 10KB total size.
	// Use this for subscription details, feature flags, user preferences, and organization information.
	// Metadata is returned as-is whenever keys associated with this identity are verified.
	Meta *map[string]interface{} `json:"meta,omitempty"`

	// Ratelimits Defines shared rate limits that apply to all keys belonging to this identity.
	// Prevents abuse by users with multiple keys by enforcing consistent limits across their entire key portfolio.
	// Essential for implementing fair usage policies and tiered access levels in multi-tenant applications.
	//
	// Rate limit counters are shared across all keys with this identity, regardless of how many keys the user creates.
	// During verification, specify which named limits to check for enforcement.
	// Identity rate limits supplement any key-specific rate limits that may also be configured.
	// - Each named limit can have different thresholds and windows
	//
	// When verifying keys, you can specify which limits you want to use and all keys attached to this identity will share the limits, regardless of which specific key is used.
	Ratelimits *[]RatelimitRequest `json:"ratelimits,omitempty"`
}

V2IdentitiesCreateIdentityRequestBody defines model for V2IdentitiesCreateIdentityRequestBody.

type V2IdentitiesCreateIdentityResponseBody

type V2IdentitiesCreateIdentityResponseBody struct {
	Data V2IdentitiesCreateIdentityResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2IdentitiesCreateIdentityResponseBody defines model for V2IdentitiesCreateIdentityResponseBody.

type V2IdentitiesCreateIdentityResponseData

type V2IdentitiesCreateIdentityResponseData struct {
	// IdentityId The unique identifier of the created identity.
	IdentityId string `json:"identityId"`
}

V2IdentitiesCreateIdentityResponseData defines model for V2IdentitiesCreateIdentityResponseData.

type V2IdentitiesDeleteIdentityRequestBody

type V2IdentitiesDeleteIdentityRequestBody struct {
	// Identity The ID of the identity to delete. This can be either the externalId (from your own system that was used during identity creation) or the identityId (the internal ID returned by the identity service).
	Identity string `json:"identity"`
}

V2IdentitiesDeleteIdentityRequestBody defines model for V2IdentitiesDeleteIdentityRequestBody.

type V2IdentitiesDeleteIdentityResponseBody

type V2IdentitiesDeleteIdentityResponseBody struct {
	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2IdentitiesDeleteIdentityResponseBody Empty response object. A successful response indicates the identity was deleted successfully.

type V2IdentitiesGetIdentityRequestBody

type V2IdentitiesGetIdentityRequestBody struct {
	// Identity The ID of the identity to retrieve. This can be either the externalId (from your own system that was used during identity creation) or the identityId (the internal ID returned by the identity service).
	Identity string `json:"identity"`
}

V2IdentitiesGetIdentityRequestBody defines model for V2IdentitiesGetIdentityRequestBody.

type V2IdentitiesGetIdentityResponseBody

type V2IdentitiesGetIdentityResponseBody struct {
	Data Identity `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2IdentitiesGetIdentityResponseBody defines model for V2IdentitiesGetIdentityResponseBody.

type V2IdentitiesListIdentitiesRequestBody

type V2IdentitiesListIdentitiesRequestBody struct {
	// Cursor Pagination cursor from a previous response. Use this to fetch subsequent pages of results when the response contains a cursor value.
	Cursor *string `json:"cursor,omitempty"`

	// Limit The maximum number of identities to return in a single request. Use this to control response size and loading performance.
	Limit *int `json:"limit,omitempty"`

	// Search Free-form text to filter identities. Returns identities whose ID or external ID contains the search string. Matching is case-insensitive.
	Search *string `json:"search,omitempty"`
}

V2IdentitiesListIdentitiesRequestBody defines model for V2IdentitiesListIdentitiesRequestBody.

type V2IdentitiesListIdentitiesResponseBody

type V2IdentitiesListIdentitiesResponseBody struct {
	// Data List of identities matching the specified criteria.
	Data V2IdentitiesListIdentitiesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2IdentitiesListIdentitiesResponseBody defines model for V2IdentitiesListIdentitiesResponseBody.

type V2IdentitiesListIdentitiesResponseData

type V2IdentitiesListIdentitiesResponseData = []Identity

V2IdentitiesListIdentitiesResponseData List of identities matching the specified criteria.

type V2IdentitiesUpdateIdentityRequestBody

type V2IdentitiesUpdateIdentityRequestBody struct {
	// Identity The ID of the identity to update. Accepts either the externalId (your system-generated identifier) or the identityId (internal identifier returned by the identity service).
	Identity string `json:"identity"`

	// Meta Replaces all existing metadata with this new metadata object.
	// Omitting this field preserves existing metadata, while providing an empty object clears all metadata.
	// Avoid storing sensitive data here as it's returned in verification responses.
	// Large metadata objects increase verification latency and should stay under 10KB total size.
	Meta *map[string]interface{} `json:"meta,omitempty"`

	// Ratelimits Replaces all existing identity rate limits with this complete list of rate limits.
	// Omitting this field preserves existing rate limits, while providing an empty array removes all rate limits.
	// These limits are shared across all keys belonging to this identity, preventing abuse through multiple keys.
	// Rate limit changes take effect immediately but may take up to 30 seconds to propagate across all regions.
	Ratelimits *[]RatelimitRequest `json:"ratelimits,omitempty"`
}

V2IdentitiesUpdateIdentityRequestBody defines model for V2IdentitiesUpdateIdentityRequestBody.

type V2IdentitiesUpdateIdentityResponseBody

type V2IdentitiesUpdateIdentityResponseBody struct {
	Data Identity `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2IdentitiesUpdateIdentityResponseBody defines model for V2IdentitiesUpdateIdentityResponseBody.

type V2KeysAddPermissionsRequestBody

type V2KeysAddPermissionsRequestBody struct {
	// KeyId Specifies which key receives the additional permissions using the database identifier returned from `keys.createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	KeyId string `json:"keyId"`

	// Permissions Grants additional permissions to the key through direct assignment or automatic creation.
	// Duplicate permissions are ignored automatically, making this operation idempotent.
	//
	// Adding permissions never removes existing permissions or role-based permissions.
	//
	// Any permissions that do not exist will be auto created if the root key has permissions, otherwise this operation will fail with a 403 error.
	Permissions []string `json:"permissions"`
}

V2KeysAddPermissionsRequestBody defines model for V2KeysAddPermissionsRequestBody.

type V2KeysAddPermissionsResponseBody

type V2KeysAddPermissionsResponseBody struct {
	// Data Complete list of all permissions directly assigned to the key (including both newly added permissions and those that were already assigned).
	//
	// This response includes:
	// - All direct permissions assigned to the key (both pre-existing and newly added)
	// - Both the permission ID and name for each permission
	//
	// Important notes:
	// - This list does NOT include permissions granted through roles
	// - For a complete permission picture, use `/v2/keys.getKey` instead
	// - An empty array indicates the key has no direct permissions assigned
	Data V2KeysAddPermissionsResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysAddPermissionsResponseBody defines model for V2KeysAddPermissionsResponseBody.

type V2KeysAddPermissionsResponseData

type V2KeysAddPermissionsResponseData = []Permission

V2KeysAddPermissionsResponseData Complete list of all permissions directly assigned to the key (including both newly added permissions and those that were already assigned).

This response includes: - All direct permissions assigned to the key (both pre-existing and newly added) - Both the permission ID and name for each permission

Important notes: - This list does NOT include permissions granted through roles - For a complete permission picture, use `/v2/keys.getKey` instead - An empty array indicates the key has no direct permissions assigned

type V2KeysAddRolesRequestBody

type V2KeysAddRolesRequestBody struct {
	// KeyId Specifies which key receives the additional roles using the database identifier returned from `createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	// Added roles supplement existing roles and permissions without replacing them.
	// Role assignments take effect immediately but may take up to 30 seconds to propagate across all regions.
	KeyId string `json:"keyId"`

	// Roles Assigns additional roles to the key through direct assignment to existing workspace roles.
	// Operations are idempotent - adding existing roles has no effect and causes no errors.
	//
	// All roles must already exist in the workspace - roles cannot be created automatically.
	// Invalid roles cause the entire operation to fail atomically, ensuring consistent state.
	Roles []string `json:"roles"`
}

V2KeysAddRolesRequestBody defines model for V2KeysAddRolesRequestBody.

type V2KeysAddRolesResponseBody

type V2KeysAddRolesResponseBody struct {
	// Data Complete list of all roles directly assigned to the key after the operation completes.
	//
	// The response includes:
	// - All roles now assigned to the key (both pre-existing and newly added)
	// - Both ID and name of each role for easy reference
	//
	// Important notes:
	// - The response shows the complete current state after the addition
	// - An empty array means the key has no roles assigned (unlikely after an add operation)
	// - This only shows direct role assignments, not inherited or nested roles
	// - Role permissions are not expanded in this response - use keys.getKey for full details
	Data V2KeysAddRolesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysAddRolesResponseBody defines model for V2KeysAddRolesResponseBody.

type V2KeysAddRolesResponseData

type V2KeysAddRolesResponseData = []Role

V2KeysAddRolesResponseData Complete list of all roles directly assigned to the key after the operation completes.

The response includes: - All roles now assigned to the key (both pre-existing and newly added) - Both ID and name of each role for easy reference

Important notes: - The response shows the complete current state after the addition - An empty array means the key has no roles assigned (unlikely after an add operation) - This only shows direct role assignments, not inherited or nested roles - Role permissions are not expanded in this response - use keys.getKey for full details

type V2KeysCreateKeyRequestBody

type V2KeysCreateKeyRequestBody struct {
	// ApiId The API namespace this key belongs to.
	// Keys from different APIs cannot access each other.
	ApiId string `json:"apiId"`

	// ByteLength Controls the cryptographic strength of the generated key in bytes.
	// Higher values increase security but result in longer keys that may be more annoying to handle.
	// The default 16 bytes provides 2^128 possible combinations, sufficient for most applications.
	// Consider 32 bytes for highly sensitive APIs, but avoid values above 64 bytes unless specifically required.
	ByteLength *int `json:"byteLength,omitempty"`

	// Credits Credit configuration and remaining balance for this key.
	Credits *KeyCreditsData `json:"credits,omitempty"`

	// Enabled Controls whether the key is active immediately upon creation.
	// When set to `false`, the key exists but all verification attempts fail with `code=DISABLED`.
	// Useful for pre-creating keys that will be activated later or for keys requiring manual approval.
	// Most keys should be created with `enabled=true` for immediate use.
	Enabled *bool `json:"enabled,omitempty"`

	// Expires Sets when this key automatically expires as a Unix timestamp in milliseconds.
	// Verification fails with code=EXPIRED immediately after this time passes.
	// Omitting this field creates a permanent key that never expires.
	//
	// Avoid setting timestamps in the past as they immediately invalidate the key.
	// Keys expire based on server time, not client time, which prevents timezone-related issues.
	// Essential for trial periods, temporary access, and security compliance requiring key rotation.
	Expires *int64 `json:"expires,omitempty"`

	// ExternalId Links this key to a user or entity in your system using your own identifier.
	// Returned during verification to identify the key owner without additional database lookups.
	// Essential for user-specific analytics, billing, and multi-tenant key management.
	// Use your primary user ID, organization ID, or tenant ID for best results.
	// Accepts letters, numbers, underscores, dots, and hyphens for flexible identifier formats.
	ExternalId *string `json:"externalId,omitempty"`

	// Meta Stores arbitrary JSON metadata returned during key verification for contextual information.
	// Eliminates additional database lookups during verification, improving performance for stateless services.
	// Avoid storing sensitive data here as it's returned in verification responses.
	// Large metadata objects increase verification latency and should stay under 10KB total size.
	Meta *map[string]interface{} `json:"meta,omitempty"`

	// Name Sets a human-readable identifier for internal organization and dashboard display.
	// Never exposed to end users, only visible in management interfaces and API responses.
	// Avoid generic names like "API Key" when managing multiple keys for the same user or service.
	Name *string `json:"name,omitempty"`

	// Permissions Grants specific permissions directly to this key without requiring role membership.
	// Wildcard permissions like `documents.*` grant access to all sub-permissions including `documents.read` and `documents.write`.
	// Direct permissions supplement any permissions inherited from assigned roles.
	Permissions *[]string `json:"permissions,omitempty"`

	// Prefix Adds a visual identifier to the beginning of the generated key for easier recognition in logs and dashboards.
	// The prefix becomes part of the actual key string (e.g., `prod_xxxxxxxxx`).
	// Avoid using sensitive information in prefixes as they may appear in logs and error messages.
	Prefix *string `json:"prefix,omitempty"`

	// Ratelimits Defines time-based rate limits that protect against abuse by controlling request frequency.
	// Unlike credits which track total usage, rate limits reset automatically after each window expires.
	// Multiple rate limits can control different operation types with separate thresholds and windows.
	// Essential for preventing API abuse while maintaining good performance for legitimate usage.
	Ratelimits *[]RatelimitRequest `json:"ratelimits,omitempty"`

	// Recoverable Controls whether the plaintext key is stored in an encrypted vault for later retrieval.
	// When true, allows recovering the actual key value using keys.getKey with decrypt=true.
	// When false, the key value cannot be retrieved after creation for maximum security.
	// Only enable for development keys or when key recovery is absolutely necessary.
	Recoverable *bool `json:"recoverable,omitempty"`

	// Roles Assigns existing roles to this key for permission management through role-based access control.
	// Roles must already exist in your workspace before assignment.
	// During verification, all permissions from assigned roles are checked against requested permissions.
	// Roles provide a convenient way to group permissions and apply consistent access patterns across multiple keys.
	Roles *[]string `json:"roles,omitempty"`
}

V2KeysCreateKeyRequestBody defines model for V2KeysCreateKeyRequestBody.

type V2KeysCreateKeyResponseBody

type V2KeysCreateKeyResponseBody struct {
	Data V2KeysCreateKeyResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysCreateKeyResponseBody defines model for V2KeysCreateKeyResponseBody.

type V2KeysCreateKeyResponseData

type V2KeysCreateKeyResponseData struct {
	// Key The full generated API key that should be securely provided to your user.
	// SECURITY WARNING: This is the only time you'll receive the complete key - Unkey only stores a securely hashed version. Never log or store this value in your own systems; provide it directly to your end user via secure channels. After this API call completes, this value cannot be retrieved again (unless created with `recoverable=true`).
	Key string `json:"key"`

	// KeyId The unique identifier for this key in Unkey's system. This is NOT the actual API key, but a reference ID used for management operations like updating or deleting the key. Store this ID in your database to reference the key later. This ID is not sensitive and can be logged or displayed in dashboards.
	KeyId string `json:"keyId"`
}

V2KeysCreateKeyResponseData defines model for V2KeysCreateKeyResponseData.

type V2KeysDeleteKeyRequestBody

type V2KeysDeleteKeyRequestBody struct {
	// KeyId Specifies which key to delete using the database identifier returned from `createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	// Deletion immediately invalidates the key, causing all future verification attempts to fail with `code=NOT_FOUND`.
	// Key deletion triggers cache invalidation across all regions but may take up to 30 seconds to fully propagate.
	KeyId string `json:"keyId"`

	// Permanent Controls deletion behavior between recoverable soft-deletion and irreversible permanent erasure.
	// Soft deletion (default) preserves key data for potential recovery through direct database operations.
	// Permanent deletion completely removes all traces including hash values and metadata with no recovery option.
	//
	// Use permanent deletion only for regulatory compliance (GDPR), resolving hash collisions, or when reusing identical key strings.
	// Permanent deletion cannot be undone and may affect analytics data that references the deleted key.
	// Most applications should use soft deletion to maintain audit trails and prevent accidental data loss.
	Permanent *bool `json:"permanent,omitempty"`
}

V2KeysDeleteKeyRequestBody defines model for V2KeysDeleteKeyRequestBody.

type V2KeysDeleteKeyResponseBody

type V2KeysDeleteKeyResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysDeleteKeyResponseBody defines model for V2KeysDeleteKeyResponseBody.

type V2KeysGetKeyRequestBody

type V2KeysGetKeyRequestBody struct {
	// Decrypt Controls whether to include the plaintext key value in the response for recovery purposes.
	// Only works for keys created with `recoverable=true` and requires the `decrypt_key` permission.
	// Returned keys must be handled securely, never logged, cached, or stored insecurely.
	//
	// Use only for legitimate recovery scenarios like user password resets or emergency access.
	// Most applications should keep this false to maintain security best practices and avoid accidental key exposure.
	// Decryption requests are audited and may trigger security alerts in enterprise environments.
	Decrypt *bool `json:"decrypt,omitempty"`

	// KeyId Specifies which key to retrieve using the database identifier returned from `keys.createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	// Key data includes metadata, permissions, usage statistics, and configuration but never the plaintext key value unless `decrypt=true`.
	// Find this ID in creation responses, key listings, dashboard, or verification responses.
	KeyId string `json:"keyId"`
}

V2KeysGetKeyRequestBody defines model for V2KeysGetKeyRequestBody.

type V2KeysGetKeyResponseBody

type V2KeysGetKeyResponseBody struct {
	Data KeyResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysGetKeyResponseBody defines model for V2KeysGetKeyResponseBody.

type V2KeysMigrateKeyData

type V2KeysMigrateKeyData struct {
	// Credits Credit configuration and remaining balance for this key.
	Credits *KeyCreditsData `json:"credits,omitempty"`

	// Enabled Controls whether the key is active immediately upon creation.
	// When set to `false`, the key exists but all verification attempts fail with `code=DISABLED`.
	// Useful for pre-creating keys that will be activated later or for keys requiring manual approval.
	// Most keys should be created with `enabled=true` for immediate use.
	Enabled *bool `json:"enabled,omitempty"`

	// Expires Sets when this key automatically expires as a Unix timestamp in milliseconds.
	// Verification fails with code=EXPIRED immediately after this time passes.
	// Omitting this field creates a permanent key that never expires.
	//
	// Avoid setting timestamps in the past as they immediately invalidate the key.
	// Keys expire based on server time, not client time, which prevents timezone-related issues.
	// Essential for trial periods, temporary access, and security compliance requiring key rotation.
	Expires *int64 `json:"expires,omitempty"`

	// ExternalId Links this key to a user or entity in your system using your own identifier.
	// Returned during verification to identify the key owner without additional database lookups.
	// Essential for user-specific analytics, billing, and multi-tenant key management.
	// Use your primary user ID, organization ID, or tenant ID for best results.
	// Accepts letters, numbers, underscores, dots, and hyphens for flexible identifier formats.
	ExternalId *string `json:"externalId,omitempty"`

	// Hash The current hash of the key on your side
	Hash string `json:"hash"`

	// Meta Stores arbitrary JSON metadata returned during key verification for contextual information.
	// Eliminates additional database lookups during verification, improving performance for stateless services.
	// Avoid storing sensitive data here as it's returned in verification responses.
	// Large metadata objects increase verification latency and should stay under 10KB total size.
	Meta *map[string]interface{} `json:"meta,omitempty"`

	// Name Sets a human-readable identifier for internal organization and dashboard display.
	// Never exposed to end users, only visible in management interfaces and API responses.
	// Avoid generic names like "API Key" when managing multiple keys for the same user or service.
	Name *string `json:"name,omitempty"`

	// Permissions Grants specific permissions directly to this key without requiring role membership.
	// Wildcard permissions like `documents.*` grant access to all sub-permissions including `documents.read` and `documents.write`.
	// Direct permissions supplement any permissions inherited from assigned roles.
	Permissions *[]string `json:"permissions,omitempty"`

	// Ratelimits Defines time-based rate limits that protect against abuse by controlling request frequency.
	// Unlike credits which track total usage, rate limits reset automatically after each window expires.
	// Multiple rate limits can control different operation types with separate thresholds and windows.
	// Essential for preventing API abuse while maintaining good performance for legitimate usage.
	Ratelimits *[]RatelimitRequest `json:"ratelimits,omitempty"`

	// Roles Assigns existing roles to this key for permission management through role-based access control.
	// Roles must already exist in your workspace before assignment.
	// During verification, all permissions from assigned roles are checked against requested permissions.
	// Roles provide a convenient way to group permissions and apply consistent access patterns across multiple keys.
	Roles *[]string `json:"roles,omitempty"`
}

V2KeysMigrateKeyData defines model for V2KeysMigrateKeyData.

type V2KeysMigrateKeysMigration

type V2KeysMigrateKeysMigration struct {
	// Hash The hash provided in the migration request
	Hash string `json:"hash"`

	// KeyId The unique identifier for this key in Unkey's system. This is NOT the actual API key, but a reference ID used for management operations like updating or deleting the key. Store this ID in your database to reference the key later. This ID is not sensitive and can be logged or displayed in dashboards.
	KeyId string `json:"keyId"`
}

V2KeysMigrateKeysMigration defines model for V2KeysMigrateKeysMigration.

type V2KeysMigrateKeysRequestBody

type V2KeysMigrateKeysRequestBody struct {
	// ApiId The ID of the API that the keys should be inserted into
	ApiId string                 `json:"apiId"`
	Keys  []V2KeysMigrateKeyData `json:"keys"`

	// MigrationId Identifier of the configured migration provider/strategy to use (e.g., "your_company"). You will receive this from Unkey's support staff.
	MigrationId string `json:"migrationId"`
}

V2KeysMigrateKeysRequestBody defines model for V2KeysMigrateKeysRequestBody.

type V2KeysMigrateKeysResponseBody

type V2KeysMigrateKeysResponseBody struct {
	Data V2KeysMigrateKeysResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysMigrateKeysResponseBody defines model for V2KeysMigrateKeysResponseBody.

type V2KeysMigrateKeysResponseData

type V2KeysMigrateKeysResponseData struct {
	// Failed Hashes that could not be migrated (e.g., already exist in the system)
	Failed []string `json:"failed"`

	// Migrated Successfully migrated keys with their hash and generated keyId
	Migrated []V2KeysMigrateKeysMigration `json:"migrated"`
}

V2KeysMigrateKeysResponseData defines model for V2KeysMigrateKeysResponseData.

type V2KeysRemovePermissionsRequestBody

type V2KeysRemovePermissionsRequestBody struct {
	// KeyId Specifies which key to remove permissions from using the database identifier returned from `keys.createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	KeyId string `json:"keyId"`

	// Permissions Removes direct permissions from the key without affecting role-based permissions.
	//
	// You can either use a permission slug, or the permission ID.
	//
	// After removal, verification checks for these permissions will fail unless granted through roles.
	Permissions []string `json:"permissions"`
}

V2KeysRemovePermissionsRequestBody defines model for V2KeysRemovePermissionsRequestBody.

type V2KeysRemovePermissionsResponseBody

type V2KeysRemovePermissionsResponseBody struct {
	// Data Complete list of all permissions directly assigned to the key after the removal operation (remaining permissions only).
	//
	// Notes:
	// - This list does NOT include permissions granted through roles
	// - For a complete permission picture, use `/v2/keys.getKey` instead
	// - An empty array indicates the key has no direct permissions assigned
	// - Any cached versions of the key are immediately invalidated to ensure consistency
	// - Changes to permissions take effect within seconds for new verifications
	Data V2KeysRemovePermissionsResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysRemovePermissionsResponseBody defines model for V2KeysRemovePermissionsResponseBody.

type V2KeysRemovePermissionsResponseData

type V2KeysRemovePermissionsResponseData = []Permission

V2KeysRemovePermissionsResponseData Complete list of all permissions directly assigned to the key after the removal operation (remaining permissions only).

Notes: - This list does NOT include permissions granted through roles - For a complete permission picture, use `/v2/keys.getKey` instead - An empty array indicates the key has no direct permissions assigned - Any cached versions of the key are immediately invalidated to ensure consistency - Changes to permissions take effect within seconds for new verifications

type V2KeysRemoveRolesRequestBody

type V2KeysRemoveRolesRequestBody struct {
	// KeyId Specifies which key loses the roles using the database identifier returned from createKey.
	// Do not confuse this with the actual API key string that users include in requests.
	// Removing roles only affects direct assignments, not permissions inherited from other sources.
	// Role changes take effect immediately but may take up to 30 seconds to propagate across all regions.
	KeyId string `json:"keyId"`

	// Roles Removes direct role assignments from the key without affecting other role sources or permissions.
	// Operations are idempotent - removing non-assigned roles has no effect and causes no errors.
	//
	// After removal, the key loses access to permissions that were only granted through these roles.
	// Invalid role references cause the entire operation to fail atomically, ensuring consistent state.
	Roles []string `json:"roles"`
}

V2KeysRemoveRolesRequestBody defines model for V2KeysRemoveRolesRequestBody.

type V2KeysRemoveRolesResponseBody

type V2KeysRemoveRolesResponseBody struct {
	// Data Complete list of all roles directly assigned to the key after the removal operation completes.
	//
	// The response includes:
	// - The remaining roles still assigned to the key (after removing the specified roles)
	// - Both ID and name for each role for easy reference
	//
	// Important notes:
	// - The response reflects the current state after the removal operation
	// - An empty array indicates the key now has no roles assigned
	// - This only shows direct role assignments
	// - Role permissions are not expanded in this response - use keys.getKey for full details
	// - Changes take effect immediately for new verifications but cached sessions may retain old permissions briefly
	Data V2KeysRemoveRolesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysRemoveRolesResponseBody defines model for V2KeysRemoveRolesResponseBody.

type V2KeysRemoveRolesResponseData

type V2KeysRemoveRolesResponseData = []Role

V2KeysRemoveRolesResponseData Complete list of all roles directly assigned to the key after the removal operation completes.

The response includes: - The remaining roles still assigned to the key (after removing the specified roles) - Both ID and name for each role for easy reference

Important notes: - The response reflects the current state after the removal operation - An empty array indicates the key now has no roles assigned - This only shows direct role assignments - Role permissions are not expanded in this response - use keys.getKey for full details - Changes take effect immediately for new verifications but cached sessions may retain old permissions briefly

type V2KeysRerollKeyRequestBody

type V2KeysRerollKeyRequestBody struct {
	// Expiration Duration in milliseconds until the ORIGINAL key is revoked, starting from now.
	//
	// This parameter controls the overlap period for key rotation:
	// - Set to `0` to revoke the original key immediately
	// - Positive values keep the original key active for the specified duration
	// - Allows graceful migration by giving users time to update their credentials
	//
	// Common overlap periods:
	// - Immediate revocation: 0
	// - 1 hour grace period: 3600000
	// - 24 hours grace period: 86400000
	// - 7 days grace period: 604800000
	// - 30 days grace period: 2592000000
	Expiration int64 `json:"expiration"`

	// KeyId The database identifier of the key to reroll.
	//
	// This is the unique ID returned when creating or listing keys, NOT the actual API key token.
	// You can find this ID in:
	// - The response from `keys.createKey`
	// - Key verification responses
	// - The Unkey dashboard
	// - API key listing endpoints
	KeyId string `json:"keyId"`
}

V2KeysRerollKeyRequestBody defines model for V2KeysRerollKeyRequestBody.

type V2KeysRerollKeyResponseBody

type V2KeysRerollKeyResponseBody struct {
	Data V2KeysRerollKeyResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysRerollKeyResponseBody defines model for V2KeysRerollKeyResponseBody.

type V2KeysRerollKeyResponseData

type V2KeysRerollKeyResponseData struct {
	// Key The newly generated API key token (the actual secret that authenticates requests).
	//
	// **SECURITY CRITICAL:**
	// - This is the only time you'll receive the complete key
	// - Unkey stores only a hashed version (unless the original key was created with `recoverable=true`)
	// - Never log, store, or expose this value in your systems
	// - Transmit directly to the end user via secure channels only
	// - If lost and not recoverable, you must reroll or create a new key
	//
	// The key format follows: `[prefix]_[random_bytes]`
	// - Prefix is extracted from the original key or uses API default
	// - Random bytes follow API configuration (default: 16 bytes)
	//
	// This is NOT the keyId - it's the actual secret token used for authentication.
	Key string `json:"key"`

	// KeyId The unique identifier for the newly created key.
	//
	// This is NOT the actual API key token, but a reference ID for management operations.
	// Store this ID to:
	// - Update or revoke the key later
	// - Track the key in your database
	// - Display in admin dashboards (safe to log)
	//
	// Note: This is a new ID - the original key retains its own ID.
	KeyId string `json:"keyId"`
}

V2KeysRerollKeyResponseData defines model for V2KeysRerollKeyResponseData.

type V2KeysSetPermissionsRequestBody

type V2KeysSetPermissionsRequestBody struct {
	// KeyId Specifies which key receives the additional permissions using the database identifier returned from `keys.createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	KeyId string `json:"keyId"`

	// Permissions The permissions to set for this key.
	//
	// This is a complete replacement operation - it overwrites all existing direct permissions with this new set.
	//
	// Key behaviors:
	// - Providing an empty array removes all direct permissions from the key
	// - This only affects direct permissions - permissions granted through roles are not affected
	// - All existing direct permissions not included in this list will be removed
	//
	// Any permissions that do not exist will be auto created if the root key has permissions, otherwise this operation will fail with a 403 error.
	Permissions []string `json:"permissions"`
}

V2KeysSetPermissionsRequestBody defines model for V2KeysSetPermissionsRequestBody.

type V2KeysSetPermissionsResponseBody

type V2KeysSetPermissionsResponseBody struct {
	// Data Complete list of all permissions now directly assigned to the key after the set operation has completed.
	//
	// The response includes:
	// - The comprehensive, updated set of direct permissions (reflecting the complete replacement)
	// - Both ID and name for each permission for easy reference
	//
	// Important notes:
	// - This only shows direct permissions, not those granted through roles
	// - An empty array means the key has no direct permissions assigned
	// - For a complete permission picture including roles, use keys.getKey instead
	Data V2KeysSetPermissionsResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysSetPermissionsResponseBody defines model for V2KeysSetPermissionsResponseBody.

type V2KeysSetPermissionsResponseData

type V2KeysSetPermissionsResponseData = []Permission

V2KeysSetPermissionsResponseData Complete list of all permissions now directly assigned to the key after the set operation has completed.

The response includes: - The comprehensive, updated set of direct permissions (reflecting the complete replacement) - Both ID and name for each permission for easy reference

Important notes: - This only shows direct permissions, not those granted through roles - An empty array means the key has no direct permissions assigned - For a complete permission picture including roles, use keys.getKey instead

type V2KeysSetRolesRequestBody

type V2KeysSetRolesRequestBody struct {
	// KeyId Specifies which key gets the complete role replacement using the database identifier returned from createKey.
	// Do not confuse this with the actual API key string that users include in requests.
	// This is a wholesale replacement operation that removes all existing roles not included in the request.
	// Role changes take effect immediately but may take up to 30 seconds to propagate across all regions.
	KeyId string `json:"keyId"`

	// Roles Replaces all existing role assignments with this complete list of roles.
	// This is a wholesale replacement operation, not an incremental update like add/remove operations.
	//
	// Providing an empty array removes all direct role assignments from the key.
	// All roles must already exist in the workspace - roles cannot be created automatically.
	// Invalid role references cause the entire operation to fail atomically, ensuring consistent state.
	Roles []string `json:"roles"`
}

V2KeysSetRolesRequestBody defines model for V2KeysSetRolesRequestBody.

type V2KeysSetRolesResponseBody

type V2KeysSetRolesResponseBody struct {
	// Data Complete list of all roles now directly assigned to the key after the set operation has completed.
	//
	// The response includes:
	// - The comprehensive, updated set of roles (reflecting the complete replacement)
	// - Both ID and name for each role for easy reference
	//
	// Important notes:
	// - This response shows the final state after the complete replacement
	// - If you provided an empty array in the request, this will also be empty
	// - This only shows direct role assignments on the key
	// - Role permissions are not expanded in this response - use keys.getKey for complete details
	// - An empty array indicates the key now has no roles assigned at all
	Data V2KeysSetRolesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysSetRolesResponseBody defines model for V2KeysSetRolesResponseBody.

type V2KeysSetRolesResponseData

type V2KeysSetRolesResponseData = []Role

V2KeysSetRolesResponseData Complete list of all roles now directly assigned to the key after the set operation has completed.

The response includes: - The comprehensive, updated set of roles (reflecting the complete replacement) - Both ID and name for each role for easy reference

Important notes: - This response shows the final state after the complete replacement - If you provided an empty array in the request, this will also be empty - This only shows direct role assignments on the key - Role permissions are not expanded in this response - use keys.getKey for complete details - An empty array indicates the key now has no roles assigned at all

type V2KeysUpdateCreditsRequestBody

type V2KeysUpdateCreditsRequestBody struct {
	// KeyId The ID of the key to update (begins with `key_`). This is the database reference ID for the key, not the actual API key string that users authenticate with. This ID uniquely identifies which key's credits will be updated.
	KeyId string `json:"keyId"`

	// Operation Defines how to modify the key's remaining credits. Use 'set' to replace current credits with a specific value or unlimited usage, 'increment' to add credits for plan upgrades or credit purchases, and 'decrement' to reduce credits for refunds or policy violations.
	Operation V2KeysUpdateCreditsRequestBodyOperation `json:"operation"`

	// Value The credit value to use with the specified operation. The meaning depends on the operation: for 'set', this becomes the new remaining credits value; for 'increment', this amount is added to current credits; for 'decrement', this amount is subtracted from current credits.
	//
	// Set to null when using 'set' operation to make the key unlimited (removes usage restrictions entirely). When decrementing, if the result would be negative, remaining credits are automatically set to zero. Credits are consumed during successful key verification, and when credits reach zero, verification fails with `code=USAGE_EXCEEDED`.
	//
	// Required when using 'increment' or 'decrement' operations. Optional for 'set' operation (null creates unlimited usage).
	Value nullable.Nullable[int64] `json:"value,omitempty"`
}

V2KeysUpdateCreditsRequestBody defines model for V2KeysUpdateCreditsRequestBody.

type V2KeysUpdateCreditsRequestBodyOperation

type V2KeysUpdateCreditsRequestBodyOperation string

V2KeysUpdateCreditsRequestBodyOperation Defines how to modify the key's remaining credits. Use 'set' to replace current credits with a specific value or unlimited usage, 'increment' to add credits for plan upgrades or credit purchases, and 'decrement' to reduce credits for refunds or policy violations.

Defines values for V2KeysUpdateCreditsRequestBodyOperation.

type V2KeysUpdateCreditsResponseBody

type V2KeysUpdateCreditsResponseBody struct {
	// Data Credit configuration and remaining balance for this key.
	Data KeyCreditsData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysUpdateCreditsResponseBody defines model for V2KeysUpdateCreditsResponseBody.

type V2KeysUpdateKeyRequestBody

type V2KeysUpdateKeyRequestBody struct {
	// Credits Credit configuration and remaining balance for this key.
	Credits nullable.Nullable[UpdateKeyCreditsData] `json:"credits,omitempty"`

	// Enabled Controls whether the key is currently active for verification requests.
	// When set to `false`, all verification attempts fail with `code=DISABLED` regardless of other settings.
	// Omitting this field preserves the current enabled status.
	// Useful for temporarily suspending access during billing issues, security incidents, or maintenance windows without losing key configuration.
	Enabled *bool `json:"enabled,omitempty"`

	// Expires Sets when this key automatically expires as a Unix timestamp in milliseconds.
	// Verification fails with code=EXPIRED immediately after this time passes.
	// Omitting this field preserves the current expiration, while setting null makes the key permanent.
	//
	// Avoid setting timestamps in the past as they immediately invalidate the key.
	// Keys expire based on server time, not client time, which prevents timezone-related issues.
	// Active sessions continue until their next verification attempt after expiry.
	Expires nullable.Nullable[int64] `json:"expires,omitempty"`

	// ExternalId Links this key to a user or entity in your system for ownership tracking during verification.
	// Omitting this field preserves the current association, while setting null disconnects the key from any identity.
	// Essential for user-specific analytics, billing, and key management across multiple users.
	// Supports letters, numbers, underscores, dots, and hyphens for flexible identifier formats.
	ExternalId nullable.Nullable[string] `json:"externalId,omitempty"`

	// KeyId Specifies which key to update using the database identifier returned from `createKey`.
	// Do not confuse this with the actual API key string that users include in requests.
	KeyId string `json:"keyId"`

	// Meta Stores arbitrary JSON metadata returned during key verification.
	// Omitting this field preserves existing metadata, while setting null removes all metadata entirely.
	// Avoid storing sensitive data here as it's returned in verification responses.
	// Large metadata objects increase verification latency and should stay under 10KB total size.
	Meta nullable.Nullable[map[string]interface{}] `json:"meta,omitempty"`

	// Name Sets a human-readable name for internal organization and identification.
	// Omitting this field leaves the current name unchanged, while setting null removes it entirely.
	// Avoid generic names like "API Key" when managing multiple keys per user or service.
	Name        nullable.Nullable[string] `json:"name,omitempty"`
	Permissions *[]string                 `json:"permissions,omitempty"`

	// Ratelimits Defines time-based rate limits that protect against abuse by controlling request frequency.
	// Omitting this field preserves existing rate limits, while setting null removes all rate limits.
	// Unlike credits which track total usage, rate limits reset automatically after each window expires.
	// Multiple rate limits can control different operation types with separate thresholds and windows.
	Ratelimits *[]RatelimitRequest `json:"ratelimits,omitempty"`
	Roles      *[]string           `json:"roles,omitempty"`
}

V2KeysUpdateKeyRequestBody defines model for V2KeysUpdateKeyRequestBody.

type V2KeysUpdateKeyResponseBody

type V2KeysUpdateKeyResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysUpdateKeyResponseBody defines model for V2KeysUpdateKeyResponseBody.

type V2KeysVerifyKeyRequestBody

type V2KeysVerifyKeyRequestBody struct {
	// Credits Controls credit consumption for usage-based billing and quota enforcement.
	// Omitting this field uses the default cost of 1 credit per verification.
	// Credits provide globally consistent usage tracking, essential for paid APIs with strict quotas.
	Credits *KeysVerifyKeyCredits `json:"credits,omitempty"`

	// Key The API key to verify, exactly as provided by your user.
	// Include any prefix - even small changes will cause verification to fail.
	Key string `json:"key"`

	// MigrationId Migrate keys on demand from your previous system. Reach out for migration support at support@unkey.dev
	MigrationId *string `json:"migrationId,omitempty"`

	// Permissions Checks if the key has the specified permission(s) using a query syntax.
	// Supports single permissions, logical operators (AND, OR), and parentheses for grouping.
	// Examples:
	// - Single permission: "documents.read"
	// - Multiple permissions: "documents.read AND documents.write"
	// - Complex queries: "(documents.read OR documents.write) AND users.view"
	// Verification fails if the key lacks the required permissions through direct assignment or role inheritance.
	Permissions *string `json:"permissions,omitempty"`

	// Ratelimits Enforces time-based rate limiting during verification to prevent abuse and ensure fair usage.
	// Omitting this field skips rate limit checks entirely, relying only on configured key rate limits.
	// Multiple rate limits can be checked simultaneously, each with different costs and temporary overrides.
	// Rate limit checks are optimized for performance but may allow brief bursts during high concurrency.
	Ratelimits *[]KeysVerifyKeyRatelimit `json:"ratelimits,omitempty"`

	// Tags Attaches metadata tags for analytics and monitoring without affecting verification outcomes.
	// Enables segmentation of API usage in dashboards by endpoint, client version, region, or custom dimensions.
	// Use 'key=value' format for compatibility with most analytics tools and clear categorization.
	// Avoid including sensitive data in tags as they may appear in logs and analytics reports.
	Tags *[]string `json:"tags,omitempty"`
}

V2KeysVerifyKeyRequestBody defines model for V2KeysVerifyKeyRequestBody.

type V2KeysVerifyKeyResponseBody

type V2KeysVerifyKeyResponseBody struct {
	Data V2KeysVerifyKeyResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysVerifyKeyResponseBody defines model for V2KeysVerifyKeyResponseBody.

type V2KeysVerifyKeyResponseData

type V2KeysVerifyKeyResponseData struct {
	// Code A machine-readable code indicating the verification status
	// or failure reason. Values: `VALID` (key is valid and passed all checks), `NOT_FOUND` (key doesn't
	// exist or belongs to wrong API), `FORBIDDEN` (key lacks required permissions), `INSUFFICIENT_PERMISSIONS`
	// (key lacks specific required permissions for this request), `USAGE_EXCEEDED` (key has no remaining credits), `RATE_LIMITED` (key exceeded rate limits), `DISABLED` (key was explicitly disabled),
	// `EXPIRED` (key has passed its expiration date).
	Code V2KeysVerifyKeyResponseDataCode `json:"code"`

	// Credits The number of requests/credits remaining for this key. If omitted,
	// the key has unlimited usage. This value decreases with
	// each verification (based on the 'cost' parameter) unless explicit credit
	// refills are configured.
	Credits *int64 `json:"credits,omitempty"`

	// Enabled Indicates if the key is currently enabled. Disabled keys will
	// always fail verification with `code=DISABLED`. This is useful for implementing
	// temporary suspensions without deleting the key.
	Enabled *bool `json:"enabled,omitempty"`

	// Expires Unix timestamp (in milliseconds) when the key will expire.
	// If omitted, the key has no expiration. You can use this to
	// warn users about upcoming expirations or to understand the validity period.
	Expires  int64     `json:"expires,omitempty"`
	Identity *Identity `json:"identity,omitempty"`

	// KeyId The unique identifier of the verified key in Unkey's system.
	// Use this ID for operations like updating or revoking the key. This field
	// is returned for both valid and invalid keys (except when `code=NOT_FOUND`).
	KeyId string `json:"keyId,omitempty"`

	// Meta Custom metadata associated with the key. This can include any
	// JSON-serializable data you stored with the key during creation or updates,
	// such as plan information, feature flags, or user details. Use this to
	// avoid additional database lookups for contextual information needed during
	// API calls.
	Meta map[string]interface{} `json:"meta,omitempty"`

	// Name The human-readable name assigned to this key during creation.
	// This is useful for displaying in logs or admin interfaces to identify
	// the key's purpose.
	Name string `json:"name,omitempty"`

	// Permissions A list of all permission names assigned to this key, either
	// directly or through roles. These permissions determine what actions the
	// key can perform. Only returned when permissions were checked during verification
	// or when the key fails with `code=FORBIDDEN`.
	Permissions []string                 `json:"permissions,omitempty"`
	Ratelimits  []VerifyKeyRatelimitData `json:"ratelimits,omitempty"`

	// Roles A list of all role names assigned to this key. Roles are collections
	// of permissions that grant access to specific functionality. Only returned
	// when permissions were checked during verification.
	Roles []string `json:"roles,omitempty"`

	// Valid The primary verification result. If true, the key is valid
	// and can be used. If false, check the 'code' field to understand why verification
	// failed. Your application should always check this field first before proceeding.
	Valid bool `json:"valid"`
}

V2KeysVerifyKeyResponseData defines model for V2KeysVerifyKeyResponseData.

type V2KeysVerifyKeyResponseDataCode

type V2KeysVerifyKeyResponseDataCode string

V2KeysVerifyKeyResponseDataCode A machine-readable code indicating the verification status or failure reason. Values: `VALID` (key is valid and passed all checks), `NOT_FOUND` (key doesn't exist or belongs to wrong API), `FORBIDDEN` (key lacks required permissions), `INSUFFICIENT_PERMISSIONS` (key lacks specific required permissions for this request), `USAGE_EXCEEDED` (key has no remaining credits), `RATE_LIMITED` (key exceeded rate limits), `DISABLED` (key was explicitly disabled), `EXPIRED` (key has passed its expiration date).

const (
	DISABLED                V2KeysVerifyKeyResponseDataCode = "DISABLED"
	EXPIRED                 V2KeysVerifyKeyResponseDataCode = "EXPIRED"
	FORBIDDEN               V2KeysVerifyKeyResponseDataCode = "FORBIDDEN"
	INSUFFICIENTPERMISSIONS V2KeysVerifyKeyResponseDataCode = "INSUFFICIENT_PERMISSIONS"
	NOTFOUND                V2KeysVerifyKeyResponseDataCode = "NOT_FOUND"
	RATELIMITED             V2KeysVerifyKeyResponseDataCode = "RATE_LIMITED"
	USAGEEXCEEDED           V2KeysVerifyKeyResponseDataCode = "USAGE_EXCEEDED"
	VALID                   V2KeysVerifyKeyResponseDataCode = "VALID"
)

Defines values for V2KeysVerifyKeyResponseDataCode.

type V2KeysWhoamiRequestBody

type V2KeysWhoamiRequestBody struct {
	// Key The complete API key string provided by you, including any prefix.
	// Never log, cache, or store API keys in your system as they provide full access to user resources.
	// Include the full key exactly as provided - even minor modifications will cause a not found error.
	Key string `json:"key"`
}

V2KeysWhoamiRequestBody defines model for V2KeysWhoamiRequestBody.

type V2KeysWhoamiResponseBody

type V2KeysWhoamiResponseBody struct {
	Data KeyResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2KeysWhoamiResponseBody defines model for V2KeysWhoamiResponseBody.

type V2LivenessResponseBody

type V2LivenessResponseBody struct {
	// Data Response data for the liveness check endpoint. This provides a simple indication of whether the Unkey API service is running and able to process requests. Monitoring systems can use this endpoint to track service availability and trigger alerts if the service becomes unhealthy.
	Data V2LivenessResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2LivenessResponseBody defines model for V2LivenessResponseBody.

type V2LivenessResponseData

type V2LivenessResponseData struct {
	// Message Status message indicating the health of the service. A value of 'OK' indicates that the service is functioning properly and ready to accept requests. Any other value indicates a potential issue with the service health.
	Message string `json:"message"`
}

V2LivenessResponseData Response data for the liveness check endpoint. This provides a simple indication of whether the Unkey API service is running and able to process requests. Monitoring systems can use this endpoint to track service availability and trigger alerts if the service becomes unhealthy.

type V2PermissionsCreatePermissionRequestBody

type V2PermissionsCreatePermissionRequestBody struct {
	// Description Provides detailed documentation of what this permission grants access to.
	// Include information about affected resources, allowed actions, and any important limitations.
	// This internal documentation helps team members understand permission scope and security implications.
	// Not visible to end users - designed for development teams and security audits.
	//
	// Consider documenting:
	// - What resources can be accessed
	// - What operations are permitted
	// - Any conditions or limitations
	// - Related permissions that might be needed
	Description *string `json:"description,omitempty"`

	// Name Creates a permission with this human-readable name that describes its purpose.
	// Names must be unique within your workspace to prevent conflicts during assignment.
	// Use clear, semantic names that developers can easily understand when building authorization logic.
	// Consider using hierarchical naming conventions like 'resource.action' for better organization.
	//
	// Examples: 'users.read', 'billing.write', 'analytics.view', 'admin.manage'
	Name string `json:"name"`

	// Slug Creates a URL-safe identifier for this permission that can be used in APIs and integrations.
	// Must start with a letter and contain only letters, numbers, periods, underscores, and hyphens.
	// Slugs are often used in REST endpoints, configuration files, and external integrations.
	// Should closely match the name but in a format suitable for technical usage.
	// Must be unique within your workspace to ensure reliable permission lookups.
	//
	// Keep slugs concise but descriptive for better developer experience.
	Slug string `json:"slug"`
}

V2PermissionsCreatePermissionRequestBody defines model for V2PermissionsCreatePermissionRequestBody.

type V2PermissionsCreatePermissionResponseBody

type V2PermissionsCreatePermissionResponseBody struct {
	Data V2PermissionsCreatePermissionResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsCreatePermissionResponseBody defines model for V2PermissionsCreatePermissionResponseBody.

type V2PermissionsCreatePermissionResponseData

type V2PermissionsCreatePermissionResponseData struct {
	// PermissionId The unique identifier assigned to the newly created permission.
	// Use this ID to reference the permission in role assignments, key operations, and other API calls.
	// Always begins with 'perm_' followed by a unique alphanumeric sequence.
	// Store this ID if you need to manage or reference this permission in future operations.
	PermissionId string `json:"permissionId"`
}

V2PermissionsCreatePermissionResponseData defines model for V2PermissionsCreatePermissionResponseData.

type V2PermissionsCreateRoleRequestBody

type V2PermissionsCreateRoleRequestBody struct {
	// Description Provides comprehensive documentation of what this role encompasses and what access it grants.
	// Include information about the intended use case, what permissions should be assigned, and any important considerations.
	// This internal documentation helps team members understand role boundaries and security implications.
	// Not visible to end users - designed for administration teams and access control audits.
	//
	// Consider documenting:
	// - The role's intended purpose and scope
	// - What types of users should receive this role
	// - What permissions are typically associated with it
	// - Any security considerations or limitations
	// - Related roles that might be used together
	Description *string `json:"description,omitempty"`

	// Name The unique name for this role. Must be unique within your workspace and clearly indicate the role's purpose. Use descriptive names like 'admin', 'editor', or 'billing_manager'.
	//
	// Examples: 'admin.billing', 'support.readonly', 'developer.api', 'manager.analytics'
	Name string `json:"name"`
}

V2PermissionsCreateRoleRequestBody defines model for V2PermissionsCreateRoleRequestBody.

type V2PermissionsCreateRoleResponseBody

type V2PermissionsCreateRoleResponseBody struct {
	Data V2PermissionsCreateRoleResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsCreateRoleResponseBody defines model for V2PermissionsCreateRoleResponseBody.

type V2PermissionsCreateRoleResponseData

type V2PermissionsCreateRoleResponseData struct {
	// RoleId The unique identifier assigned to the newly created role.
	// Use this ID to reference the role in permission assignments, key operations, and role management calls.
	// Always begins with 'role_' followed by a unique alphanumeric sequence.
	// Store this ID if you need to manage, modify, or assign this role in future operations.
	RoleId string `json:"roleId"`
}

V2PermissionsCreateRoleResponseData defines model for V2PermissionsCreateRoleResponseData.

type V2PermissionsDeletePermissionRequestBody

type V2PermissionsDeletePermissionRequestBody struct {
	// Permission Specifies which permission to permanently delete from your workspace.
	//
	// This can be a permission ID or a permission slug.
	//
	// WARNING: Deleting a permission has immediate and irreversible consequences:
	// - All API keys with this permission will lose that access immediately
	// - All roles containing this permission will have it removed
	// - Any verification requests checking for this permission will fail
	// - This action cannot be undone
	//
	// Before deletion, ensure you:
	// - Have updated any keys or roles that depend on this permission
	// - Have migrated to alternative permissions if needed
	// - Have notified affected users about the access changes
	Permission string `json:"permission"`
}

V2PermissionsDeletePermissionRequestBody defines model for V2PermissionsDeletePermissionRequestBody.

type V2PermissionsDeletePermissionResponseBody

type V2PermissionsDeletePermissionResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsDeletePermissionResponseBody defines model for V2PermissionsDeletePermissionResponseBody.

type V2PermissionsDeleteRoleRequestBody

type V2PermissionsDeleteRoleRequestBody struct {
	// Role Unique identifier of the role to permanently delete from your workspace.
	// Must either be a valid role ID that begins with 'role_' or the given role name and exists within your workspace.
	//
	// WARNING: Deletion is immediate and irreversible with significant consequences:
	// - All API keys assigned this role will lose the associated permissions
	// - Access to resources protected by this role's permissions will be denied
	// - Any authorization logic depending on this role will start failing
	// - Historical analytics referencing this role remain intact
	//
	// Before deletion, ensure:
	// - You've updated any dependent authorization logic or code
	// - You've migrated any keys to use alternative roles or direct permissions
	// - You've notified relevant team members of the access changes
	Role string `json:"role"`
}

V2PermissionsDeleteRoleRequestBody defines model for V2PermissionsDeleteRoleRequestBody.

type V2PermissionsDeleteRoleResponseBody

type V2PermissionsDeleteRoleResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsDeleteRoleResponseBody defines model for V2PermissionsDeleteRoleResponseBody.

type V2PermissionsGetPermissionRequestBody

type V2PermissionsGetPermissionRequestBody struct {
	// Permission The unique identifier of the permission to retrieve. Must be a valid permission ID that begins with 'perm_' and exists within your workspace.
	Permission string `json:"permission"`
}

V2PermissionsGetPermissionRequestBody defines model for V2PermissionsGetPermissionRequestBody.

type V2PermissionsGetPermissionResponseBody

type V2PermissionsGetPermissionResponseBody struct {
	Data Permission `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsGetPermissionResponseBody defines model for V2PermissionsGetPermissionResponseBody.

type V2PermissionsGetRoleRequestBody

type V2PermissionsGetRoleRequestBody struct {
	// Role Unique identifier of the role to permanently delete from your workspace.
	// Must either be a valid role ID that begins with 'role_' or the given role name and exists within your workspace.
	//
	// Use this endpoint to verify role details, check its current permissions, or retrieve metadata.
	// Returns complete role information including all assigned permissions for comprehensive access review.
	Role string `json:"role"`
}

V2PermissionsGetRoleRequestBody defines model for V2PermissionsGetRoleRequestBody.

type V2PermissionsGetRoleResponseBody

type V2PermissionsGetRoleResponseBody struct {
	Data Role `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PermissionsGetRoleResponseBody defines model for V2PermissionsGetRoleResponseBody.

type V2PermissionsListPermissionsRequestBody

type V2PermissionsListPermissionsRequestBody struct {
	// Cursor Pagination cursor from a previous response to fetch the next page of permissions.
	// Include this value when you need to retrieve additional permissions beyond the initial response.
	// Each response containing more results than the requested limit includes a cursor for subsequent pages.
	//
	// Leave empty or omit this field to start from the beginning of the permission list.
	// Cursors are temporary and may expire - always handle cases where a cursor becomes invalid.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of permissions to return in a single response.
	Limit *int `json:"limit,omitempty"`

	// Search Free-form text to filter permissions. Returns permissions whose ID, name, slug, or description contains the search string. Matching is case-insensitive.
	Search *string `json:"search,omitempty"`
}

V2PermissionsListPermissionsRequestBody defines model for V2PermissionsListPermissionsRequestBody.

type V2PermissionsListPermissionsResponseBody

type V2PermissionsListPermissionsResponseBody struct {
	// Data Array of permission objects with complete configuration details.
	Data V2PermissionsListPermissionsResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2PermissionsListPermissionsResponseBody defines model for V2PermissionsListPermissionsResponseBody.

type V2PermissionsListPermissionsResponseData

type V2PermissionsListPermissionsResponseData = []Permission

V2PermissionsListPermissionsResponseData Array of permission objects with complete configuration details.

type V2PermissionsListRolesRequestBody

type V2PermissionsListRolesRequestBody struct {
	// Cursor Pagination cursor from a previous response to fetch the next page of roles.
	// Include this when you need to retrieve additional roles beyond the first page.
	// Each response containing more results will include a cursor value that can be used here.
	// Leave empty or omit this field to start from the beginning of the role list.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of roles to return in a single response.
	// Use smaller values for faster response times and better UI performance.
	// Use larger values when you need to process many roles efficiently.
	// Results exceeding this limit will be paginated with a cursor for continuation.
	Limit *int `json:"limit,omitempty"`

	// Search Free-form text to filter roles. Returns roles whose ID, name, or description contains the search string. Matching is case-insensitive.
	Search *string `json:"search,omitempty"`
}

V2PermissionsListRolesRequestBody defines model for V2PermissionsListRolesRequestBody.

type V2PermissionsListRolesResponseBody

type V2PermissionsListRolesResponseBody struct {
	// Data Array of roles with their assigned permissions.
	Data V2PermissionsListRolesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2PermissionsListRolesResponseBody defines model for V2PermissionsListRolesResponseBody.

type V2PermissionsListRolesResponseData

type V2PermissionsListRolesResponseData = []Role

V2PermissionsListRolesResponseData Array of roles with their assigned permissions.

type V2PortalCreateSessionRequestBody

type V2PortalCreateSessionRequestBody struct {
	// ExternalId The end user's identifier in the customer's system.
	// Accepts arbitrary string values (user IDs, emails, UUIDs, etc.).
	ExternalId string `json:"externalId"`

	// Permissions The capabilities granted to the end user in the Portal, from a fixed
	// vocabulary. All capabilities are scoped to this end user: key capabilities
	// (`keys:*`) apply only to keys the end user owns within the keyspace
	// configured on the portal configuration, and `analytics:read` returns only
	// the end user's own verification events. An end user can never see another
	// identity's keys or analytics.
	//
	// Tab visibility is derived from the capabilities:
	// - Keys tab: any `keys:*` capability
	// - Analytics tab: `analytics:read`
	// - Docs tab: visible when any capability is present
	Permissions []V2PortalCreateSessionRequestBodyPermissions `json:"permissions"`

	// Preview When true, creates a preview session for testing the portal experience.
	Preview *bool `json:"preview,omitempty"`

	// Slug The human-readable slug of the portal configuration to create the session against.
	// Identifies which app's portal the end user will access.
	// Must be 3-64 characters, lowercase alphanumeric and hyphens only,
	// must not start or end with a hyphen, and must not contain consecutive hyphens.
	Slug string `json:"slug"`
}

V2PortalCreateSessionRequestBody defines model for V2PortalCreateSessionRequestBody.

type V2PortalCreateSessionRequestBodyPermissions

type V2PortalCreateSessionRequestBodyPermissions string

V2PortalCreateSessionRequestBodyPermissions defines model for V2PortalCreateSessionRequestBody.Permissions.

const (
	AnalyticsRead V2PortalCreateSessionRequestBodyPermissions = "analytics:read"
	KeysCreate    V2PortalCreateSessionRequestBodyPermissions = "keys:create"
	KeysRead      V2PortalCreateSessionRequestBodyPermissions = "keys:read"
	KeysReroll    V2PortalCreateSessionRequestBodyPermissions = "keys:reroll"
)

Defines values for V2PortalCreateSessionRequestBodyPermissions.

type V2PortalCreateSessionResponseBody

type V2PortalCreateSessionResponseBody struct {
	Data V2PortalCreateSessionResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PortalCreateSessionResponseBody defines model for V2PortalCreateSessionResponseBody.

type V2PortalCreateSessionResponseData

type V2PortalCreateSessionResponseData struct {
	// SessionId The short-lived session token ID. Valid for 15 minutes and can be exchanged once for a browser session.
	SessionId string `json:"sessionId"`

	// Url The full portal URL with the session parameter. Redirect the end user to this URL.
	Url string `json:"url"`
}

V2PortalCreateSessionResponseData defines model for V2PortalCreateSessionResponseData.

type V2PortalExchangeSessionRequestBody

type V2PortalExchangeSessionRequestBody struct {
	// SessionId The session token ID received from `portal.createSession`.
	// Must be valid, unexpired, and not previously exchanged.
	SessionId string `json:"sessionId"`
}

V2PortalExchangeSessionRequestBody defines model for V2PortalExchangeSessionRequestBody.

type V2PortalExchangeSessionResponseBody

type V2PortalExchangeSessionResponseBody struct {
	Data V2PortalExchangeSessionResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PortalExchangeSessionResponseBody defines model for V2PortalExchangeSessionResponseBody.

type V2PortalExchangeSessionResponseData

type V2PortalExchangeSessionResponseData struct {
	// ExpiresAt Unix timestamp in milliseconds when the browser session expires (24 hours from creation).
	ExpiresAt int64 `json:"expiresAt"`

	// Token The browser session token. Store this as an httpOnly cookie for subsequent portal requests.
	Token string `json:"token"`
}

V2PortalExchangeSessionResponseData defines model for V2PortalExchangeSessionResponseData.

type V2PortalGetVerificationsDataPoint

type V2PortalGetVerificationsDataPoint struct {
	// Disabled Verifications rejected because the key was disabled.
	Disabled int64 `json:"disabled"`

	// Expired Verifications rejected because the key was expired.
	Expired int64 `json:"expired"`

	// Forbidden Verifications rejected as forbidden.
	Forbidden int64 `json:"forbidden"`

	// InsufficientPermissions Verifications rejected for insufficient permissions.
	InsufficientPermissions int64 `json:"insufficientPermissions"`

	// RateLimited Verifications rejected because a rate limit was exceeded.
	RateLimited int64 `json:"rateLimited"`

	// Time Bucket start as a unix timestamp in milliseconds.
	Time int64 `json:"time"`

	// Total Total verifications in this bucket, across all outcomes.
	Total int64 `json:"total"`

	// UsageExceeded Verifications rejected because remaining usage was exhausted.
	UsageExceeded int64 `json:"usageExceeded"`

	// Valid Verifications with a VALID outcome.
	Valid int64 `json:"valid"`
}

V2PortalGetVerificationsDataPoint defines model for V2PortalGetVerificationsDataPoint.

type V2PortalGetVerificationsRequestBody

type V2PortalGetVerificationsRequestBody struct {
	// EndTime End of the query window as a unix timestamp in milliseconds (exclusive).
	// Bucket granularity (minute, hour, or day) is chosen automatically from the
	// window size.
	EndTime int64 `json:"endTime"`

	// KeyId Optional. Restrict results to a single key. The key must belong to the
	// authenticated end user; results are always scoped to the session identity
	// regardless of this value.
	KeyId *string `json:"keyId,omitempty"`

	// StartTime Start of the query window as a unix timestamp in milliseconds (inclusive).
	StartTime int64 `json:"startTime"`
}

V2PortalGetVerificationsRequestBody defines model for V2PortalGetVerificationsRequestBody.

type V2PortalGetVerificationsResponseBody

type V2PortalGetVerificationsResponseBody struct {
	// Data Zero-filled verification timeseries for the authenticated end user, ordered
	// by time ascending. Buckets with no verifications are present with zero
	// counts so the series is contiguous across the requested window.
	Data []V2PortalGetVerificationsDataPoint `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2PortalGetVerificationsResponseBody defines model for V2PortalGetVerificationsResponseBody.

type V2PortalListKeysRequestBody

type V2PortalListKeysRequestBody struct {
	// Cursor Pagination cursor from a previous response to fetch the next page.
	// Use when `hasMore: true` in the previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of keys to return per request.
	// Balance between response size and number of pagination calls needed.
	Limit *int `json:"limit,omitempty"`
}

V2PortalListKeysRequestBody defines model for V2PortalListKeysRequestBody.

type V2PortalListKeysResponseBody

type V2PortalListKeysResponseBody struct {
	// Data Array of the portal end user's API keys.
	Data V2PortalListKeysResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2PortalListKeysResponseBody defines model for V2PortalListKeysResponseBody.

type V2PortalListKeysResponseData

type V2PortalListKeysResponseData = []KeyResponseData

V2PortalListKeysResponseData Array of the portal end user's API keys.

type V2ProjectsCreateProjectRequestBody

type V2ProjectsCreateProjectRequestBody struct {
	// Name Human-readable name for this project.
	// Use a descriptive name like 'Payments Service' to identify its purpose.
	Name string `json:"name"`

	// Slug Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Slug ResourceIdentifier `json:"slug"`
}

V2ProjectsCreateProjectRequestBody defines model for V2ProjectsCreateProjectRequestBody.

type V2ProjectsCreateProjectResponseBody

type V2ProjectsCreateProjectResponseBody struct {
	Data V2ProjectsCreateProjectResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ProjectsCreateProjectResponseBody defines model for V2ProjectsCreateProjectResponseBody.

type V2ProjectsCreateProjectResponseData

type V2ProjectsCreateProjectResponseData struct {
	// Id The unique identifier of the newly created project, generated by Unkey.
	// Always begins with 'proj_' followed by a unique alphanumeric sequence.
	Id string `json:"id"`
}

V2ProjectsCreateProjectResponseData defines model for V2ProjectsCreateProjectResponseData.

type V2ProjectsDeleteProjectRequestBody

type V2ProjectsDeleteProjectRequestBody struct {
	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2ProjectsDeleteProjectRequestBody defines model for V2ProjectsDeleteProjectRequestBody.

type V2ProjectsDeleteProjectResponseBody

type V2ProjectsDeleteProjectResponseBody struct {
	// Data Empty response object by design. A successful response indicates this operation was successfully executed.
	Data EmptyResponse `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ProjectsDeleteProjectResponseBody defines model for V2ProjectsDeleteProjectResponseBody.

type V2ProjectsGetProjectRequestBody

type V2ProjectsGetProjectRequestBody struct {
	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`
}

V2ProjectsGetProjectRequestBody defines model for V2ProjectsGetProjectRequestBody.

type V2ProjectsGetProjectResponseBody

type V2ProjectsGetProjectResponseBody struct {
	Data Project `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ProjectsGetProjectResponseBody defines model for V2ProjectsGetProjectResponseBody.

type V2ProjectsListProjectsRequestBody

type V2ProjectsListProjectsRequestBody struct {
	// Cursor Pagination cursor from a previous response to fetch the next page.
	// Use when `hasMore: true` in the previous response.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of projects to return per request.
	// Balance between response size and number of pagination calls needed.
	Limit *int `json:"limit,omitempty"`

	// Search Free-form text to filter projects. Returns projects whose ID, name, or slug contains the search string. Matching is case-insensitive.
	Search *string `json:"search,omitempty"`
}

V2ProjectsListProjectsRequestBody defines model for V2ProjectsListProjectsRequestBody.

type V2ProjectsListProjectsResponseBody

type V2ProjectsListProjectsResponseBody struct {
	// Data Array of projects in the workspace, ordered by project id.
	Data []Project `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2ProjectsListProjectsResponseBody defines model for V2ProjectsListProjectsResponseBody.

type V2ProjectsUpdateProjectRequestBody

type V2ProjectsUpdateProjectRequestBody struct {
	// DeleteProtection Enable or disable delete protection for the project.
	// Omit this field to leave the current setting unchanged.
	DeleteProtection *bool `json:"deleteProtection,omitempty"`

	// Name New human-readable name for the project.
	// Omit this field to leave the current name unchanged.
	Name *string `json:"name,omitempty"`

	// Project Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Project ResourceIdentifier `json:"project"`

	// Slug Identifies a resource by either its unique ID or its slug.
	// Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
	Slug *ResourceIdentifier `json:"slug,omitempty"`
}

V2ProjectsUpdateProjectRequestBody defines model for V2ProjectsUpdateProjectRequestBody.

type V2ProjectsUpdateProjectResponseBody

type V2ProjectsUpdateProjectResponseBody struct {
	Data Project `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2ProjectsUpdateProjectResponseBody defines model for V2ProjectsUpdateProjectResponseBody.

type V2RatelimitDeleteOverrideRequestBody

type V2RatelimitDeleteOverrideRequestBody struct {
	// Identifier The exact identifier pattern of the override to delete. This must match exactly as it was specified when creating the override.
	//
	// Important notes:
	// - This is case-sensitive and must match exactly
	// - Include any wildcards (*) that were part of the original pattern
	// - For example, if the override was created for 'premium_*', you must use 'premium_*' here, not a specific ID
	//
	// After deletion, any identifiers previously affected by this override will immediately revert to using the default rate limit for the namespace.
	Identifier string `json:"identifier"`

	// Namespace The id or name of the namespace containing the override.
	Namespace string `json:"namespace"`
}

V2RatelimitDeleteOverrideRequestBody Deletes an existing rate limit override. This permanently removes a custom rate limit rule, reverting affected identifiers back to the default rate limits for the namespace.

Use this endpoint when you need to: - Remove special rate limit rules that are no longer needed - Reset entities back to standard rate limits - Clean up temporary overrides - Remove outdated tiering or custom limit rules - Fix misconfigured overrides

Once deleted, the override cannot be recovered, and the operation takes effect immediately.

type V2RatelimitDeleteOverrideResponseBody

type V2RatelimitDeleteOverrideResponseBody struct {
	// Data Empty response object. A successful response indicates the override was successfully deleted. The operation is immediate - as soon as this response is received, the override no longer exists and affected identifiers have reverted to using the default rate limit for the namespace. No other data is returned as part of the deletion operation.
	Data V2RatelimitDeleteOverrideResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2RatelimitDeleteOverrideResponseBody defines model for V2RatelimitDeleteOverrideResponseBody.

type V2RatelimitDeleteOverrideResponseData

type V2RatelimitDeleteOverrideResponseData = map[string]interface{}

V2RatelimitDeleteOverrideResponseData Empty response object. A successful response indicates the override was successfully deleted. The operation is immediate - as soon as this response is received, the override no longer exists and affected identifiers have reverted to using the default rate limit for the namespace. No other data is returned as part of the deletion operation.

type V2RatelimitGetOverrideRequestBody

type V2RatelimitGetOverrideRequestBody struct {
	// Identifier The exact identifier pattern for the override you want to retrieve. This must match exactly as it was specified when creating the override.
	//
	// Important notes:
	// - This is case-sensitive and must match exactly
	// - Include any wildcards (*) that were part of the original pattern
	// - For example, if the override was created for 'premium_*', you must use 'premium_*' here, not a specific ID like 'premium_user1'
	//
	// This field is used to look up the specific override configuration for this pattern.
	Identifier string `json:"identifier"`

	// Namespace The id or name of the namespace containing the override.
	Namespace string `json:"namespace"`
}

V2RatelimitGetOverrideRequestBody Gets the configuration of an existing rate limit override. Use this to retrieve details about custom rate limit rules that have been created for specific identifiers within a namespace.

This endpoint is useful for: - Verifying override configurations - Checking current limits for specific entities - Auditing rate limit policies - Debugging rate limiting behavior - Retrieving override settings for modification

type V2RatelimitGetOverrideResponseBody

type V2RatelimitGetOverrideResponseBody struct {
	Data RatelimitOverride `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2RatelimitGetOverrideResponseBody defines model for V2RatelimitGetOverrideResponseBody.

type V2RatelimitLimitRequestBody

type V2RatelimitLimitRequestBody struct {
	// Cost Sets how much of the rate limit quota this request consumes, enabling weighted rate limiting.
	// Use higher values for resource-intensive operations and 0 for tracking without limiting.
	// When accumulated cost exceeds the limit within the duration window, subsequent requests are rejected.
	// Essential for implementing fair usage policies and preventing resource abuse through expensive operations.
	Cost *int64 `json:"cost,omitempty"`

	// Duration Sets the rate limit window duration in milliseconds after which the counter resets.
	// Shorter durations enable faster recovery but may be less effective against sustained abuse.
	// Common values include 60000 (1 minute), 3600000 (1 hour), and 86400000 (24 hours).
	// Balance user experience with protection needs when choosing window sizes.
	Duration int64 `json:"duration"`

	// Identifier Defines the scope of rate limiting by identifying the entity being limited.
	// Use user IDs for per-user limits, IP addresses for anonymous limiting, or API key IDs for per-key limits.
	// Accepts letters, numbers, underscores, dots, colons, slashes, and hyphens for flexible identifier formats.
	// The same identifier can be used across different namespaces to apply multiple rate limit types.
	// Choose identifiers that provide appropriate granularity for your rate limiting strategy.
	Identifier string `json:"identifier"`

	// Limit Sets the maximum operations allowed within the duration window before requests are rejected.
	// When this limit is reached, subsequent requests fail with `RATE_LIMITED` until the window resets.
	// Balance user experience with resource protection when setting limits for different user tiers.
	// Consider system capacity, business requirements, and fair usage policies in limit determination.
	Limit int64 `json:"limit"`

	// Namespace The id or name of the namespace.
	Namespace string `json:"namespace"`
}

V2RatelimitLimitRequestBody defines model for V2RatelimitLimitRequestBody.

type V2RatelimitLimitResponseBody

type V2RatelimitLimitResponseBody struct {
	Data V2RatelimitLimitResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2RatelimitLimitResponseBody defines model for V2RatelimitLimitResponseBody.

type V2RatelimitLimitResponseData

type V2RatelimitLimitResponseData struct {
	// Limit The maximum number of operations allowed within the time window. This reflects either the default limit specified in the request or an override limit if one exists for this identifier.
	//
	// This value helps clients understand their total quota for the current window.
	Limit int64 `json:"limit"`

	// OverrideId If a rate limit override was applied for this identifier, this field contains the ID of the override that was used. Empty when no override is in effect.
	//
	// This can be useful for:
	// - Debugging which override rule was matched
	// - Tracking the effects of specific overrides
	// - Understanding why limits differ from default values
	OverrideId string `json:"overrideId,omitempty"`

	// Remaining The number of operations remaining in the current window before the rate limit is exceeded. Applications should use this value to:
	//
	// - Implement client-side throttling before hitting limits
	// - Display usage information to end users
	// - Trigger alerts when approaching limits
	// - Adjust request patterns based on available capacity
	//
	// When this reaches zero, requests will be rejected until the window resets.
	Remaining int64 `json:"remaining"`

	// Reset The Unix timestamp in milliseconds when the rate limit window will reset and 'remaining' will return to 'limit'.
	//
	// This timestamp enables clients to:
	// - Calculate and display wait times to users
	// - Implement intelligent retry mechanisms
	// - Schedule requests to resume after the reset
	// - Implement exponential backoff when needed
	//
	// The reset time is based on a sliding window from the first request in the current window.
	Reset int64 `json:"reset"`

	// Success Whether the request passed the rate limit check. If true, the request is allowed to proceed. If false, the request has exceeded the rate limit and should be blocked or rejected.
	//
	// You MUST check this field to determine if the request should proceed, as the endpoint always returns `HTTP 200` even when rate limited.
	Success bool `json:"success"`
}

V2RatelimitLimitResponseData defines model for V2RatelimitLimitResponseData.

type V2RatelimitListOverridesRequestBody

type V2RatelimitListOverridesRequestBody struct {
	// Cursor Pagination cursor from a previous response. Include this when fetching subsequent pages of results. Each response containing more results than the requested limit will include a cursor value in the pagination object that can be used here.
	Cursor *string `json:"cursor,omitempty"`

	// Limit Maximum number of override entries to return in a single response. Use this to control response size and loading performance.
	//
	// - Lower values (10-20): Better for UI displays and faster response times
	// - Higher values (50-100): Better for data exports or bulk operations
	// - Default (10): Suitable for most dashboard views
	//
	// Results exceeding this limit will be paginated, with a cursor provided for fetching subsequent pages.
	Limit *int `json:"limit,omitempty"`

	// Namespace The id or name of the rate limit namespace to list overrides for.
	Namespace string `json:"namespace"`
}

V2RatelimitListOverridesRequestBody defines model for V2RatelimitListOverridesRequestBody.

type V2RatelimitListOverridesResponseBody

type V2RatelimitListOverridesResponseBody struct {
	Data V2RatelimitListOverridesResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`

	// Pagination Pagination metadata for list endpoints. Provides information necessary to traverse through large result sets efficiently using cursor-based pagination.
	Pagination Pagination `json:"pagination"`
}

V2RatelimitListOverridesResponseBody defines model for V2RatelimitListOverridesResponseBody.

type V2RatelimitListOverridesResponseData

type V2RatelimitListOverridesResponseData = []RatelimitOverride

V2RatelimitListOverridesResponseData defines model for V2RatelimitListOverridesResponseData.

type V2RatelimitMultiLimitCheck

type V2RatelimitMultiLimitCheck struct {
	// Identifier The identifier this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits.
	Identifier string `json:"identifier"`

	// Limit The maximum number of operations allowed within the time window. This reflects either the default limit specified in the request or an override limit if one exists for this identifier.
	//
	// This value helps clients understand their total quota for the current window.
	Limit int64 `json:"limit"`

	// Namespace The namespace this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits.
	Namespace string `json:"namespace"`

	// OverrideId If a rate limit override was applied for this identifier, this field contains the ID of the override that was used. Empty when no override is in effect.
	//
	// This can be useful for:
	// - Debugging which override rule was matched
	// - Tracking the effects of specific overrides
	// - Understanding why limits differ from default values
	OverrideId string `json:"overrideId,omitempty"`

	// Passed Whether the request passed the rate limit check. If true, the request is allowed to proceed. If false, the request has exceeded the rate limit and should be blocked or rejected.
	//
	// You MUST check this field to determine if the request should proceed, as the endpoint always returns `HTTP 200` even when rate limited.
	Passed bool `json:"passed"`

	// Remaining The number of operations remaining in the current window before the rate limit is exceeded. Applications should use this value to:
	//
	// - Implement client-side throttling before hitting limits
	// - Display usage information to end users
	// - Trigger alerts when approaching limits
	// - Adjust request patterns based on available capacity
	//
	// When this reaches zero, requests will be rejected until the window resets.
	Remaining int64 `json:"remaining"`

	// Reset The Unix timestamp in milliseconds when the rate limit window will reset and 'remaining' will return to 'limit'.
	//
	// This timestamp enables clients to:
	// - Calculate and display wait times to users
	// - Implement intelligent retry mechanisms
	// - Schedule requests to resume after the reset
	// - Implement exponential backoff when needed
	//
	// The reset time is based on a sliding window from the first request in the current window.
	Reset int64 `json:"reset"`
}

V2RatelimitMultiLimitCheck defines model for V2RatelimitMultiLimitCheck.

type V2RatelimitMultiLimitRequestBody

type V2RatelimitMultiLimitRequestBody = []V2RatelimitLimitRequestBody

V2RatelimitMultiLimitRequestBody Array of rate limit checks to perform

type V2RatelimitMultiLimitResponseBody

type V2RatelimitMultiLimitResponseBody struct {
	// Data Container for multi-limit rate limit check results
	Data V2RatelimitMultiLimitResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2RatelimitMultiLimitResponseBody defines model for V2RatelimitMultiLimitResponseBody.

type V2RatelimitMultiLimitResponseData

type V2RatelimitMultiLimitResponseData struct {
	// Limits Array of individual rate limit check results, one for each rate limit check in the request
	Limits []V2RatelimitMultiLimitCheck `json:"limits"`

	// Passed Overall success indicator for all rate limit checks. This is true if ALL individual rate limit checks passed (all have success: true), and false if ANY check failed.
	//
	// Use this as a quick indicator to determine if the request should proceed.
	Passed bool `json:"passed"`
}

V2RatelimitMultiLimitResponseData Container for multi-limit rate limit check results

type V2RatelimitSetOverrideRequestBody

type V2RatelimitSetOverrideRequestBody struct {
	// Duration The duration in milliseconds for the rate limit window. This defines how long the rate limit counter accumulates before resetting to zero.
	//
	// Considerations:
	// - This can differ from the default duration for the namespace
	// - Longer durations create stricter limits that take longer to reset
	// - Shorter durations allow more frequent bursts of activity
	// - Common values: 60000 (1 minute), 3600000 (1 hour), 86400000 (1 day)
	Duration int64 `json:"duration"`

	// Identifier Identifier of the entity receiving this custom rate limit. This can be:
	//
	// - A specific user ID for individual custom limits
	// - An IP address for location-based rules
	// - An email domain for organization-wide policies
	// - Any other string that identifies the target entity
	//
	// Wildcards (*) can be used to create pattern-matching rules that apply to multiple identifiers. For example:
	// - 'premium_*' would match all identifiers starting with 'premium_'
	// - '*_admin' would match all identifiers ending with '_admin'
	// - '*suspicious*' would match any identifier containing 'suspicious'
	//
	// More detailed information on wildcard pattern rules is available at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules
	Identifier string `json:"identifier"`

	// Limit The maximum number of requests allowed for this override. This defines the custom quota for the specified identifier(s).
	//
	// Special values:
	// - Higher than default: For premium or trusted entities
	// - Lower than default: For suspicious or abusive entities
	// - 0: To completely block access (useful for ban implementation)
	//
	// This limit entirely replaces the default limit for matching identifiers.
	Limit int64 `json:"limit"`

	// Namespace The ID or name of the rate limit namespace.
	Namespace string `json:"namespace"`
}

V2RatelimitSetOverrideRequestBody Sets a new or overwrites an existing rate limit override. Overrides allow you to apply special rate limit rules to specific identifiers, providing custom limits that differ from the default.

Overrides are useful for: - Granting higher limits to premium users or trusted partners - Implementing stricter limits for suspicious or abusive users - Creating tiered access levels with different quotas - Implementing temporary rate limit adjustments - Prioritizing important clients with higher limits

type V2RatelimitSetOverrideResponseBody

type V2RatelimitSetOverrideResponseBody struct {
	Data V2RatelimitSetOverrideResponseData `json:"data"`

	// Meta Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
	Meta Meta `json:"meta"`
}

V2RatelimitSetOverrideResponseBody defines model for V2RatelimitSetOverrideResponseBody.

type V2RatelimitSetOverrideResponseData

type V2RatelimitSetOverrideResponseData struct {
	// OverrideId The unique identifier for the newly created or updated rate limit override. This ID can be used to:
	//
	// - Reference this specific override in subsequent API calls
	// - Delete or modify this override later
	// - Track which override is being applied in rate limit responses
	// - Associate override effects with specific rules in analytics
	//
	// Store this ID if you need to manage the override in the future.
	OverrideId string `json:"overrideId"`
}

V2RatelimitSetOverrideResponseData defines model for V2RatelimitSetOverrideResponseData.

type ValidationError

type ValidationError struct {
	// Fix A human-readable suggestion describing how to fix the error. This provides practical guidance on what changes would satisfy the validation requirements. Not all validation errors include fix suggestions, but when present, they offer specific remediation advice.
	Fix *string `json:"fix,omitempty"`

	// Location JSON path indicating exactly where in the request the error occurred. This helps pinpoint the problematic field or parameter. Examples include:
	// - 'body.name' (field in request body)
	// - 'body.items[3].tags' (nested array element)
	// - 'path.apiId' (path parameter)
	// - 'query.limit' (query parameter)
	// Use this location to identify exactly which part of your request needs correction.
	Location string `json:"location"`

	// Message Detailed error message explaining what validation rule was violated. This provides specific information about why the field or parameter was rejected, such as format errors, invalid values, or constraint violations.
	Message string `json:"message"`
}

ValidationError Individual validation error details. Each validation error provides precise information about what failed, where it failed, and how to fix it, enabling efficient error resolution.

type VerifyKeyRatelimitData

type VerifyKeyRatelimitData struct {
	// AutoApply Whether this rate limit should be automatically applied when verifying keys.
	// When true, we will automatically apply this limit during verification without it being explicitly listed.
	AutoApply bool `json:"autoApply"`

	// Duration Rate limit window duration in milliseconds.
	Duration int64 `json:"duration"`

	// Exceeded Whether the rate limit was exceeded.
	Exceeded bool `json:"exceeded"`

	// Id Unique identifier for this rate limit configuration.
	Id string `json:"id"`

	// Limit Maximum requests allowed within the time window.
	Limit int64 `json:"limit"`

	// Name Human-readable name for this rate limit.
	Name string `json:"name"`

	// Remaining Rate limit remaining requests within the time window.
	Remaining int64 `json:"remaining"`

	// Reset Rate limit reset duration in milliseconds.
	Reset int64 `json:"reset"`
}

VerifyKeyRatelimitData defines model for VerifyKeyRatelimitData.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL