PATCH/api/orgs/{org_id}/keys/{key_id}

Change a key's group, budget or limits

Every field is optional; an omitted field is left alone. identity_id moves the key to another group. budget_id attaches the key to a shared budget (moving it off any other) and null detaches it; budget creates a new shared budget for it. Setting a budget replaces any older per-key spend cap on the key. rate_limits: null returns the key to its tier's windows; ip_rules: null removes its IP rules. Org admin or the provisioning key.

Authentication: Bearer API key in the Authorization header

Path parameters

  • org_idstringrequired

    Your organization id (uuid). GET /api/whoami returns it.

  • key_idstringrequired

    The key's id (id from create, or hash on /api/v1/keys), never its secret.

Request body

  • namestring | null

    1 to 80 characters after trimming.

  • identity_idstring | null

    Move the key to this active group.

  • budget_idstring | null

    Attach to this shared budget; null detaches.

  • budgetobject | null
    One of

    object

    • namestring | null

      Defaults to the key's name.

    • limit_nano_usdintegerrequired

      Integer nano-USD per window.

    • reset_periodenum
      "daily""weekly""monthly""yearly"
      Default: "monthly"
  • rate_limitsobject | null

    Null returns the key to its tier's windows.

    One of

    object

    • requests_per_minuteinteger | null
    • tokens_per_minuteinteger | null
    • tokens_per_hourinteger | null
    • tokens_per_dayinteger | null
  • ip_rulesobject | null

    Null removes the key's IP rules.

    One of

    object

    • modeenumrequired

      allow serves the key only from these ranges; deny never from them.

      "allow""deny"
    • cidrsarray<string>required

      IPv4 or IPv6 ranges in CIDR notation.

Responses

  • 200

    The key.

    Response
    • idstringrequired
    • namestringrequired
    • labelstringrequired

      Key prefix and last characters.

    • identity_idstring | nullrequired

      The key's group.

    • budgetobject | nullrequired

      The shared budget the key draws from.

      One of

      object

      • budget_idstringrequired
      • periodstringrequired

        YYYY-MM, or * for recurring.

      • scope_kindenumrequired

        keys is a shared budget; key is an older per-key budget.

        "team""identity""key""model""pool""deployment""keys"
      • api_key_idstring | nullrequired
      • identity_idstring | nullrequired
      • alias_idstring | nullrequired
      • pool_idstring | nullrequired
      • deployment_idstring | nullrequired
      • limit_nano_usdintegerrequired

        The cap, integer nano-USD. 0 is a hard zero cap.

      • reserved_nano_usdintegerrequired

        In flight, integer nano-USD.

      • settled_nano_usdintegerrequired

        Spent this month, integer nano-USD.

      • remaining_nano_usdintegerrequired

        Integer nano-USD.

      • created_by_kindenumrequired
        "session""api_key"
      • created_by_api_key_idstring | nullrequired

        The authoring key, when a key wrote the row.

      • namestring | null

        Shared budgets only.

      • reset_periodenum

        Shared budgets only.

        "daily""weekly""monthly""yearly"null
      • api_key_idsarray | null

        Shared budgets only: the keys drawing from it.

    • rate_limitsobject | nullrequired

      Null when the key uses its tier's windows.

      One of

      object

      • requests_per_minuteinteger | nullrequired
      • tokens_per_minuteinteger | nullrequired
      • tokens_per_hourinteger | nullrequired
      • tokens_per_dayinteger | nullrequired
    • ip_rulesobject | null

      The key's IP rules; null when it serves from any address.

      One of

      object

      • modeenumrequired

        allow serves the key only from these ranges; deny never from them.

        "allow""deny"
      • cidrsarray<string>required

        IPv4 or IPv6 ranges in CIDR notation.

    • legacy_spend_capsarray<object>required
      legacy_spend_caps
      • limit_nano_usdintegerrequired
      • periodstringrequired
    • is_provisioningbooleanrequired
    • expires_atstring | nullrequired
    • created_atstringrequired
    • revoked_atstring | nullrequired
  • 401

    Missing, unknown or revoked API key.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 403

    The key is not a provisioning key (inference keys are refused, reads included), or it is a customer-plan key.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 404

    Unknown key, group or shared budget.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 409

    The group is disabled, or the new budget's name is taken.

    Response
    • errorstringrequired

      Human-readable message.

    • codestring

      Stable machine reason, when the route defines one (for example pro_required).

    • actionstring

      Stable remediation action, when the route defines one.

    • detailsobject

      Customer-safe string facts the caller needs to act (for example a suggested identifier).

  • 422

    Both budget_id and budget, a bad name, reset period or IP range, or body validation.

Request

curl -X PATCH 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys/11111111-1111-1111-1111-111111111111' \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "identity_id": "data-team-5d2b7e19",
  "budget_id": "c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71"
}'

Response

{
  "id": "11111111-1111-1111-1111-111111111111",
  "name": "data-pipeline",
  "label": "xpl_live_3b7e…04fc",
  "identity_id": "data-team-5d2b7e19",
  "budget": {
    "budget_id": "c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71",
    "period": "*",
    "scope_kind": "keys",
    "api_key_id": null,
    "identity_id": null,
    "alias_id": null,
    "pool_id": null,
    "deployment_id": null,
    "limit_nano_usd": 200000000000,
    "reserved_nano_usd": 0,
    "settled_nano_usd": 41200000000,
    "remaining_nano_usd": 158800000000,
    "created_by_kind": "session",
    "created_by_api_key_id": null,
    "name": "Interns",
    "reset_period": "monthly",
    "api_key_ids": [
      "6d1f8a2b-4c3e-4f5a-9b7c-2e8d0a1f3b4c",
      "11111111-1111-1111-1111-111111111111"
    ]
  },
  "rate_limits": null,
  "ip_rules": null,
  "legacy_spend_caps": [],
  "is_provisioning": false,
  "expires_at": null,
  "created_at": "2026-11-02T09:14:22.501Z",
  "revoked_at": null
}

https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys/11111111-1111-1111-1111-111111111111