Developer Tools · IT & Security

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.

Tools

This is a reference catalogue. Tools cannot be configured or run from this page.

  • 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.

  • 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`

  • 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`

  • 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`

  • 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`

  • 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`

  • 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`

  • 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)

  • 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)

  • 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.

  • 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

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

Page 1 / 2Next