Platform API reference

Platform API · Workspace-Policies

post/v1/workspaces/{workspace_slug}/policiesAuth

Create a managed policy. Cookie/JWT only — policy authoring is a human-admin surface.

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.

Headers

Idempotency-Keystring

Opaque client-generated string (1-256 chars, `[A-Za-z0-9._:-]`) that deduplicates retries for 24 h. A retry with the same key and body returns the first response with `Idempotent-Replay: true` instead of creating a second resource. The SDKs send one on every create.

Request body

name*string

Policy name (1-64 chars, alphanumeric + space/underscore/hyphen). Unique per workspace.

Example: "mail-readonly"

descriptionstring

Optional human description. Pass `null` to clear an existing description on PATCH.

Example: "Read-only access to all Mail resources"

policy*array

IAM-style policy. Empty array means "no permissions" — useful as a placeholder before granting any actions.

Example: [{"effect":"allow","actions":["mail.read","mail.list"],"resources":["*"]}]

Response · 201 Policy created.

id*string · uuid

Id of the policy.

workspace_id*string · uuid

Id of the workspace that owns the policy.

name*string

Name of the policy, unique in the workspace.

Example: "mail-readonly"

description*string

What the policy is for, when set.

policy*array

IAM-style policy statements bound to this managed policy.

preset_key*object

The workspace-key preset this policy was created from, or null for a policy a person wrote. Minting a key with `preset` creates this policy once per workspace and reuses it. It stays set after the policy is edited, so show it as "based on preset".

Example: "mail-send"

created_by*string · uuid

Account that authored the row. Only revealed to callers with `workspace.audit.read`; plain members see null.

created_at*string · date-time

When the policy was created.

updated_at*string · date-time

When the policy was last changed.

Example

Request

POST https://api.platform-auth.productcraft.co/v1/workspaces/{workspace_slug}/policies
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "name": "mail-readonly",
  "description": "Read-only access to all Mail resources",
  "policy": [
    {
      "effect": "allow",
      "actions": [
        "mail.read",
        "mail.list"
      ],
      "resources": [
        "*"
      ]
    }
  ]
}

Response

{
  "id": "00000000-0000-0000-0000-000000000000",
  "workspace_id": "00000000-0000-0000-0000-000000000000",
  "name": "mail-readonly",
  "description": "string",
  "policy": [
    {
      "effect": "allow",
      "actions": [
        "social.read",
        "social.list"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "preset_key": "mail-send",
  "created_by": "00000000-0000-0000-0000-000000000000",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}