---
canonical_url: "https://docs.composio.dev/toolkits/unkey_mcp"
markdown_url: "https://docs.composio.dev/toolkits/unkey_mcp.md"
product: "platform"
version: null
last_updated: null
---

# Unkey MCP

Unkey MCP lets agents manage API keys, identities, permissions and roles, rate limits, deployments, domains, portals and workspace settings, and query analytics and logs through Unkey's hosted MCP server.

- **Category:** model context protocol
- **Auth:** DCR_OAUTH
- **Composio-managed OAuth available?** No
- **Tools:** 102
- **Triggers:** 0
- **Slug:** `UNKEY_MCP`
- **Version:** 20261129_00

## Tools

### Unkey v2 analytics get gateway requests

**Slug:** `UNKEY_MCP_UNKEY_V2_ANALYTICS_GET_GATEWAY_REQUESTS`

A query can use only the public alias `gateway_requests_v1`. CTEs, subqueries, UNION, and EXCEPT are permitted.
The root key must have the `project.*.read_gateway_requests` permission.
Unkey limits each query to the workspace of the root key. To get the data for one project, app, or environment, add a filter on `project_id`, `app_id`, or `environment_id`.
The workspace retention period and the workspace query limits apply.
For the columns and more query examples, see the gateway request analytics documentation.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | The SQL query to run on your gateway request data. A query can use only the public alias `gateway_requests_v1`. The physical `default.*` table names are not permitted. Only SELECT queries are permitted. CTEs, subqueries, UNION, and EXCEPT are also permitted. Unkey limits each query to the workspace of the root key. To get the data for one project, app, or environment, add a filter on `project_id`, `app_id`, or `environment_id`. The workspace retention period and the workspace query limits apply.  |

### Unkey v2 analytics get ratelimits

**Slug:** `UNKEY_MCP_UNKEY_V2_ANALYTICS_GET_RATELIMITS`

Queries may reference only the five public rate limit analytics aliases: `ratelimits_v1`, `ratelimits_per_minute_v1`, `ratelimits_per_hour_v1`, `ratelimits_per_day_v1`, or `ratelimits_per_month_v1`. CTEs, subqueries, UNION, and EXCEPT are supported.
Queries are always restricted to the authenticated workspace. Wildcard analytics permission can read every namespace in that workspace; namespace-scoped permissions automatically restrict results to the permitted namespace IDs.
Workspace retention and query limits apply.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | SQL query to execute against your rate limit analytics data. Queries may reference only the five public aliases: `ratelimits_v1`, `ratelimits_per_minute_v1`, `ratelimits_per_hour_v1`, `ratelimits_per_day_v1`, or `ratelimits_per_month_v1`. Physical `default.*` table names are unsupported. CTEs, subqueries, UNION, and EXCEPT are supported. Queries are always restricted to the authenticated workspace. Wildcard analytics permission can read every namespace in that workspace; namespace-scoped permissions automatically restrict results to the permitted namespace IDs. Workspace retention and query limits apply.  |

### Unkey v2 analytics get runtime logs

**Slug:** `UNKEY_MCP_UNKEY_V2_ANALYTICS_GET_RUNTIME_LOGS`

A query can use only the public alias `runtime_logs_v1`. CTEs, subqueries, UNION, and EXCEPT are permitted.
The root key must have the `project.*.read_runtime_logs` permission.
Unkey limits each query to the workspace of the root key. To get the logs of one project, app, environment, or deployment, add a filter on `project_id`, `app_id`, `environment_id`, or `deployment_id`.
The workspace retention period and the workspace query limits apply.
For the table, the columns, and more query examples, see [Query runtime logs](https://www.unkey.com/docs/compute/observe/analytics-api).


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | The SQL query for your runtime log data. A query can use only the public alias `runtime_logs_v1`. The physical `default.*` table name is not permitted. CTEs, subqueries, UNION, and EXCEPT are permitted. Only SELECT queries are permitted. Unkey limits each query to the workspace of the root key. To get the logs of one project, app, environment, or deployment, add a filter on `project_id`, `app_id`, `environment_id`, or `deployment_id`. The workspace retention period and the workspace query limits apply.  |

### Unkey v2 analytics get verifications

**Slug:** `UNKEY_MCP_UNKEY_V2_ANALYTICS_GET_VERIFICATIONS`

Execute custom SQL queries against your key verification analytics. CTEs, subqueries, UNION, and EXCEPT are supported.
Queries must use one of the five public aliases: `key_verifications_v1`, `key_verifications_per_minute_v1`, `key_verifications_per_hour_v1`, `key_verifications_per_day_v1`, or `key_verifications_per_month_v1`. Physical `default.*` table names are unsupported.
Queries are always restricted to the authenticated workspace. Wildcard analytics permission can read every API in that workspace; API-scoped permissions automatically restrict results to the permitted APIs.
For complete documentation including available tables, columns, data types, query examples, see the schema reference in the API documentation.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | SQL query to execute against your analytics data. Queries may reference only the five public aliases: `key_verifications_v1`, `key_verifications_per_minute_v1`, `key_verifications_per_hour_v1`, `key_verifications_per_day_v1`, or `key_verifications_per_month_v1`. Physical `default.*` table names are unsupported. Only SELECT queries are allowed. CTEs, subqueries, UNION, and EXCEPT are supported.  |

### Unkey v2 apis create api

**Slug:** `UNKEY_MCP_UNKEY_V2_APIS_CREATE_API`

Create an API namespace for organizing keys by environment, service, or product.

Use this to separate production from development keys, isolate different services, or manage multiple products. Each API gets a unique identifier and dedicated infrastructure for secure key operations.

**Important**: API names must be unique within your workspace and cannot be changed after creation.

**Required Permissions**

Your root key must have one of the following permissions:
- `api.*.create_api` (to create APIs in any workspace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Human-readable name for this API within your workspace. Use descriptive names like 'Payment Service (prod)' or 'user-api-dev' to clearly identify purpose and environment.  |

### Unkey v2 apis delete api

**Slug:** `UNKEY_MCP_UNKEY_V2_APIS_DELETE_API`

Permanently delete an API namespace and immediately invalidate all associated keys.

Use this for cleaning up development environments, retiring deprecated services, or removing unused resources.
All keys in the namespace are immediately marked as deleted and will fail verification with `code=NOT_FOUND`.

**Important**: This operation is immediate and permanent. Verify you have the correct API ID before deletion.
If delete protection is enabled, disable it first through the dashboard or API configuration.

**Required Permissions**

Your root key must have one of the following permissions:
- `api.*.delete_api` (to delete any API)
- `api.<api_id>.delete_api` (to delete a specific API)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `apiId` | string | Yes | 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.  |

### Unkey v2 apis get api

**Slug:** `UNKEY_MCP_UNKEY_V2_APIS_GET_API`

Retrieve basic information about an API namespace including its ID and name.

Use this to verify an API exists before performing operations, get the human-readable name when you only have the API ID, or confirm access to a specific namespace. For detailed key information, use the `listKeys` endpoint instead.

**Required Permissions**

Your root key must have one of the following permissions:
- `api.*.read_api` (to read any API)
- `api.<api_id>.read_api` (to read a specific API)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `apiId` | string | Yes | Specifies which API to retrieve by its unique identifier. Must be a valid API ID that begins with 'api_' and exists within your workspace.  |

### Unkey v2 apis list keys

**Slug:** `UNKEY_MCP_UNKEY_V2_APIS_LIST_KEYS`

Retrieve a paginated list of API keys for dashboard and administrative interfaces.

Use this to build key management dashboards, filter keys by user with `externalId`, or retrieve key details for administrative purposes. Each key includes status, metadata, permissions, and usage limits.

**Important**: Set `decrypt: true` only in secure contexts to retrieve plaintext key values from recoverable keys.

**Required Permissions**

Your root key must have one of the following permissions for basic key listing:
- `api.*.read_key` (to read keys from any API)
- `api.<api_id>.read_key` (to read keys from a specific API)

Additionally, you need read access to the API itself:
- `api.*.read_api` or `api.<api_id>.read_api`

Additional permission required for decrypt functionality:
- `api.*.decrypt_key` or `api.<api_id>.decrypt_key`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `apiId` | string | Yes | The API namespace whose keys you want to list. Returns all keys in this API, subject to pagination and filters.  |
| `limit` | integer | No | Maximum number of keys to return per request. Balance between response size and number of pagination calls needed.  |
| `cursor` | string | No | Pagination cursor from previous response to fetch next page. Use when `hasMore: true` in previous response.  |
| `decrypt` | boolean | No | 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 |
| `externalId` | string | No | Filter keys by external ID to find keys for a specific user or entity. Must exactly match the externalId set during key creation.  |
| `revalidateKeysCache` | boolean | No | When true, reads keys and their identities from the primary database to avoid replica lag. When false or omitted, reads from a replica, which may not reflect recent changes. Primary reads can have higher latency, depending on your region. |

### Unkey v2 apps create app

**Slug:** `UNKEY_MCP_UNKEY_V2_APPS_CREATE_APP`

Create an app within a project. The app is created with default `production` and `preview` environments.

Set exactly one source. Use `git` to create a GitHub-sourced app and connect its repository. Use `oci` to create an app from a prebuilt OCI image.

The slug you provide is the stable, caller-defined handle used to reference this app. It must be unique within the project.

**Important**: The slug cannot collide with an existing app in the same project. A duplicate slug returns a 409 conflict.

**Required Permissions**

Your root key must have one of the following permissions:
- `project.*.create_app` (to create apps in any project)
- `project.<project_id>.create_app` (to create apps in a specific project)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `git` | object | No | Configure Git as the app source. Provide `repository` to connect it during creation, or use an empty object to connect a repository later.  |
| `oci` | object | No | An app's OCI image source. |
| `name` | string | Yes | Human-readable name for this app. |
| `slug` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 apps delete app

**Slug:** `UNKEY_MCP_UNKEY_V2_APPS_DELETE_APP`

Delete an existing app, identified by its id.

Deletion is asynchronous and eventually consistent. The app and all of its associated resources (environments, deployments, custom domains) are torn down by a background workflow. A successful response indicates the deletion was enqueued, not that every resource has already been removed.

Apps with delete protection enabled cannot be deleted until protection is disabled.

**Required Permissions**

Your root key must have one of the following permissions:
- `app.*.delete_app` (to delete any app)
- `app.<app_id>.delete_app` (to delete a specific app)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 apps get app

**Slug:** `UNKEY_MCP_UNKEY_V2_APPS_GET_APP`

Retrieve a single app by its id or slug within a project.

Use this to fetch app details after creation or to verify an app exists before performing operations.

**Required Permissions**

Your root key must have one of the following permissions:
- `app.*.read_app` (to read any app)
- `app.<app_id>.read_app` (to read a specific app)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 apps list apps

**Slug:** `UNKEY_MCP_UNKEY_V2_APPS_LIST_APPS`

Retrieve a paginated list of apps within a project.

Use this to enumerate every app in a project. Results are ordered by app id and paginated; when `hasMore` is true, pass the returned `cursor` to fetch the next page.

**Required Permissions**

Your root key must have the following permission:
- `app.*.read_app` (to read apps in any project)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of apps to return per request. Balance between response size and number of pagination calls needed.  |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response.  |
| `search` | string | No | Free-form text to filter apps. Returns apps whose ID, name, or slug contains the search string. Matching is case-insensitive. |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 apps update app

**Slug:** `UNKEY_MCP_UNKEY_V2_APPS_UPDATE_APP`

Update an existing app, identified by its id.

The app name, slug, default branch, and delete protection setting can be changed. Omitted fields are left unchanged. Changing the slug affects the deployment domains generated for this app.

**Important**: The slug cannot collide with an existing app in the same project. A duplicate slug returns a 409 conflict.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>#write` (to update a specific app)
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/*#write` (to update any app in a project)
- `unkey:v1:<workspace_id>:projects/*/apps/*#write` (to update any app in your workspace)

The same app write permission covers Git repository changes.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `git` | string | No | Connect, reconfigure, or disconnect this app's GitHub repository. Omit to leave unchanged, set null to disconnect, or set an object with a "repository" to connect or replace it and/or a "defaultBranch" to set which branch it tracks. Fields are independent, so send only the one you change.  |
| `oci` | string | No | Change the default image reference for an OCI-sourced app. This does not create a deployment. It can be combined with other app settings. Source switching is not supported.  |
| `name` | string | No | New human-readable name for the app. Omit this field to leave the current name unchanged.  |
| `slug` | string | No | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `deleteProtection` | boolean | No | Enable or disable delete protection for the app. Omit this field to leave the current setting unchanged.  |

### Unkey v2 deployments authorize deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_AUTHORIZE_DEPLOYMENT`

Authorize a deployment that is awaiting approval. Deployments from forked
pull requests run code from outside your repository, so they wait for a
project member to approve them before they build.

The deployment must have the status `awaiting_approval`. Authorization is
asynchronous: this endpoint only enqueues it and returns immediately. The
deployment then moves to `pending` and starts its build. Poll
`getDeployment` to follow its status. If the build cannot start, the
deployment returns to `awaiting_approval`.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments cancel deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_CANCEL_DEPLOYMENT`

Cancel a deployment that has not finished yet: queued, waiting for
approval, building, or deploying. Cancelling aborts its run and marks it
`cancelled`.

Only in-progress deployments can be cancelled. To take a `ready` preview
deployment offline, use `stopDeployment` instead.

Cancellation is asynchronous: this endpoint only enqueues it and returns
immediately. Poll `getDeployment` until the status reaches `cancelled`.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments create deployment v3

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_CREATE_DEPLOYMENT_V3`

Create a deployment for an app in a project.

Omit the source to use the app's configured default. A Git app builds its default branch. An OCI app deploys its default image.

Optionally provide one source override:
- `oci`: deploy a prebuilt OCI image without a build. Mutable tags are resolved to immutable digests before rollout.
- `git`: build and deploy from the app's connected GitHub repository, a branch, a specific commit, or a fork commit. Requires the app to have a repository connected.
- `deployment`: re-run an existing deployment by its id. Git deployments rebuild from the recorded commit; OCI deployments reuse the recorded resolved image.

Returns immediately with a `deploymentId`. The build and rollout run asynchronously. Poll `deployments.getDeployment` to watch status until it is ready.

**Authentication**: requires a root key with `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/*#write`. Wildcards can replace resource IDs to grant access across a wider scope.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `git` | object | No | Build from the app's connected GitHub repository. |
| `oci` | object | No | Deploy a prebuilt OCI image without a build. |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `deployment` | object | No | Re-run an existing deployment. |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments get deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_GET_DEPLOYMENT`

Retrieve a single deployment by its id.

Use this to check a deployment's status after creating it, or to inspect the
runtime configuration of an existing deployment.

**Required Permissions**

Your root key must have this permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>#read`
  (use `*` for any level)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments list build logs

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_LIST_BUILD_LOGS`

Retrieve the build output of a deployment as a list of log entries, in the
order the build printed them. A log entry is one chunk of build output,
and can contain several lines or part of a line.

Poll this endpoint to follow a running build:

- Send the `pagination.cursor` of the last response as `cursor`. The
  response contains only the entries after it.
- When `hasMore` is true, request again now.
- When `hasMore` is false, you have all entries so far. Wait,
  then request again with the same cursor.
- The cursor is absent only when the request had no cursor and the build
  has no entries yet.
- A response can contain fewer than `limit` entries and still have
  `hasMore: true` when the entries are large.

New entries become visible up to a few seconds after the build prints
them. To know that a build is done, check the deployment status with
`getDeployment`. After the status is no longer `building`, request until
you get an empty response at least 5 seconds later.

When a build attempt is retried, an entry from the earlier attempt can
arrive after the cursor has moved past it, and a poll does not return it.
A request without a cursor returns it. A deployment from a prebuilt image
has no build and returns no entries. Build logs are kept for 3 months.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>/buildLogs#read`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of log entries to return. A response can contain fewer entries and still have `hasMore: true` when the entries are large.  |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the entries after it. Omit it to start at the first entry of the build.  |
| `stepId` | string | No | Return only the log entries of this build step. Use the `stepId` of an entry from a previous response. An unknown step returns no entries. Omit this field to return the entries of every step.  |
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments list deployments

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_LIST_DEPLOYMENTS`

Retrieve a paginated list of deployments within a workspace, newest first.

Filter by project, app, environment, lifecycle status, git branch, and
creation time. All filters are optional; with none set, every deployment in
the workspace is returned. Filters nest: `app` requires `project`, and
`environment` and `branch` require both `project` and `app`. Results are
paginated; when `hasMore` is true, pass the returned `cursor` to fetch the
next page.

**Required Permissions**

Your root key must have this permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/*#read`
  (use `*` for every level you do not filter by)

The permission must cover every deployment the filters select: a grant on
one environment is not sufficient for a request that spans more than that
environment.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | No | Restrict results to a single app, identified by its ID or slug. Requires `project` to also be set.  |
| `limit` | integer | No | Maximum number of deployments to return per request. Balance between response size and number of pagination calls needed.  |
| `branch` | array | No | Restrict results to deployments built from any of the given git branches. Requires `project` and `app` to also be set. Omit or pass an empty list to return deployments from every branch.  |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response.  |
| `status` | array | No | Restrict results to deployments in any of the given lifecycle statuses. Omit to return deployments in every status.  |
| `endTime` | integer | No | Return only deployments created before this unix timestamp in milliseconds (exclusive). Must be later than `startTime` when both are set.  |
| `project` | string | No | Restrict results to a single project, identified by its ID or slug. Required when filtering by `app`, `environment`, or `branch`.  |
| `startTime` | integer | No | Return only deployments created at or after this unix timestamp in milliseconds (inclusive).  |
| `environment` | string | No | Restrict results to a single environment, identified by its ID or slug. Requires `project` and `app` to also be set.  |

### Unkey v2 deployments promote deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_PROMOTE_DEPLOYMENT`

Promote a deployment to become the current deployment for its environment.
All sticky domains are reassigned from the current deployment to the
promoted one, and the previous deployment is scheduled for standby.

The deployment must be ready, not already shutting down, belong to the
production environment, and its app must already have a current deployment.
Promoting the deployment that is already current fails, unless the app is in
a rolled-back state, in which case promoting the current deployment
confirms the rollback and re-enables automatic promotion of future
deployments.

Promotion runs as a durable workflow: this endpoint returns once the
promotion is accepted. Poll `getDeployment` or `listDeployments` to observe
the result.

**Required Permissions**

Your root key must have write permission on the environment:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 deployments rollback deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_ROLLBACK_DEPLOYMENT`

Roll live traffic back to a previous deployment. `deploymentId` is the
deployment to roll back TO; the app's current deployment is used as
the rollback source automatically.

The target deployment must be ready, not already shutting down, belong to
the production environment, and must not itself be the current deployment.

After a rollback the app is marked as rolled back, which prevents new
deployments from automatically taking over live traffic. Promote the
rolled-back deployment (or a newer one) to clear this state.

Rollback runs as a durable workflow: this endpoint returns once the
rollback is accepted. Poll `getDeployment` or `listDeployments` to observe
the result.

**Required Permissions**

Your root key must have write permission on the environment:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | The deployment to roll back TO. Its app's current deployment is used as the rollback source automatically.  |

### Unkey v2 deployments start deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_START_DEPLOYMENT`

Start a deployment that was previously stopped with `stopDeployment`, so it
serves traffic again. The deployment keeps the configuration it had when it
was stopped; nothing is rebuilt or redeployed.

The deployment must currently be stopped, and must belong to a
non-production environment. Production deployments are never stopped, so
they cannot be started.

Starting is asynchronous: this endpoint only enqueues the start and returns
immediately. Poll `getDeployment` until the status reaches `ready`.

**Required Permissions**

Your root key must have write permission on the deployment:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | The stopped deployment to start. |

### Unkey v2 deployments stop deployment

**Slug:** `UNKEY_MCP_UNKEY_V2_DEPLOYMENTS_STOP_DEPLOYMENT`

Stop a running deployment that is not the app's live production deployment.
Stopped deployments keep their configuration. Preview deployments can be
resumed later with `startDeployment`.

The deployment must be ready and running. Previous production deployments
can be stopped, but stopping one removes instant rollback to it.
A deployment that is already draining from a previous stop is rejected
with a precondition error.

Stopping is asynchronous: this endpoint only enqueues the stop and returns
immediately. Poll `getDeployment` until the status reaches `stopped`.

**Required Permissions**

Your root key must have write permission on the deployment:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/deployments/<deployment_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `deploymentId` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 domains create domain

**Slug:** `UNKEY_MCP_UNKEY_V2_DOMAINS_CREATE_DOMAIN`

Attach a custom domain to an environment and start verifying it.

The domain is created in the `pending` state and does not serve traffic until verification succeeds. Verification runs in the background and polls DNS, so it is eventually consistent.

The response returns `dnsRecords`: every record needed to finish setup, already resolved for whether this domain is an apex or a subdomain. Create every entry exactly as given. One record establishes routing and one proves ownership, and both are needed: whether ownership can be inferred from the routing record depends on how your provider publishes it, and a name another workspace has already verified can only be claimed through the ownership record. Neither is knowable before the records exist.

When your DNS provider supports Domain Connect, the response also carries a `domainConnect` object; opening its `url` applies the same records at the provider in one step. The object is absent when the shortcut is unavailable.

Domains are unique per workspace, so the same name cannot be attached to two environments. Attaching a domain that already exists in your workspace returns a 409 conflict.

How many domains you may attach is set by your plan. Attaching one beyond that allowance returns a 403; upgrade the plan or remove a domain you no longer need.

**Important**: verification stops after 24 hours without the required DNS records, and the domain moves to `failed`.

**Required Permissions**

Your root key must have one of the following permissions:
- `environment.*.create_domain` (to attach domains to any environment)
- `environment.<environment_id>.create_domain` (to attach domains to a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `domain` | string | Yes | Fully qualified domain name to attach to the environment, without a scheme, port, or path. Must be unique across your entire workspace: the same name cannot be attached to two environments.  The name must sit under a registrable domain: 'api.acme.co.uk' is accepted, the public suffix 'co.uk' itself is not. Internationalized names may be sent in Unicode or Punycode form; either way the domain is stored and returned in its canonical form, lowercase ASCII with Unicode labels Punycode encoded, and the DNS records in the response use that form.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 domains delete domain

**Slug:** `UNKEY_MCP_UNKEY_V2_DOMAINS_DELETE_DOMAIN`

Delete a custom domain from your workspace.

Address the domain by its id or by its name. Names are unique per workspace, so
`api.acme.com` is enough.

Unkey stops serving the domain. Later requests fail with a certificate error. The DNS
records at your provider stay in place.

**Required Permissions**

Your root key must have `delete` permission on the domain:
`unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/domains/<domain_id>#delete`.
Use `*` in place of resource IDs to grant access to all matching domains in your workspace.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `domain` | string | Yes | Identifies a domain by its Unkey ID or by its name. Pass a 'dom_'-prefixed ID, or a fully qualified domain name such as 'api.acme.com' without a scheme, port, or path. You can give an internationalized name in Unicode or Punycode form. Both forms address the same domain.  Domain names are unique per workspace, so the name alone addresses the domain. You do not need to supply a project, app, or environment.  |

### Unkey v2 domains get domain

**Slug:** `UNKEY_MCP_UNKEY_V2_DOMAINS_GET_DOMAIN`

Retrieve a custom domain and its verification status.

Address the domain by its id or by its name. Names are unique per workspace, so
`api.acme.com` is sufficient. You do not need to supply a project, app, or environment.

Use this endpoint to poll after `domains.createDomain`. Verification runs in the background
and checks DNS approximately each minute.

`status: verified` means the domain is verified. Unkey has configured routing and requested a
certificate. Each entry in `dnsRecords` has a `verified` flag. The flag shows which records
Unkey has read back, so you can see which records are still missing. Some providers hide a
record from DNS lookups, for example a proxied or flattened routing record. Such a record stays
`false` while it serves traffic. `verificationError` gives the reason for the last failed
attempt.

`dnsRecords` contains the same values that `domains.createDomain` returned. Use it to recover
the values without creating the domain again.

**Important**: verification stops 24 hours after the domain was created, and the status becomes
`failed`. The window starts at `createdAt`, not at the last attempt.

**Required Permissions**

Your root key must have one of the following permissions:
- `environment.*.read_domain` (to read domains in any environment)
- `environment.<environment_id>.read_domain` (to read domains in a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `domain` | string | Yes | Identifies a domain by its Unkey ID or by its name. Pass a 'dom_'-prefixed ID, or a fully qualified domain name such as 'api.acme.com' without a scheme, port, or path. You can give an internationalized name in Unicode or Punycode form. Both forms address the same domain.  Domain names are unique per workspace, so the name alone addresses the domain. You do not need to supply a project, app, or environment.  |

### Unkey v2 domains list domains

**Slug:** `UNKEY_MCP_UNKEY_V2_DOMAINS_LIST_DOMAINS`

List your custom domains with their verification status and DNS records.
Filter by project, app, or environment using IDs or slugs, or send `{}` to list
domains across your workspace.

Use any filter on its own or combine filters to narrow the results.
Results match all supplied filters. Omitting `environment` includes all matching environments.

Results include only domains you have permission to read, sorted by ID.
When `hasMore` is true, send the returned `cursor` to get the next page.

`status: verified` means the domain is verified. Unkey has configured routing and requested a
certificate. Each domain includes its full `dnsRecords`. Each record has a `verified` flag.
The flag shows which records Unkey has read back, so you can see which records are still
missing without a second call. Some providers hide a record from DNS lookups, for example a
proxied or flattened routing record. Such a record stays `false` while it serves traffic.

**Required Permissions**

Use a root key with the `environment.*.read_domain` permission.
A successful request returns an empty list if no matching domains are readable by your key.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | No | Match domains whose app ID or slug equals this value. This filter does not require a project or environment filter.  |
| `limit` | integer | No | The maximum number of domains one response contains. A small limit makes the response smaller, but makes more requests necessary.  |
| `cursor` | string | No | The pagination cursor from the response that came before. Send it to get the next page when that response has `hasMore: true`.  |
| `search` | string | No | Free-form text to filter domains. Returns domains whose ID or name contains the search string. Matching is case-insensitive. |
| `project` | string | No | Match domains whose project ID or slug equals this value. This filter does not require an app or environment filter.  |
| `environment` | string | No | Match domains whose environment ID or slug equals this value. This filter does not require a project or app filter.  |

### Unkey v2 domains verify domain

**Slug:** `UNKEY_MCP_UNKEY_V2_DOMAINS_VERIFY_DOMAIN`

Restart verification for a custom domain.

Address the domain by its ID or by its name. Names are unique per workspace, so
`api.acme.com` is enough.

Call this after you correct the DNS records of a domain that shows `failed`, or to give a
`pending` domain a new 24-hour verification period. The domain goes back to `pending` and
the 24-hour period starts again.

The endpoint returns when Unkey accepts the retry. Poll `domains.getDomain` for the result.

A domain that is already `verified` returns a 412.

**Required Permissions**

Your root key must have `write` on the domain:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/domains/<domain_id>#write`
- `unkey:v1:<workspace_id>:projects/*/apps/*/environments/*/domains/*#write` (all domains in your workspace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `domain` | string | Yes | Identifies a domain by its name or by its ID. Send the fully qualified domain name, such as 'api.acme.com', without a scheme, port, or path, or send the domain ID that domains.createDomain returns. You can send an internationalized name in Unicode or in Punycode form. Both forms address the same domain.  |

### Unkey v2 environments get environment

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_GET_ENVIRONMENT`

Retrieve a single environment by its id.

Use this to fetch environment details after creation or to verify an environment exists before performing operations.

**Required Permissions**

Your root key must have one of the following permissions:
- `environment.*.read_environment` (to read any environment)
- `environment.<environment_id>.read_environment` (to read a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 environments list environments

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_LIST_ENVIRONMENTS`

Retrieve the environments within an app.

Use this to enumerate every environment in an app. Identify the app by its project slug and app slug. Results are ordered by environment id. An app has only a handful of environments, so all of them are returned in a single response.

**Required Permissions**

Your root key must have the following permission:
- `environment.*.read_environment` (to read environments in any app)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 environments list environment variables

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_LIST_ENVIRONMENT_VARIABLES`

Retrieve the environment variables for an environment.

Identify the environment by its project, app, and environment identifiers.
Results are ordered by variable id and paginated; when `hasMore` is true,
pass the returned `cursor` to fetch the next page.

`recoverable` variables are returned with their decrypted plaintext value.
`writeonly` variables never expose a value: only the key, kind, and
description are returned.

**Required Permissions**

Your root key must have one of the following permissions:
- `environment.*.read_environment_variables` (for any environment)
- `environment.<environment_id>.read_environment_variables` (for a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `limit` | integer | No | Maximum number of variables to return per request. |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 environments remove environment variables

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_REMOVE_ENVIRONMENT_VARIABLES`

Remove environment variables from an environment in a single atomic request.

This operation only deletes keys by name. Keys in the payload that exist are
removed; keys that are not present are ignored, since their absence already
matches the requested state. To replace or update values, use
`setEnvironmentVariables` instead. The whole operation is atomic: if any part
fails the environment is left unchanged.

Duplicate keys in the payload collapse to a single removal. Values are never
read or returned.

**Required Permissions**

Your root key must have `delete` permission on the environment's variable collection:
`unkey:v1:{workspace_id}:projects/{project_id}/apps/{app_id}/environments/{environment_id}/variables/*#delete`.

Replace the placeholders with resource IDs, not names or slugs. A broader
permission that covers this collection also grants access.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `variables` | array | Yes | 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.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 environments set environment variables

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_SET_ENVIRONMENT_VARIABLES`

Create or update environment variables for an environment in a single atomic
request.

By default this is an upsert: each variable in the payload is created if new
or fully overwritten if the key already exists, and any variable not in the
payload is left untouched. This lets you change one variable without
re-sending the others, which matters for write-only secrets you can no longer
read back.

Set `prune: true` to make it a full replace instead: after upserting, every
variable not in the payload is deleted. Sending `prune: true` with an empty
`variables` list resets the environment by deleting every variable.

Each variable is written exactly as sent, never merged, so omitted optional
fields fall back to their defaults rather than the previous value. Values are
always encrypted at rest. Set `kind: recoverable` to allow a value to be read
back; it defaults to `writeonly`, which can never be read back through the API.

**Required Permissions**

Your root key must have `write` on the environment's variable collection:
`unkey:v1:{workspace_id}:projects/{project_id}/apps/{app_id}/environments/{environment_id}/variables/*#write`.

When `prune` is true, it must also have `delete` on the same collection:
`unkey:v1:{workspace_id}:projects/{project_id}/apps/{app_id}/environments/{environment_id}/variables/*#delete`.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `prune` | boolean | No | 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. |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `variables` | array | Yes | 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.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 environments update settings

**Slug:** `UNKEY_MCP_UNKEY_V2_ENVIRONMENTS_UPDATE_SETTINGS`

Update the build, runtime, and regional settings for an environment.

All settings fields are optional. Omit a field to leave it unchanged. For
nullable fields (`dockerfile`, `healthcheck`, `openapiSpecPath`), send null
to clear the value. When `regions` is present it replaces the full set of
regions for the environment.

**Required Permissions**

Your root key must have `#write` permission on the environment, for example:
- `unkey:v1:<workspace_id>:projects/*/apps/*/environments/*#write` (any environment in your workspace)
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>#write` (a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `port` | integer | No | Container port the app listens on. Omit to leave unchanged.  |
| `vCpus` | number | No | 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.  |
| `command` | array | No | Override container entrypoint command. Omit to leave unchanged.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `regions` | array | No | 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.  |
| `memoryMib` | integer | No | 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.  |
| `autoDeploy` | boolean | No | Whether pushes auto-deploy. Omit to leave unchanged.  |
| `dockerfile` | string | No | Path to the Dockerfile used for builds. Omit to leave unchanged; set null to clear and fall back to Railpack.  |
| `storageMib` | integer | No | 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.  |
| `watchPaths` | array | No | Glob patterns that trigger auto-deploys when matching files change. Do not start a pattern with "/" or "./". Use "src/**" for everything under a directory and "**/*.go" for a file type. A pattern with no wildcard matches only that exact file, so "src" is not "src/**". Omit to leave unchanged. Invalid patterns are rejected with a 400.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `healthcheck` | string | No | HTTP healthcheck configuration. Omit to leave unchanged; set null to remove.  |
| `buildCommand` | string | No | Overrides the build command auto-detected by Railpack. Omit to leave unchanged; set null to clear and fall back to auto-detection.  |
| `rootDirectory` | string | No | 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.  |
| `shutdownSignal` | string ("SIGTERM" | "SIGINT" | "SIGQUIT" | "SIGKILL") | No | Signal sent to the container on shutdown. Omit to leave unchanged.  |
| `openapiSpecPath` | string | No | Path to the OpenAPI spec file within the build. Must start with a slash. Omit to leave unchanged; set null to clear.  |
| `upstreamProtocol` | string ("http1" | "h2c") | No | Protocol used to reach the upstream container. Omit to leave unchanged.  |

### Unkey v2 gateway list policies

**Slug:** `UNKEY_MCP_UNKEY_V2_GATEWAY_LIST_POLICIES`

Retrieve an environment's gateway policies in evaluation order: the
gateway evaluates them top to bottom and the first rejection
short-circuits the request.

The full policy list is returned in a single response.

**Required Permissions**

Your root key must have one of the following permissions:
- `environment.*.read_policies` (for any environment)
- `environment.<environment_id>.read_policies` (for a specific environment)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 gateway set policies

**Slug:** `UNKEY_MCP_UNKEY_V2_GATEWAY_SET_POLICIES`

Replace an environment's gateway policies in a single atomic request.
Policies run at the edge before requests reach your app: verify API keys,
rate limit, block requests outright, or validate them against your
OpenAPI spec.

Policies are an ordered list: the gateway evaluates them top to bottom
and the first rejection short-circuits the request.

Each policy sets exactly one of `keyauth`, `ratelimit`, `firewall` or
`openapi`, plus optional `match` expressions restricting which requests
it applies to.

Every call is a full replace: the environment's policies become exactly
the request list in the given order, and the server generates a fresh id
for each one. An empty list removes all policies. The operation is
atomic: if any policy is invalid, nothing is written.

**Required Permissions**

Your root key must have both permissions on the target environment's gateway policies:
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/gateway/policies/*#write`
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/gateway/policies/*#delete`

Replace the placeholders with resource IDs. Wildcard grants can cover multiple
resources, but access remains limited to the root key's workspace.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `policies` | array | Yes | 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. |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 gateway update policy

**Slug:** `UNKEY_MCP_UNKEY_V2_GATEWAY_UPDATE_POLICY`

Update a single policy in place without resending the environment's full
policy list. The policy keeps its id and its position in the evaluation
order, and all other policies are untouched.

Omitted fields keep their stored values; at least one updatable field
must be provided. Setting `match` to null removes all match expressions
so the policy applies to every request. Providing one of `keyauth`,
`ratelimit`, `firewall` or `openapi` replaces the policy's rule
entirely, including switching its type; at most one may be set.

Policy ids are regenerated whenever `gateway.setPolicies` replaces the
list, so fetch current ids via `gateway.listPolicies` first.

**Required Permissions**

Your root key must have `write` permission on the policy:
`unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>/environments/<environment_id>/gateway/policies/<policy_id>#write`.
Use `*` in place of a resource ID to grant access to all resources at that level.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `app` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `name` | string | No | New human-readable name. Omit to keep the current name. |
| `match` | string | No | Replaces all match expressions. Set null to remove them so the policy applies to every request. Omit to keep the current expressions. |
| `enabled` | boolean | No | Enable or disable the policy. Disabled policies are stored but skipped during evaluation. Omit to keep the current setting. |
| `keyauth` | object | No | Verifies Unkey API keys on matching requests. |
| `logging` | object | No | Adds request data to the log entries of matching requests. The gateway always records a basic log entry for every request: method, host, path, status, and latency. Each capture setting is a separate opt-in: request headers, response headers, request body, response body, and query data. The policy's `match` expressions select the requests. A policy without `match` expressions matches every request. If more than one enabled logging policy matches a request, the gateway combines their settings. The gateway always redacts the `Authorization` header and configured key locations before it stores headers or query data. |
| `openapi` | object | No | 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. |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `firewall` | object | No | Blocks matching requests. |
| `policyId` | string | Yes | 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. |
| `ratelimit` | object | No | Rate limits matching requests. Set `identifiers` with 1 to 5 sources. The deprecated `identifier` field is accepted in place of a one-entry `identifiers` list; set exactly one of the two. |
| `environment` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 github install app

**Slug:** `UNKEY_MCP_UNKEY_V2_GITHUB_INSTALL_APP`

Start installing the Unkey GitHub App for your workspace. Returns a GitHub
App install URL: open it in a browser to install the app and grant
repository access. After installation GitHub returns to Unkey, which binds
the installation to your workspace and lands you in the workspace settings.

Installation is workspace-wide and takes no parameters. Once installed, link
repositories to individual apps with the `git` field on `apps.createApp` and
`apps.updateApp`.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:github/apps/*#write`

Replace `<workspace_id>` with the authenticated workspace ID.


### Unkey v2 identities create identity

**Slug:** `UNKEY_MCP_UNKEY_V2_IDENTITIES_CREATE_IDENTITY`

Create an identity to group multiple API keys under a single entity. Identities enable shared rate limits and metadata across all associated keys.

Perfect for users with multiple devices, organizations with multiple API keys, or when you need unified rate limiting across different services.

**Important**
Requires `unkey:v1:<workspaceId>:projects/<projectId>/identities/*#write` for the workspace's default project.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `meta` | object | No | 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.  |
| `externalId` | string | Yes | 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.  |
| `ratelimits` | array | No | 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.  |

### Unkey v2 identities delete identity

**Slug:** `UNKEY_MCP_UNKEY_V2_IDENTITIES_DELETE_IDENTITY`

Permanently delete an identity. This operation cannot be undone.

Use this for data cleanup, compliance requirements, or when removing entities from your system.

> **Important**
> Requires `identity.*.delete_identity` permission
> Associated API keys remain functional but lose shared resources
> External ID becomes available for reuse immediately


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `identity` | string | Yes | 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). |

### Unkey v2 identities get identity

**Slug:** `UNKEY_MCP_UNKEY_V2_IDENTITIES_GET_IDENTITY`

Retrieve an identity by external ID. Returns metadata, rate limits, and other associated data.

Use this to check if an identity exists, view configurations, or build management dashboards.

> **Important**
> Requires `identity.*.read_identity` permission


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `identity` | string | Yes | 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). |

### Unkey v2 identities list identities

**Slug:** `UNKEY_MCP_UNKEY_V2_IDENTITIES_LIST_IDENTITIES`

Get a paginated list of all identities in your workspace. Returns metadata and rate limit configurations.

Perfect for building management dashboards, auditing configurations, or browsing your identities.

> **Important**
> Requires `identity.*.read_identity` permission


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | The maximum number of identities to return in a single request. Use this to control response size and loading performance. |
| `cursor` | string | No | Pagination cursor from a previous response. Use this to fetch subsequent pages of results when the response contains a cursor value. |
| `search` | string | No | Free-form text to filter identities. Returns identities whose ID or external ID contains the search string. Matching is case-insensitive. |

### Unkey v2 identities update identity

**Slug:** `UNKEY_MCP_UNKEY_V2_IDENTITIES_UPDATE_IDENTITY`

Update an identity's metadata and rate limits. Only specified fields are modified - others remain unchanged.

Perfect for subscription changes, plan upgrades, or updating user information. Changes take effect immediately.

> **Important**
> Requires `unkey:v1:{workspaceId}:projects/{projectId}/identities/{identityId}#write` permission for the identity
> Rate limit changes propagate within 30 seconds


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `meta` | object | No | 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.  |
| `identity` | string | Yes | 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). |
| `ratelimits` | array | No | 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.  |

### Unkey v2 keys add permissions

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_ADD_PERMISSIONS`

Add permissions to a key without affecting existing permissions.

Use this for privilege upgrades, enabling new features, or plan changes that grant additional capabilities. Permissions granted through roles remain unchanged.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have `write` on `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>`.

To create missing permission slugs, it must also have `write` on `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*`.
Adding existing permissions does not require this additional grant.

**Side Effects**

Invalidates the key cache for immediate effect, and makes permissions available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `permissions` | array | Yes | 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.  To create missing permission slugs, your root key must also have `write` on `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*` in the key's project. Without this grant, the operation fails with a 403 error if your root key can read the key, or a 404 error otherwise.  |

### Unkey v2 keys add roles

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_ADD_ROLES`

Add roles to a key without affecting existing roles or permissions.

Use this for privilege upgrades, enabling new feature sets, or subscription changes that grant additional role-based capabilities. Direct permissions remain unchanged.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write` for the target key. Wildcard grants that cover this resource and action also work.

**Side Effects**

Invalidates the key cache for immediate effect, and makes role assignments available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `roles` | array | Yes | 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.  |

### Unkey v2 keys create key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_CREATE_KEY`

Create a new API key for user authentication and authorization.

Use this endpoint when users sign up, upgrade subscription tiers, or need additional keys. Keys are cryptographically secure and unique to the specified API namespace.

**Important**: Store the returned key securely. Unless you create a recoverable key, the plaintext cannot be retrieved later. Recoverable keys require key encryption and permission to decrypt them.

**Common use cases:**
- Generate keys for new user registrations
- Create additional keys for different applications
- Issue keys with specific permissions or limits

**Required Permissions**

Your credential needs `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#write` for the target keyspace. Use the keyspace's project ID, not the API's project ID if they differ. A grant with wildcard project or keyspace segments can cover multiple keyspaces in the authorized workspace.

Recoverable keys use the same write permission. They also require the keyspace to support key encryption.

Without write permission, this endpoint returns 404 to hide whether the API exists. If your credential can read the keyspace, it returns 403 and names the missing write permission instead.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `meta` | object | No | 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.  |
| `name` | string | No | 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.  |
| `apiId` | string | Yes | The API namespace this key belongs to. Keys from different APIs cannot access each other.  |
| `roles` | array | No | 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.  |
| `prefix` | string | No | 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.  |
| `credits` | object | No | Controls usage-based limits through credit consumption with optional automatic refills. Unlike rate limits which control frequency, credits control total usage with global consistency. Essential for implementing usage-based pricing, subscription tiers, and hard usage quotas. Omitting this field creates unlimited usage, while setting null is not allowed during creation.  |
| `enabled` | boolean | No | 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.  |
| `expires` | integer | No | 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.  |
| `byteLength` | integer | No | 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.  |
| `externalId` | string | No | 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.  |
| `ratelimits` | array | No | 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.  |
| `permissions` | array | No | Grants specific permissions directly to this key without requiring role membership. Each entry is a permission ID or slug. IDs are matched first, then slugs. An entry that matches no permission creates a permission with that slug. 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.  |
| `recoverable` | boolean | No | 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.  |

### Unkey v2 keys delete key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_DELETE_KEY`

Delete API keys from user accounts or for cleanup purposes.

Use this for user-requested key revocation, account deletion workflows, or cleaning up unused keys. Keys are immediately invalidated. Two modes: soft delete (default, preserves audit records) and permanent delete.

**Important**: For temporary access control, use `updateKey` with `enabled: false` instead of deletion.

**Required Permissions**

Your credential must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*/keyspaces/*/keys/*#delete` (to delete keys in any project)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/*/keys/*#delete` (to delete keys in a specific project)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#delete` (to delete keys in a specific keyspace)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#delete` (to delete a specific key)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `permanent` | boolean | No | 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.  |

### Unkey v2 keys get key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_GET_KEY`

Retrieve detailed key information for dashboard interfaces and administrative purposes.

Use this to build key management dashboards showing users their key details, status, permissions, and usage data. You can identify keys by `keyId` or the actual key string.

**Important**: Set `decrypt: true` only in secure contexts to retrieve plaintext key values from recoverable keys.

**Required Permissions**

Your credential must have one of the following permissions for basic key information:
- `api.*.read_key` (to read keys from any API)
- `api.<api_id>.read_key` (to read keys from a specific API)
- `unkey:v1:<workspace_id>:keyspaces/*/keys/*#read_key` (to read keys in any keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/*#read_key` (to read keys in a specific keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/<key_id>#read_key` (to read a specific key)

Additional permission required for decrypt functionality:
- `api.*.decrypt_key` or `api.<api_id>.decrypt_key`
- `unkey:v1:<workspace_id>:keyspaces/*/keys/*#decrypt_key`
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/*#decrypt_key`
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/<key_id>#decrypt_key`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `decrypt` | boolean | No | 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.  |

### Unkey v2 keys migrate keys

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_MIGRATE_KEYS`

Returns HTTP 200 even on partial success; hashes that could not be migrated are listed under `data.failed`.

**Required Permissions**
Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#write` for the target keyspace in its project and workspace.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keys` | array | Yes |  |
| `apiId` | string | Yes | The ID of the API that the keys should be inserted into |
| `migrationId` | string | Yes | Identifier of the configured migration provider/strategy to use (e.g., "your_company"). You will receive this from Unkey's support staff. |

### Unkey v2 keys remove permissions

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_REMOVE_PERMISSIONS`

Remove permissions from a key without affecting existing roles or other permissions.

Use this for privilege downgrades, removing temporary access, or plan changes that revoke specific capabilities. Permissions granted through roles remain unchanged.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write` for the target key. Wildcard grants that include the target key also authorize this operation.

**Side Effects**

Invalidates the key cache for immediate effect, and makes permission changes available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `permissions` | array | Yes | 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.  |

### Unkey v2 keys remove roles

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_REMOVE_ROLES`

Remove roles from a key without affecting direct permissions or other roles.

Use this for privilege downgrades, removing temporary access, or subscription changes that revoke specific role-based capabilities. Direct permissions remain unchanged.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have the following permission for the target key:
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write`

**Side Effects**

Invalidates the key cache for immediate effect, and makes role changes available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `roles` | array | Yes | 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.  |

### Unkey v2 keys reroll key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_REROLL_KEY`

Generate a new API key while preserving the configuration from an existing key.

This operation creates a fresh key with a new token while maintaining all settings from the original key:
- Permissions and roles
- Custom metadata
- Rate limit configurations
- Identity associations
- Remaining credits
- Recovery settings

**Key Generation:**
- The system attempts to extract the prefix from the original key
- If prefix extraction fails, the default API prefix is used
- Key length follows the API's default byte configuration (or 16 bytes if not specified)

**Original Key Handling:**
- The original key will be revoked after the duration specified in `expiration`
- Set `expiration` to 0 to revoke immediately
- This allows for graceful key rotation with an overlap period

Common use cases include:
- Rotating keys for security compliance
- Issuing replacement keys for compromised credentials
- Creating backup keys with identical permissions

**Important:** Analytics and usage metrics are tracked at both the key level AND identity level. If the original key has an identity, the new key will inherit it, allowing you to track usage across both individual keys and the overall identity.

**Required Permissions**

Your credential must grant `write` on the original key:
`unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write`.
A matching wildcard grant also satisfies this requirement. The same permission applies to recoverable keys.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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  |
| `expiration` | string | Yes | 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 - Set to `null` to keep the original key active; it keeps its current expiration, if any - 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  |

### Unkey v2 keys set permissions

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_SET_PERMISSIONS`

Replace all permissions on a key with the specified set in a single atomic operation.

Use this to synchronize with external systems, reset permissions to a known state, or apply standardized permission templates. Permissions granted through roles remain unchanged.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have `write` on the target key:
- `unkey:v1:{workspace_id}:projects/{project_id}/keyspaces/{keyspace_id}/keys/{key_id}#write`

When any requested permission slug does not exist in the key's project, your root key must also have:
- `unkey:v1:{workspace_id}:projects/{project_id}/rbac/permissions/*#write`

Use the keyspace ID, not the API ID. You can use wildcard resource IDs to grant access to multiple resources.

**Side Effects**

Invalidates the key cache for immediate effect, and makes permission changes available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `permissions` | array | Yes | 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  To create missing permission slugs in the key's project, your root key must also have `unkey:v1:{workspace_id}:projects/{project_id}/rbac/permissions/*#write`. Without this grant, the operation returns HTTP 403. Setting existing permissions does not require this additional grant. |

### Unkey v2 keys set roles

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_SET_ROLES`

Replace all roles on a key with the specified set in a single atomic operation.

Use this to synchronize with external systems, reset roles to a known state, or apply standardized role templates. Direct permissions are never affected.

**Important**: Changes take effect immediately with up to 30-second edge propagation.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write` for the target key. A wildcard grant that covers the target key also authorizes this operation.

**Side Effects**

Invalidates the key cache for immediate effect, and makes role changes available for verification within 30 seconds across all regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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.  |
| `roles` | array | Yes | 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.  |

### Unkey v2 keys update credits

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_UPDATE_CREDITS`

Update credit quotas in response to plan changes, billing cycles, or usage purchases.

Use this for user upgrades/downgrades, monthly quota resets, credit purchases, or promotional bonuses. Supports three operations: set, increment, or decrement credits. Set to null for unlimited usage.

**Important**: Setting unlimited credits automatically clears existing refill configurations.

**Required Permissions**

Your credential must have one of the following permissions:
- `api.*.update_key` (to update keys in any API)
- `api.<api_id>.update_key` (to update keys in a specific API)
- `unkey:v1:<workspace_id>:keyspaces/*/keys/*#update_key` (to update keys in any keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/*#update_key` (to update keys in a specific keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/<key_id>#update_key` (to update a specific key)

**Side Effects**

Credit updates remove the key from cache immediately. Setting credits to unlimited automatically clears any existing refill settings. Changes take effect instantly but may take up to 30 seconds to propagate to all edge regions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `keyId` | string | Yes | 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. |
| `value` | string | No | 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).  |
| `operation` | string ("set" | "increment" | "decrement") | Yes | 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.  |

### Unkey v2 keys update key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_UPDATE_KEY`

Update key properties in response to plan changes, subscription updates, or account status changes.

Use this for user upgrades/downgrades, role modifications, or administrative changes. Supports partial updates - only specify fields you want to change. Set fields to null to clear them.

**Important**: Permissions and roles are replaced entirely. Use dedicated add/remove endpoints for incremental changes.

**Required Permissions**

Your credential must have `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#write` for the key being updated, or a broader permission that covers it.

**Side Effects**

If you specify an `externalId` that doesn't exist, a new identity will be automatically created and linked to the key. Permission updates will auto-create any permissions that don't exist in your workspace. Changes take effect immediately but may take up to 30 seconds to propagate to all edge regions due to cache invalidation.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `meta` | string | No | 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.  |
| `name` | string | No | 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.  |
| `keyId` | string | Yes | 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.  |
| `roles` | array | No |  |
| `credits` | string | No | Controls usage-based limits for this key through credit consumption. Omitting this field preserves current credit settings, while setting null enables unlimited usage. Cannot configure refill settings when credits is null, and refillDay requires monthly interval. Essential for implementing usage-based pricing and subscription quotas.  |
| `enabled` | boolean | No | 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.  |
| `expires` | string | No | 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.  |
| `externalId` | string | No | 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.  |
| `ratelimits` | string | No | 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.  |
| `permissions` | array | No |  |

### Unkey v2 keys verify key

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_VERIFY_KEY`

Verify an API key's validity and permissions for request authentication.

Use this endpoint on every incoming request to your protected resources. It checks key validity, permissions, rate limits, and usage quotas in a single call.

**Important**: Returns HTTP 200 for all verification outcomes — check the `valid` field in response data to determine if the key is authorized. A 429 may be returned if the workspace exceeds its API rate limit.

**Common use cases:**
- Authenticate API requests before processing
- Enforce permission-based access control
- Track usage and apply rate limits

**Required Permissions**

Your credential needs one of:
- `unkey:v1:<workspace_id>:projects/*/keyspaces/*/keys/*#verify` (verify keys in any project in your workspace)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/*/keys/*#verify` (verify keys in a specific project)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#verify` (verify keys in a specific keyspace)
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/<key_id>#verify` (verify a specific key)

Use the keyspace's project ID and keyspace ID, not its API ID. The workspace must match your credential's authorized workspace.

**Note**: If your credential lacks permission to verify this key, the response is HTTP 200 with `valid: false` and `code: NOT_FOUND`. This does not distinguish a missing key from an inaccessible key.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `key` | string | Yes | The API key to verify, exactly as provided by your user. Include any prefix - even small changes will cause verification to fail.  |
| `tags` | array | No | 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.  |
| `credits` | object | No | 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.  |
| `keyspaces` | array | No | Restricts verification to keys in these keyspaces, matched by exact ID. Omit this field to verify without a keyspace restriction. A failed keyspace check returns `NOT_FOUND` without consuming credits or rate limits.  |
| `ratelimits` | array | No | 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.  |
| `migrationId` | string | No | Migrate keys on demand from your previous system. Reach out for migration support at support@unkey.dev |
| `permissions` | string | No | 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.  |

### Unkey v2 keys whoami

**Slug:** `UNKEY_MCP_UNKEY_V2_KEYS_WHOAMI`

Find out what key this is.

**Required Permissions**

Your credential must have one of the following permissions for basic key information:
- `api.*.read_key` (to read keys from any API)
- `api.<api_id>.read_key` (to read keys from a specific API)
- `unkey:v1:<workspace_id>:keyspaces/*/keys/*#read_key` (to read keys in any keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/*#read_key` (to read keys in a specific keyspace)
- `unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/<key_id>#read_key` (to read a specific key)

If your credential lacks permissions but the key exists, we may return a 404 status here to prevent leaking the existence of a key to unauthorized clients. If you believe that a key should exist, but receive a 404, please double check your credential has the correct permissions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `key` | string | Yes | 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.  |

### Unkey v2 logs get api request metrics

**Slug:** `UNKEY_MCP_UNKEY_V2_LOGS_GET_API_REQUEST_METRICS`

Count the requests that the Unkey API served for your workspace per time bucket, split by status class.

The filters have the same shape as in `logs.listApiRequests`, without `requestId`. In one field, values under `is`, `contains`, `startsWith`, and `endsWith` are combined with OR. Values under `isNot` and `notContains`, and the range operators `gt`, `gte`, `lt`, and `lte`, are combined with AND. Different fields are combined with AND. Every text match is exact and case-sensitive.

`filters.time` sets the window. A missing lower bound is the start of your log retention, and a missing upper bound is now. Unkey picks the bucket width from the window. It is the distance between the `time` of two points. The first bucket starts at or before the window start and counts its whole width. Windows reach back at most 100 days, and requests outside the log retention of your workspace are not counted.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:logs/apiRequests#read`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `filters` | object | No | Filters for the metrics. They have the same shape as the filters of `logs.listApiRequests`, without `requestId`. A missing field does not filter. Different fields are combined with AND.  |

### Unkey v2 logs list api requests

**Slug:** `UNKEY_MCP_UNKEY_V2_LOGS_LIST_API_REQUESTS`

List the requests that the Unkey API served for your workspace, newest first.

Filter by time, path, method, request ID, and status. In one field, values under `is`, `contains`, `startsWith`, and `endsWith` are combined with OR. Values under `isNot` and `notContains`, and the range operators `gt`, `gte`, `lt`, and `lte`, are combined with AND. Different fields are combined with AND. Every text match is exact and case-sensitive.

To get the next page, send the `pagination.cursor` of the previous page together with the same `filters`. A cursor does not expire, but rows older than the log retention leave the listing.

Unkey returns only requests inside the log retention of your workspace. The calls to this endpoint are not logged.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:logs/apiRequests#read`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | The maximum number of requests to return in one page. |
| `cursor` | string | No | The `pagination.cursor` of the previous page. Send the same `filters` with every page of one listing. Omit the cursor to get the first page.  |
| `filters` | object | No | Filters for the listing. A missing field does not filter. Different fields are combined with AND.  |

### Unkey v2 permissions create permission

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_CREATE_PERMISSION`

Create a new permission to define specific actions or capabilities in your RBAC system. Permissions can be assigned directly to API keys or included in roles.

Use hierarchical naming patterns like `documents.read`, `admin.users.delete`, or `billing.invoices.create` for clear organization.

**Important:** Permission slugs must be unique within the workspace. Names do not need to be unique. Once created, permissions are immediately available for assignment.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*#write`

Use your workspace ID and its default project ID. A wildcard project grant also authorizes this operation.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Creates a permission with this human-readable name that describes its purpose. 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'  |
| `slug` | string | Yes | 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.  |
| `description` | string | No | 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  |

### Unkey v2 permissions create role

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_CREATE_ROLE`

Create a new role to group related permissions for easier management. Roles enable consistent permission assignment across multiple API keys. Permission slugs supplied in `permissions` are attached during creation. Missing permissions are created automatically.

**Important:** Role names must be unique within the workspace. Once created, roles are immediately available for assignment.

**Required Permissions**

Your root key must always have:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/roles/*#write`

When any requested permission slug does not exist, it must also have:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*#write`

Both grants must cover the authenticated workspace and its default project. Attaching existing permissions requires only role write access.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | 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', 'Billing Manager'  |
| `description` | string | No | 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  |
| `permissions` | array | No | Permission slugs to attach to the role. Existing permissions are reused. Missing permissions are created automatically when the root key has `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*#write` for the authenticated workspace and its default project.  Omit this field or provide an empty array to create the role without permissions.  |

### Unkey v2 permissions delete permission

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_DELETE_PERMISSION`

Remove a permission from your workspace. This also removes the permission from all API keys and roles.

**Important:** This operation cannot be undone and immediately affects all API keys and roles that had this permission assigned.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/<permission_id>#delete`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `permission` | string | Yes | 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  |

### Unkey v2 permissions delete role

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_DELETE_ROLE`

Remove a role from your workspace. This also removes the role from all assigned API keys.

**Important:** This operation cannot be undone and immediately affects all API keys that had this role assigned.

**Required Permissions**

Your root key must have `unkey:v1:{workspaceId}:projects/{projectId}/rbac/roles/{roleId}#delete` for the role. A wildcard grant that covers the role also authorizes deletion.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `role` | string | Yes | 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  |

### Unkey v2 permissions get permission

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_GET_PERMISSION`

Retrieve details about a specific permission including its name, description, and metadata.

**Required Permissions**

Your root key must have the following permission:
- `rbac.*.read_permission`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `permission` | string | Yes | The unique identifier of the permission to retrieve. Must be a valid permission ID that begins with 'perm_' and exists within your workspace.  |

### Unkey v2 permissions get role

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_GET_ROLE`

Retrieve details about a specific role including its assigned permissions.

**Required Permissions**

Your root key must have the following permission:
- `rbac.*.read_role`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `role` | string | Yes | 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.  |

### Unkey v2 permissions list permissions

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_LIST_PERMISSIONS`

Retrieve all permissions in your workspace.
Results are paginated and sorted by their id.

**Required Permissions**

Your root key must have the following permission:
- `rbac.*.read_permission`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of permissions to return in a single response. |
| `cursor` | string | No | 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.  |
| `search` | string | No | Free-form text to filter permissions. Returns permissions whose ID, name, slug, or description contains the search string. Matching is case-insensitive. |

### Unkey v2 permissions list roles

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_LIST_ROLES`

Retrieve all roles in your workspace including their assigned permissions.
Results are paginated and sorted by their id.

**Required Permissions**

Your root key must have the following permission:
- `rbac.*.read_role`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | 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.  |
| `cursor` | string | No | 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.  |
| `search` | string | No | Free-form text to filter roles. Returns roles whose ID, name, or description contains the search string. Matching is case-insensitive. |

### Unkey v2 permissions set role permissions

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_SET_ROLE_PERMISSIONS`

Atomically replaces all permissions directly assigned to a role. An empty `permissions` array removes every permission from the role. Permissions that do not exist are created when the caller has permission to create them.

**Required Permissions**

Your root key must have:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/roles/<role_id>#write`

When any requested permission slug does not exist, it must also have:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/*#write`

Use the role's workspace, project, and role IDs in these permissions.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `role` | string | No | The role whose directly assigned permissions will be replaced. Accepts either the generated role ID or the unique role name.  |
| `roleId` | string | No | Deprecated. Use `role` instead. Accepts either the generated role ID or the unique role name.  |
| `permissions` | array | Yes | The complete set of permission slugs to assign directly to the role. Missing permissions are created when authorized. An empty array clears all direct permissions. |

### Unkey v2 permissions update permission

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_UPDATE_PERMISSION`

Update the name, slug, or description of a permission, identified by its ID or slug.

Omitted fields keep their current values. A request with no fields to update returns the stored permission without a write.

**Important**: Keys and roles reference the permission by ID, so they keep the permission after a slug change. Key verification can return the old slug for a short time while caches refresh. A slug that another permission in your workspace already uses returns 409.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/permissions/<permission_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | New human-readable name for the permission. Omit this field to keep the current name.  |
| `slug` | string | No | New slug for the permission. Keys and roles that have this permission get the new slug in verification responses. The slug must be unique in your workspace. Omit this field to keep the current slug.  |
| `permission` | string | Yes | The permission to update. Pass the permission ID (`perm_...`) or its current slug.  |
| `description` | string | No | New description for the permission. Omit this field to keep the current description. Send null or an empty string to remove it.  |

### Unkey v2 permissions update role

**Slug:** `UNKEY_MCP_UNKEY_V2_PERMISSIONS_UPDATE_ROLE`

Update the name or description of a role, identified by its ID or name.

Omitted fields keep their current values. A request with no fields to update returns the stored role without a write.

This endpoint does not change the role's permissions or keys. Use `permissions.setRolePermissions`, `keys.addRoles`, and `keys.removeRoles` for those.

**Important**: Keys keep the role after a rename. Requests that name the role, such as `keys.addRoles`, must use the new name. Key verification can return the old name for a short time while caches refresh. A name that another role in your workspace already uses returns 409.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/<project_id>/rbac/roles/<role_id>#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | New name for the role. The name must be unique in your workspace. Omit this field to keep the current name.  |
| `role` | string | Yes | The role to update. Pass the role ID (`role_...`) or its current name.  |
| `description` | string | No | New description for the role. Omit this field to keep the current description. Send null or an empty string to remove it.  |

### Unkey v2 portal create domain

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_CREATE_DOMAIN`

Attach a custom domain to a portal and start verifying it.

The domain is created in the `pending` state and does not serve the portal until
verification succeeds. The response returns `dnsRecords`: create every entry exactly as
given. Verification runs in the background; poll `portal.getDomain` for the result.

A name already attached to one of your portals or environments returns a 409.

Requires `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/domains/*#write`.
Use `portals/*/domains/*#write` to attach domains to any portal in the project.
Without the permission this returns **404**, not 403, unless the key can read
the portal or its domains.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `domain` | string | Yes | Fully qualified domain name to attach to the portal, without a scheme, port, or path. Must be unique across your workspace: a name already attached to a portal or to an environment cannot be attached again.  |
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 portal create portal

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_CREATE_PORTAL`

Create a portal for one app or keyspace in your workspace.

Unreleased and subject to change without notice.

Send exactly one of `keyspaceId` or `appId`. That resource must belong to your
workspace, and it can back only one portal, so a second portal for the same
resource is a **409**.

`displayName` is what your end users see. It is yours to set and change
independently of the resource the portal serves.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/portals/*#write`
for the project that owns the app or keyspace. A grant scoped to a specific
portal ID does not authorize creation, because the ID does not exist yet.

You must also have read permission on the resource the portal serves:

- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>#read` for an app.
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>#read` for a keyspace.

Broader grants that cover these resources and actions also authorize the request.
A missing permission returns **403**. An app or keyspace outside your workspace
returns **404**, the same as a resource that does not exist.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `slug` | string | Yes | URL-safe handle for this portal, unique within your workspace. Lowercase alphanumerics and single hyphens, 3-64 characters, not starting or ending with a hyphen.  |
| `appId` | string | No | The id of the app this portal serves keys for. Must belong to your workspace.  A portal serves exactly one resource, so `appId` and `keyspaceId` are mutually exclusive.  |
| `enabled` | boolean | No | Whether sessions can be minted for this portal immediately. Defaults to true; send false to create it dormant and enable it later.  |
| `logoUrl` | string | No | Absolute `https://` URL of the logo shown in the portal header.  Loaded by your end users' browsers, so the host you name receives their IP and user agent on every page view.  |
| `keyspaceId` | string | No | The id of the keyspace this portal serves keys for. Must belong to your workspace.  A portal serves exactly one resource, so `keyspaceId` and `appId` are mutually exclusive.  |
| `displayName` | string | Yes | Human-readable name your end users see in the portal header and page titles. Unlike `slug` it is not part of any URL, so it can be changed freely.  |
| `primaryColor` | string | No | Six-digit hex colour used for primary actions and accents in the portal.  |

### Unkey v2 portal create session

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_CREATE_SESSION`

Create a portal session for an end user and get the URL to redirect them to.

The URL carries a single-use exchange code valid for 15 minutes, which the portal
redeems exactly once for a 24-hour access token via `portal.exchangeCode`.

**Required Permissions**

Authorization runs in two stages, and both must pass.

First, your root key must have
`unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/sessions/*#write`.
Write permission on the portal itself does not grant permission to mint sessions.

Second, a session can never carry a capability your root key does not itself
hold. Each requested scope additionally requires the equivalent permission on
every keyspace the portal resolves to:
- `keys:read` requires `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#read`
  and `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>#read`.
- `keys:reroll` requires `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#write`,
  including when the keyspace stores encrypted keys.
- `keys:create` requires `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/keys/*#write`,
  the same permission creating a key with `keys.createKey` requires.
- `analytics:read` requires `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>/logs#read`.

Broader URN grants that cover these resources and actions are also accepted.
A grant on one concrete key cannot satisfy the `keys/*` requirement.
Requesting a scope you do not hold
returns 403 for the whole request rather than minting a reduced session, so a
missing grant is visible instead of surfacing later as a broken portal.

Missing the portal permission itself returns **404** when your root key
cannot read the portal or its sessions, so a caller who cannot see a portal
is not told whether it exists. A root key that can read the portal but lacks
the permission gets **403**.

Your root key must also be associated with a workspace that has an enabled portal.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `scopes` | array | Yes | 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. An end user can never see another identity's keys.  Rerolling, key creation, and usage analytics are all reached from the keys page, so `keys:reroll`, `keys:create`, and `analytics:read` each require `keys:read` in the same session; requesting any of them without it is rejected.  `keys:create` lets the end user create keys for themselves, bounded by the `keyCreation` policy, which it requires. It is not available on a portal mapped to an app. Created keys never carry credits, so do not grant it if you bill on credits. Created keys are ordinary keys in your keyspace: they keep working after the session ends, until they expire or you revoke them.  Each scope requires the equivalent permission on your own root key. See Required Permissions on this operation.  |
| `hostname` | string | No | A verified custom domain of this portal to build the session URL on, so end users stay on your domain. The domain must be verified on this portal; any other value is rejected.  When omitted, the URL uses Unkey's portal host.  |
| `returnUrl` | string | No | Absolute URL the end user is sent back to when they leave the portal, or when their session expires mid-visit. Set per session rather than per portal, so one portal can serve several entry points and return each user to the page they came from.  When omitted, the portal shows no return link.  |
| `externalId` | string | Yes | The end user's identifier in the customer's system. Accepts arbitrary string values (user IDs, emails, UUIDs, etc.).  |
| `keyCreation` | object | No | What the end user may create through the portal. Required with the `keys:create` scope and rejected without it. The policy is fixed for the session's lifetime.  Created keys never carry credits, so do not grant `keys:create` if you bill on credits.  Created keys are recoverable when the keyspace stores encrypted keys, and not recoverable otherwise. This differs from `keys.createKey`, where recoverability is opt-in per key.  |

### Unkey v2 portal delete domain

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_DELETE_DOMAIN`

Detach a custom domain from a portal. A verified domain stops serving the portal.

Requires `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/domains/<domain_id>#delete`.
Use `portals/<portal_id>/domains/*#delete` to delete any domain on the portal.
Without the permission this returns **404**, not 403, unless the key can read
the portal or the domain.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `domainId` | string | Yes | The portal domain ID that `portal.createDomain` returned. |

### Unkey v2 portal delete portal

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_DELETE_PORTAL`

Delete a portal and revoke the sessions it minted.

Unreleased and subject to change without notice.

Its end users lose access rather than keeping it until their tokens expire.
Revocation is not instantaneous: session lookups are cached briefly, so a
request already in flight may still succeed.

The app or keyspace it served is untouched, and its slug becomes free for a
new portal.

Its custom domains are deleted with it: they stop serving and their DNS
records can be removed. Their certificates are not revoked.

**Required Permissions**

Your root key must have `delete` permission on
`unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>`.
A broader grant, such as `unkey:v1:<workspace_id>:**#delete`, also permits deletion.

A root key that cannot read the portal gets **404**. One that can read it
but lacks the permission gets **403**.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 portal get domain

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_GET_DOMAIN`

Read one custom domain attached to a portal, with its verification status and DNS records.

Requires `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/domains/<domain_id>#read`.
Use `portals/<portal_id>/domains/*#read` to read every domain on the portal.
Without the permission this returns **404**, not 403, unless the key can read
the portal itself.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `domainId` | string | Yes | The portal domain ID that `portal.createDomain` returned. |

### Unkey v2 portal get portal

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_GET_PORTAL`

Read one portal, by its id or slug, or by the resource it serves.

Unreleased and subject to change without notice.

Send exactly one of `portal`, `keyspaceId`, or `appId`. Sending more than one
is a **400**.

**Required Permissions**

Your root key must have one of:
- `portal.*.read_portal` (to read any portal in the workspace)
- `portal.<portal_id>.read_portal` (to read a specific portal)

Without the permission this returns **404**, not 403.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `appId` | string | No | The id of the app this portal serves keys for. Must belong to your workspace.  A portal serves exactly one resource, so `appId` and `keyspaceId` are mutually exclusive.  |
| `portal` | string | No | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `keyspaceId` | string | No | The id of the keyspace this portal serves keys for. Must belong to your workspace.  A portal serves exactly one resource, so `keyspaceId` and `appId` are mutually exclusive.  |

### Unkey v2 portal list domains

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_LIST_DOMAINS`

List the custom domains attached to a portal, with their verification status and DNS records.

Requires `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/domains/*#read`.
Without the permission this returns **404**, not 403, unless the key can read
the portal itself.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 portal list sessions

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_LIST_SESSIONS`

List the end users holding a revocable session on a portal, with each
end user's sessions.

Unreleased and subject to change without notice.

A session is revocable until it expires or is revoked. That includes
sessions whose portal URL was created but not opened yet. Pass an end
user's `externalId` to `portal.revokeSession` to end their sessions.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/sessions/*`
with `#read` or `#write`. Reading the portal itself is not enough.

Without the permission this returns **404**, not 403.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of end users to return per request. |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response.  |
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `search` | string | No | Returns only end users whose `externalId` starts with this string. Matching is case-sensitive, and `%` and `_` match literally.  |

### Unkey v2 portal revoke session

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_REVOKE_SESSION`

Revoke every live session an end user holds on a portal.

Unreleased and subject to change without notice.

Sessions that were created but not yet opened are revoked too, so their
portal URLs stop working. Revocation is not instantaneous: session lookups
are cached briefly, so a request already in flight may still succeed.

Revoking ends existing sessions only. To keep the end user out, also stop
calling `portal.createSession` for them.

Calling this again for the same end user is safe and revokes nothing.

**Required Permissions**

Your root key must have
`unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/sessions/*#write`
or a broader grant that includes it. Dashboard roles can grant this permission.
Unlike `portal.createSession`, a dashboard session with this permission can
also call this endpoint.

A root key that cannot read the portal's sessions gets **404**. One that can
read them but lacks the permission gets **403**.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `externalId` | string | Yes | The end user's identifier in your system, as passed to `portal.createSession`. Every live session this end user holds on the portal is revoked.  |

### Unkey v2 portal update portal

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_UPDATE_PORTAL`

Change a portal's slug, display name, the resource it serves, its enabled
state, or its branding.

Unreleased and subject to change without notice.

Only the fields you send change. Omitting a field leaves it as it is, and for
branding, sending null clears it. Send at most one of `keyspaceId` or `appId`.

Two changes affect your end users immediately:
- Re-pointing at a different resource revokes the portal's live sessions,
  because a session carries the scope it was minted with.
- Disabling stops new sessions and revokes the live ones. Re-enabling does
  not restore them.

**Required Permissions**

Your root key must have `write` permission on
`unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>`.
A broader grant, such as `unkey:v1:<workspace_id>:**#write`, also permits updates.

To change the mapped resource, your root key must also have `read` permission
on the target:
- `unkey:v1:<workspace_id>:projects/<project_id>/keyspaces/<keyspace_id>#read`
  for a keyspace.
- `unkey:v1:<workspace_id>:projects/<project_id>/apps/<app_id>#read` for an app.

A root key that cannot read the portal gets **404**. One that can read it
but lacks the permission gets **403**.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `slug` | string | No | New handle for this portal. Omit to leave unchanged.  |
| `appId` | string | No | Re-point the portal at a different app. Omit to leave the resource it serves alone.  Re-pointing revokes the portal's live sessions, for the same reason as `keyspaceId`.  The same project restriction applies, and it is easy to hit when switching between an app and a keyspace: keyspaces are created in the workspace's default project, while an app belongs to the project you created it in.  |
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `enabled` | boolean | No | Whether new sessions can be minted. Omit to leave unchanged.  Disabling also revokes the portal's live sessions. Re-enabling does not restore them.  |
| `logoUrl` | string | No | Absolute `https://` URL of the portal logo. Omit to leave unchanged, or set null to remove the logo.  |
| `keyspaceId` | string | No | Re-point the portal at a different keyspace. Omit to leave the resource it serves alone.  Re-pointing revokes the portal's live sessions, because a session carries the keyspace scope it was minted with and would otherwise keep reaching the resource the portal no longer serves.  The new keyspace must belong to the same project as the portal's current resource. A portal cannot move between projects, because its permissions are addressed under the project it belongs to. Re-pointing across projects returns 412; create a portal in the target project instead.  |
| `displayName` | string | No | New human-readable name shown to your end users. Omit to leave unchanged.  |
| `primaryColor` | string | No | Six-digit hex colour for primary actions. Omit to leave unchanged, or set null to fall back to default styling.  |

### Unkey v2 portal verify domain

**Slug:** `UNKEY_MCP_UNKEY_V2_PORTAL_VERIFY_DOMAIN`

Restart verification for a portal domain.

Call this after you correct the DNS records of a domain that shows `failed`, or to give a
`pending` domain a new 24-hour verification period. The endpoint returns when Unkey accepts
the retry. Poll `portal.getDomain` for the result.

A domain that is already `verified` returns a 202 and starts nothing.

Requires `unkey:v1:<workspace_id>:projects/<project_id>/portals/<portal_id>/domains/<domain_id>#write`.
Use `portals/<portal_id>/domains/*#write` to manage every domain on the portal.
Without the permission this returns **404**, not 403, unless the key can read
the portal or the domain.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `portal` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `domainId` | string | Yes | The portal domain ID that `portal.createDomain` returned. |

### Unkey v2 projects create project

**Slug:** `UNKEY_MCP_UNKEY_V2_PROJECTS_CREATE_PROJECT`

Create a project to group deployments and applications under a workspace-scoped slug.

The slug you provide is the stable, caller-defined handle used to reference this project in subsequent operations (get, update, delete). It must be unique within your workspace.

**Important**: The slug cannot collide with an existing project in your workspace. A duplicate slug returns a 409 conflict.

**Required Permissions**

Your root key must have the following permission:
- `project.*.create_project` (to create projects in your workspace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | Human-readable name for this project. Use a descriptive name like 'Payments Service' to identify its purpose.  |
| `slug` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 projects delete project

**Slug:** `UNKEY_MCP_UNKEY_V2_PROJECTS_DELETE_PROJECT`

Delete an existing project in your workspace, identified by its id.

Deletion is asynchronous and eventually consistent. The project and all of its associated resources (apps, environments, deployments, custom domains) are torn down by a background workflow. A successful response indicates the deletion was enqueued, not that every resource has already been removed.

Projects with delete protection enabled cannot be deleted until protection is disabled.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*#delete` (to delete any project in the workspace)
- `unkey:v1:<workspace_id>:projects/<project_id>#delete` (to delete a specific project)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 projects get project

**Slug:** `UNKEY_MCP_UNKEY_V2_PROJECTS_GET_PROJECT`

Retrieve a single project in your workspace by its id.

Use this to fetch project details after creation, verify a project exists before performing operations, or resolve a project's metadata from its id.

**Required Permissions**

Your root key must have one of the following permissions:
- `project.*.read_project` (to read any project)
- `project.<project_id>.read_project` (to read a specific project)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |

### Unkey v2 projects list projects

**Slug:** `UNKEY_MCP_UNKEY_V2_PROJECTS_LIST_PROJECTS`

Retrieve a paginated list of projects in your workspace.

Use this to build project management dashboards or to enumerate projects for administrative purposes. Results are ordered by project id and returned in pages. When `hasMore` is true, pass the returned `cursor` to fetch the next page.

**Required Permissions**

Your root key must have the following permission:
- `project.*.read_project` (to read projects in your workspace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of projects to return per request. Balance between response size and number of pagination calls needed.  |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response.  |
| `search` | string | No | Free-form text to filter projects. Returns projects whose ID, name, or slug contains the search string. Matching is case-insensitive. |

### Unkey v2 projects update project

**Slug:** `UNKEY_MCP_UNKEY_V2_PROJECTS_UPDATE_PROJECT`

Update an existing project in your workspace, identified by its id.

The project name, slug, and delete protection setting can be changed. Omitted fields are left unchanged. Changing the slug affects the deployment domains generated for this project.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*#write` (to update any project in the workspace)
- `unkey:v1:<workspace_id>:projects/<project_id>#write` (to update a specific project)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | New human-readable name for the project. Omit this field to leave the current name unchanged.  |
| `slug` | string | No | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `project` | string | Yes | Identifies a resource by either its unique ID or its slug. Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.  |
| `deleteProtection` | boolean | No | Enable or disable delete protection for the project. Omit this field to leave the current setting unchanged.  |

### Unkey v2 ratelimit create namespace

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_CREATE_NAMESPACE`

Create a rate limit namespace before you rate limit against it.

`ratelimit.limit` also creates a namespace the first time you use its name, when your root key can create namespaces. Use this endpoint when you want the namespace to exist up front, for example to set overrides before the first request.

**Important**: Names are unique within your workspace, deleted namespaces included. A name that is in use or was deleted returns 409.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:projects/*/ratelimits/namespaces/*#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The name of the namespace, unique within your workspace. Names are case-sensitive. Pass it as `namespace` to `ratelimit.limit` and the override endpoints.  |

### Unkey v2 ratelimit delete namespace

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_DELETE_NAMESPACE`

Delete a rate limit namespace and all of its overrides, identified by the namespace ID or name.

**Important**: A deleted name cannot be reused. `ratelimit.limit` and `ratelimit.multiLimit` return 410 for it instead of creating a new namespace, so a deleted namespace does not turn into unlimited traffic. Other API nodes can take up to a minute to see the deletion.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*/ratelimits/namespaces/*#delete` (to delete any namespace)
- `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>#delete` (to delete a specific namespace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `namespace` | string | Yes | The namespace to delete. Pass the namespace ID (`rlns_...`) or its name.  |

### Unkey v2 ratelimit delete override

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_DELETE_OVERRIDE`

Permanently remove a rate limit override. Affected identifiers immediately revert to the namespace default.

Use this to remove temporary overrides, reset identifiers to standard limits, or clean up outdated rules.

**Important:** Deletion is immediate and permanent. The override cannot be recovered and must be recreated if needed again.

**Permissions:** Requires `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>/overrides/<override_id>#delete`, or a wildcard URN permission that includes this override and action. Without read access to the override, insufficient permissions return 404. With read access but no delete permission, the response is 403.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `namespace` | string | Yes | The id or name of the namespace containing the override. |
| `identifier` | string | Yes | 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. |

### Unkey v2 ratelimit get override

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_GET_OVERRIDE`

Retrieve the configuration of a specific rate limit override by its identifier.

Use this to inspect override configurations, audit rate limiting policies, or debug rate limiting behavior.

**Important:** The identifier must match exactly as specified when creating the override, including wildcard patterns.

**Permissions:** Requires `ratelimit.*.read_override` or `ratelimit.<namespace_id>.read_override`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `namespace` | string | Yes | The id or name of the namespace containing the override. |
| `identifier` | string | Yes | 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. |

### Unkey v2 ratelimit limit

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_LIMIT`

Check and enforce rate limits for any identifier (user ID, IP address, API client, etc.).

Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides.

**Response Codes**: Rate limit checks return HTTP 200 regardless of whether the limit is exceeded — check the `success` field in the response to determine if the request should be allowed. A 429 may be returned if the workspace exceeds its API rate limit. Other 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.

**Required Permissions**

Your root key must have one of the following permissions:
- `ratelimit.*.limit` (to check limits in any namespace)
- `ratelimit.<namespace_id>.limit` (to check limits in a specific namespace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `cost` | integer | No | 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.  |
| `limit` | integer | Yes | 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.  |
| `duration` | integer | Yes | 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.  |
| `namespace` | string | Yes | The id or name of the namespace. |
| `identifier` | string | Yes | 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.  |

### Unkey v2 ratelimit list namespaces

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_LIST_NAMESPACES`

Retrieve a paginated list of the rate limit namespaces in your workspace.

Use this to find the namespaces your services rate limit against, for example to build an admin view or to look up a namespace ID. Results are ordered newest first and returned in pages. When `hasMore` is true, pass the returned `cursor` to fetch the next page.

Deleted namespaces are not returned. The list contains only the namespaces your root key can read.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*/ratelimits/namespaces/*#read` (to read any namespace)
- `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>#read` (to read a specific namespace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of namespaces to return per request. Omit this field to receive up to 100 namespaces.  |
| `cursor` | string | No | Pagination cursor from a previous response to fetch the next page. Use when `hasMore: true` in the previous response. Omit this field to start from the first page.  |
| `search` | string | No | Free-form text to filter namespaces. Returns namespaces whose ID or name contains the search string. Matching is case-insensitive. Omit this field to list every namespace.  |

### Unkey v2 ratelimit list overrides

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_LIST_OVERRIDES`

Retrieve a paginated list of all rate limit overrides in a namespace.

Use this to audit rate limiting policies, build admin dashboards, or manage override configurations.

**Important:** Results are paginated. Use the cursor parameter to retrieve additional pages when more results are available.

**Permissions:** Requires `ratelimit.*.read_override` or `ratelimit.<namespace_id>.read_override`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | 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. |
| `cursor` | string | No | 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. |
| `namespace` | string | Yes | The id or name of the rate limit namespace to list overrides for. |

### Unkey v2 ratelimit multi limit

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_MULTI_LIMIT`

Check and enforce multiple rate limits in a single request for any identifiers (user IDs, IP addresses, API clients, etc.).

Use this to efficiently check multiple rate limits at once. Each rate limit check is independent and returns its own result with a top-level `passed` indicator showing if all checks succeeded.

**Response Codes**: Rate limit checks return HTTP 200 regardless of whether limits are exceeded — check the `passed` field to see if all limits passed, or the `success` field in each individual result. A 429 may be returned if the workspace exceeds its API rate limit. Other 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.

**Required Permissions**

Your root key must have `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>#limit` for every namespace in the request. Use `*` for the namespace ID to cover all namespaces in a project.

To create missing namespaces automatically, your root key must also have `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/*#write` for the workspace's default project. The `#limit` permission must cover each created namespace.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `body` | array | Yes | Array of rate limit checks to perform. Each check must have a different combination of namespace, identifier and duration. A repeated combination returns a 400 error with `invalid_input` before any namespace is created. |

### Unkey v2 ratelimit set override

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_SET_OVERRIDE`

Create or update a custom rate limit for specific identifiers, bypassing the namespace default.

Use this to create premium tiers with higher limits, apply stricter limits to specific users, or implement emergency throttling.

**Important:** Overrides take effect immediately and completely replace the default limit for matching identifiers. Use wildcard patterns (e.g., `premium_*`) to match multiple identifiers.

**Permissions:** Requires `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>/overrides/*#write` to create overrides. To update an override, you can replace `*` with its override ID.


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | Yes | 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. |
| `duration` | integer | Yes | 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) |
| `namespace` | string | Yes | The ID or name of the rate limit namespace. |
| `identifier` | string | Yes | 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 |

### Unkey v2 ratelimit update namespace

**Slug:** `UNKEY_MCP_UNKEY_V2_RATELIMIT_UPDATE_NAMESPACE`

Rename a rate limit namespace, identified by its ID or current name.

Renaming to the current name returns the namespace without a write.

**Important**: Overrides stay with the namespace. Requests that pass the namespace by name, such as `ratelimit.limit`, must use the new name. A `ratelimit.limit` call with the old name can create a new, empty namespace with that name. A name that is in use or was deleted returns 409. Other API nodes can take up to a minute to see the new name.

**Required Permissions**

Your root key must have one of the following permissions:
- `unkey:v1:<workspace_id>:projects/*/ratelimits/namespaces/*#write` (to rename any namespace)
- `unkey:v1:<workspace_id>:projects/<project_id>/ratelimits/namespaces/<namespace_id>#write` (to rename a specific namespace)


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The new name of the namespace, unique within your workspace. Names are case-sensitive.  |
| `namespace` | string | Yes | The namespace to rename. Pass the namespace ID (`rlns_...`) or its current name.  |

### Unkey v2 workspace get flags

**Slug:** `UNKEY_MCP_UNKEY_V2_WORKSPACE_GET_FLAGS`

Get feature flags for the workspace associated with your credentials.

Each flag is keyed by its slug and includes its current value, description,
and whether it can be enabled or disabled. A workspace-specific value takes
precedence over the flag's default. If no flags are available, `data` is an
empty object.

This endpoint takes no request body.
**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:flags#read`


### Unkey v2 workspace get limits

**Slug:** `UNKEY_MCP_UNKEY_V2_WORKSPACE_GET_LIMITS`

Get every limit of your workspace, with the current value against each
limit that has one.

Use this before an operation that a limit can reject, for example to see how
many custom domains or log drains remain, or how much CPU, memory, and disk
a new deployment can still reserve.

The request takes no parameters. Each limit has a `limit`, which is `null`
when unlimited, and a `current` value when the limit has one. Billable
operations count the current calendar month in UTC. The Compute limits are
present only when the workspace has a Compute plan.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:limits#read`


### Unkey v2 workspace get usage

**Slug:** `UNKEY_MCP_UNKEY_V2_WORKSPACE_GET_USAGE`

Get the usage of your workspace for one calendar month (UTC): billable API
operations, compute usage per environment, and active keys per app.

Use this to track usage during the month or to look back at a past
month. The response has no prices. Your invoice is the source of truth.
Compute usage can be up to 15 minutes late, and it can change for up to 7
days.

Send `{}` for the current month to date, or
`{"period": {"year": 2026, "month": 9}}` for a full past month. The month
must start within the last 90 days.

**Required Permissions**

Your root key must have this permission:
- `unkey:v1:<workspace_id>:usage#read`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `period` | object | No | The calendar month (UTC) to read. Omit it for the current month to date. A past month returns the full month. It cannot be in the future, and it must start within the last 90 days, because compute usage is kept for 90 days.  |

### Unkey v2 workspace update flag

**Slug:** `UNKEY_MCP_UNKEY_V2_WORKSPACE_UPDATE_FLAG`

Enable or disable a flag for your workspace. Use `workspace.getFlags` to
find flag slugs and check whether they can be enabled or disabled.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:flags#write`


#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `slug` | string | Yes | Lowercase snake_case slug of the flag to update, as returned by `workspace.getFlags`. |
| `enabled` | boolean | Yes | Set to true to enable the flag or false to disable it, regardless of the flag's default. |
