---
title: Update API Key
url: https://platform.claude.com/docs/en/api/csharp/organization/api_keys/update
---

# Update API Key

`ApiKey Organization.ApiKeys.Update(parameters, cancellationToken = default)`

**POST** `/v1/organizations/api_keys/{api_key_id}`

Update API Key

## Parameters

- `ApiKeyUpdateParams parameters`

  - `required string apiKeyID` (path parameter)

    ID of the API key.

  - `string? name`

    Name of the API key.

    minLength: 1, maxLength: 500

  - `Status? status`

    Status of the API key.

    - `Active("active")`

    - `Archived("archived")`

    - `Inactive("inactive")`

## Returns

- `class ApiKey`

  - `JsonElement Type = "api_key"`

    Object type.

    For API Keys, this is always `"api_key"`.

  - `required string ID`

    ID of the API key.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string indicating when the API Key was created.

    format: date-time

  - `required ApiKeyCreatedBy? CreatedBy`

    The ID and type of the actor that created the API key, or `null` when the
    creator is not recorded (legacy, workload-identity-federated, or
    system-created keys).

    - `required Type Type`

      Type of the actor that created the object.

      - `ServiceAccount("service_account")`

      - `User("user")`

    - `required string ID`

      ID of the actor that created the object.

  - `required DateTimeOffset? ExpiresAt`

    RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires.

    format: date-time

  - `required string Name`

    Name of the API key.

  - `required string? PartialKeyHint`

    Partially redacted hint for the API key.

  - `required Principal? Principal`

    The principal the API key acts as (a User or a Service Account), or `null` if the API key is not bound to a principal.

    - `class ApiKeyUserActor`

      - `JsonElement Type = "user_actor"`

        Principal type. Always `"user_actor"` for a User.

      - `required string UserID`

        ID of the User the API key acts as.

    - `class ApiKeyServiceAccountActor`

      - `JsonElement Type = "service_account_actor"`

        Principal type. Always `"service_account_actor"` for a Service Account.

      - `required string ServiceAccountID`

        ID of the Service Account the API key acts as.

  - `required Scope Scope`

    Where the API key belongs: its Workspace (`{"type": "workspace", "workspace_id": "wrkspc_..."}`, with the Workspace's real ID even when it is the organization's default Workspace), or the organization (`{"type": "organization"}`) for a principal-bound API key that has no Workspace.

    - `class ApiKeyOrganizationScope`

      - `JsonElement Type = "organization"`

        Scope type. Always `"organization"`: the API key has no Workspace. Only a principal-bound API key can have this scope.

    - `class ApiKeyWorkspaceScope`

      - `JsonElement Type = "workspace"`

        Scope type. Always `"workspace"`: the API key belongs to one Workspace.

      - `required string WorkspaceID`

        ID of the Workspace the API key belongs to, including when it is the organization's default Workspace.

  - `required Status Status`

    Status of the API key.

    - `Active("active")`

    - `Archived("archived")`

    - `Expired("expired")`

    - `Inactive("inactive")`

## Example

```csharp
using System;
using Anthropic.Models.Organization.ApiKeys;

ApiKeyUpdateParams parameters = new() { ApiKeyID = "api_key_id" };

var apiKey = await client.Organization.ApiKeys.Update(parameters);

Console.WriteLine(apiKey);
```

### Response (200)

```json
{
  "id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
  "created_at": "2024-10-30T23:58:27.427722Z",
  "created_by": {
    "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
    "type": "user"
  },
  "expires_at": "2024-10-30T23:58:27.427722Z",
  "name": "Developer Key",
  "partial_key_hint": "sk-ant-api03-R2D...igAA",
  "principal": {
    "type": "user_actor",
    "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"
  },
  "scope": {
    "type": "workspace",
    "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
  },
  "status": "active",
  "type": "api_key"
}
```
