Platform API reference

Platform API · Platform-Api-Keys

patch/v1/workspaces/{workspace_slug}/api-keys/{id}/bindingsAuth

Replace the managed-policy bindings on a PAK. Re-runs caller-narrowing on the merged union of statements.

Path parameters

workspace_slug*string

Slug of the workspace. Platform routes name the workspace by slug, positionally in the SDK (`platform.workspaces.retrieve("acme")`); the product APIs bind `workspace_id` instead.

id*string · uuid

Id of the api key.

Request body

policy_ids*array

Replacement set of managed-policy IDs. Empty array is rejected — revoke the PAK to disable it.

Example: ["11111111-1111-1111-1111-111111111111"]

Response · 200 Updated PAK with new bindings.

id*string · uuid

Id of the key.

workspace_id*string · uuid

Id of the workspace the key belongs to.

created_by*string · uuid

Account id of who minted the key, or `null` when that account is gone.

name*string

Name of the key.

description*string

What the key is for, when set.

token_prefix*string

The first ~14 chars of the token (prefix). Plaintext token is never returned after mint.

Example: "pcft_live_abc123"

policies*array

Managed policies currently bound to this PAK.

last_used_at*string · date-time

When the key last authenticated a request, or `null` if never.

revoked_at*string · date-time

When the key was revoked, or `null` while it is not.

expires_at*string · date-time

When this key stops introspecting. `null` means it never expires.

rotated_from*string · uuid

Id of the key this one replaced, when it was minted by a rotation.

status*object

Lifecycle state at the time of the request. Only `active` keys introspect. `revoked` beats `expired` — revocation is a deliberate act by a named actor and the row keeps saying so.

created_at*string · date-time

When the key was minted.

updated_at*string · date-time

When the key was last changed.

Example

Request

PATCH https://api.platform-auth.productcraft.co/v1/workspaces/{workspace_slug}/api-keys/{id}/bindings
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "policy_ids": [
    "11111111-1111-1111-1111-111111111111"
  ]
}

Response

{
  "id": "00000000-0000-0000-0000-000000000000",
  "workspace_id": "00000000-0000-0000-0000-000000000000",
  "created_by": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "description": "string",
  "token_prefix": "pcft_live_abc123",
  "policies": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "mail-readonly",
      "description": "string"
    }
  ],
  "last_used_at": "2026-01-01T00:00:00.000Z",
  "revoked_at": "2026-01-01T00:00:00.000Z",
  "expires_at": "2026-01-01T00:00:00.000Z",
  "rotated_from": "00000000-0000-0000-0000-000000000000",
  "status": {},
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}