---
title: "Update API Key"
method: PATCH
path: "/apiKeys/{id}"
tags: ["ApiKey"]
---

# Update API Key

`PATCH /apiKeys/{id}`

Updated limited API key fields

## Path parameters

- `id` string, required

## Query parameters

- `with_secret` boolean

## Headers

- `If-Match` string

## Request body

- ApiKey
  - `id` string — The ID of the API key, NOT the raw API Key secret
  - `secret_key` string — secret API key (may not be returned from all endpoints)
  - `secret_key_hash` string — Secure key hash (may not be returned from all endpoints)
  - `secret_key_hash_cypher` string — Secure key hash type (may not be returned from all endpoints)
  - `encrypted_secret_key` string — Encrypted secret API key (may not be returned from all endpoints)
  - `created_time` integer — Time at which the API key was created
  - `created_by_id` string — The ID of the user who created this API key
  - `deleted_time` integer — Time at which the API key was deleted
  - `deleted_by_id` string — The ID of the client/user who deleted this API key
  - `expiration_time` integer — Time at which this API key will expire
  - `last_updated_time` integer — Time at which the organization API key was last updated
  - `last_updated_by_id` string — The ID of the user who last updated this API key
  - `organization_id` string — DEPRECATED - The ID of the organization associated with this API key
  - `name` string — Friendly name for this API key
  - `scopes` Scope[] — Scopes to grant to this key
    - `permission` 'read' | 'write' | 'list' | 'read_secret' | 'authorize', required — The permission to grant
    - `target` string, required — The entity to which the permission should be granted
  - `tags` Tag[] — Free text tags associated with this entity
    - `name` string, required — tag name
    - `values` string[]
  - `type` 'agent_review' | 'ci_cd_integration' | 'command_line_interface' | 'custom' | 'database_query_execution' | 'deployment_trigger' | 'editor' | 'execution' | 'impersonation' | 'integration' | 'issue_tracker' | 'link_agent' | 'login' | 'reporting' | 'selenium_agent' | 'test_authoring' | 'usage_analytics' | 'user_management' | 'viewer' | 'workspace_admin' | 'workspace_invitation_acceptance' | 'workspace_setup' — The intended use of this API key
  - `enabled` boolean — False if key authentication should be paused
  - `workspace_id` string — The ID of the workspace associated with this API key. Mutually exclusive with company_id.
  - `company_id` string — The ID of the company associated with this API key. Set for company-scoped keys that grant access to all workspaces owned by the company. Mutually exclusive with workspace_id.

## Response `200`

API key with patches applied

- ApiKey
  - `id` string — The ID of the API key, NOT the raw API Key secret
  - `secret_key` string — secret API key (may not be returned from all endpoints)
  - `secret_key_hash` string — Secure key hash (may not be returned from all endpoints)
  - `secret_key_hash_cypher` string — Secure key hash type (may not be returned from all endpoints)
  - `encrypted_secret_key` string — Encrypted secret API key (may not be returned from all endpoints)
  - `created_time` integer — Time at which the API key was created
  - `created_by_id` string — The ID of the user who created this API key
  - `deleted_time` integer — Time at which the API key was deleted
  - `deleted_by_id` string — The ID of the client/user who deleted this API key
  - `expiration_time` integer — Time at which this API key will expire
  - `last_updated_time` integer — Time at which the organization API key was last updated
  - `last_updated_by_id` string — The ID of the user who last updated this API key
  - `organization_id` string — DEPRECATED - The ID of the organization associated with this API key
  - `name` string — Friendly name for this API key
  - `scopes` Scope[] — Scopes to grant to this key
    - `permission` 'read' | 'write' | 'list' | 'read_secret' | 'authorize', required — The permission to grant
    - `target` string, required — The entity to which the permission should be granted
  - `tags` Tag[] — Free text tags associated with this entity
    - `name` string, required — tag name
    - `values` string[]
  - `type` 'agent_review' | 'ci_cd_integration' | 'command_line_interface' | 'custom' | 'database_query_execution' | 'deployment_trigger' | 'editor' | 'execution' | 'impersonation' | 'integration' | 'issue_tracker' | 'link_agent' | 'login' | 'reporting' | 'selenium_agent' | 'test_authoring' | 'usage_analytics' | 'user_management' | 'viewer' | 'workspace_admin' | 'workspace_invitation_acceptance' | 'workspace_setup' — The intended use of this API key
  - `enabled` boolean — False if key authentication should be paused
  - `workspace_id` string — The ID of the workspace associated with this API key. Mutually exclusive with company_id.
  - `company_id` string — The ID of the company associated with this API key. Set for company-scoped keys that grant access to all workspaces owned by the company. Mutually exclusive with workspace_id.

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `404` — API key not found
- `default` — Unknown error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
