---
updatedAt: 2026-10-19T18:28:22.000Z
agentTools:
  projectIndex: https://docs.skyfire.xyz/llms.txt
---

# Deactivate Agent API Key

As an Organization Admin, disable an API key of an agent belonging to a user in your organization so it no longer authenticates. Keys are never deleted and can be re-enabled later. Deactivating an already-inactive key is a no-op.

As an Organization Admin, disable an API key of an agent belonging to a user in your organization so it no longer authenticates.

Authenticate with an **Organization Admin User API key**, sent in the `skyfire-api-key` header. Keys belonging to Organization Admins are accepted; a `MEMBER` key, or any Agent API key, is rejected with `401`.

The key is resolved through the ownership chain **organization → user → agent → API key**, all scoped to your own organization. Any link in the chain that does not exist, belongs to another organization, or is mismatched (for example, a valid key ID under a different agent) returns `404`.

Keys are never deleted — a deactivated key remains visible in [Get Agent API Keys](https://docs.skyfire.xyz/reference/get-agent-api-keys) with `active: false` and can be re-enabled later with [Activate Agent API Key](https://docs.skyfire.xyz/reference/activate-agent-api-key). Deactivating a key that is already inactive is a **no-op** and still returns `204`.

### Revocation timing

Deactivation is typically immediate. Because authentication results are cached, requests using the deactivated key may continue to succeed for a short window after this call returns; revocation is guaranteed everywhere once the authentication cache expires. For zero-downtime rotation, create the replacement key first, migrate your workload, and deactivate the old key last.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "skyfire-agent-and-token-apis",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.skyfire.xyz"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "skyfire-api-key",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/api/v1/organizations/users/{userId}/agents/{agentId}/api-keys/{apiKeyId}/deactivate": {
      "patch": {
        "description": "As an Organization Admin, disable an API key of an agent belonging to a user in your organization so it no longer authenticates. Keys are never deleted and can be re-enabled later. Deactivating an already-inactive key is a no-op.",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Unique identifier of the user who owns the agent. e.g. `\"906fc259-ef0a-4736-bdcd-c1d5a78db483\"`"
          },
          {
            "in": "path",
            "name": "agentId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Unique identifier of the agent the key belongs to. e.g. `\"5d084831-4a11-4970-bf62-bb6fc0b9f3a2\"`"
          },
          {
            "in": "path",
            "name": "apiKeyId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Unique identifier of the API key to deactivate, from the create or list responses. e.g. `\"c41d8f2b-6a3e-4b9c-8d1f-0e2a4b6c8d10\"`"
          }
        ],
        "responses": {
          "204": {
            "description": "No Content. The key is deactivated."
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Unauthorized": {
                    "summary": "Unauthorized",
                    "value": {
                      "code": "NOT_AUTHORIZED",
                      "message": "Invalid Organization User API Key"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "User or agent not in your organization": {
                    "summary": "User or agent not in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "message": "Agent not found"
                    }
                  },
                  "API key not found under this agent": {
                    "summary": "API key not found under this agent",
                    "value": {
                      "code": "NOT_FOUND",
                      "message": "No API key found"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Unprocessable Entity": {
                    "summary": "Unprocessable Entity",
                    "value": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation Error",
                      "details": {
                        "apiKeyId": {
                          "message": "Must be a valid UUID"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "patch_api-v1-organizations-users-userid-agents-agentid-api-keys-apikeyid-deactivate",
        "x-readme": {
          "code-samples": [
            {
              "code": "curl -i -X PATCH 'https://api.skyfire.xyz/api/v1/organizations/users/906fc259-ef0a-4736-bdcd-c1d5a78db483/agents/5d084831-4a11-4970-bf62-bb6fc0b9f3a2/api-keys/c41d8f2b-6a3e-4b9c-8d1f-0e2a4b6c8d10/deactivate' \\\n  -H 'skyfire-api-key: ec0bf984-34f9-4e1e-a06e-984f3dfb089e'",
              "language": "shell",
              "name": "cURL"
            },
            {
              "code": "const res = await fetch(\n  'https://api.skyfire.xyz/api/v1/organizations/users/906fc259-ef0a-4736-bdcd-c1d5a78db483/agents/5d084831-4a11-4970-bf62-bb6fc0b9f3a2/api-keys/c41d8f2b-6a3e-4b9c-8d1f-0e2a4b6c8d10/deactivate',\n  {\n    method: 'PATCH',\n    headers: { 'skyfire-api-key': 'ec0bf984-34f9-4e1e-a06e-984f3dfb089e' }\n  }\n);\nconsole.log(res.status); // 204",
              "language": "node",
              "name": ""
            },
            {
              "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"api.skyfire.xyz\")\nheaders = {'skyfire-api-key': 'ec0bf984-34f9-4e1e-a06e-984f3dfb089e'}\nconn.request(\"PATCH\", \"/api/v1/organizations/users/906fc259-ef0a-4736-bdcd-c1d5a78db483/agents/5d084831-4a11-4970-bf62-bb6fc0b9f3a2/api-keys/c41d8f2b-6a3e-4b9c-8d1f-0e2a4b6c8d10/deactivate\", None, headers)\nres = conn.getresponse()\nprint(res.status)  # 204",
              "language": "python",
              "name": ""
            }
          ],
          "samples-languages": [
            "shell",
            "node",
            "python"
          ]
        },
        "summary": "Deactivate Agent API Key"
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "skyfire-api-key",
        "value": "<Your Skyfire Agent Account API Key>"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true
}
```