POST
POST /v1/organizations/federation_rules?beta=true — Claude API
Beta
Anthropic API key (required); https://api.anthropic.com
Claude APICreate Federation Rule
- Base URL
- https://api.anthropic.com
- Auth
- x-api-key: <ANTHROPIC_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 396 tokens · Vary: Accept
→ 396 tokens · Vary: Accept
Critical gotchas
Authentication uses the x-api-key header and requests also require an anthropic-version header.
The official OpenAPI URL is discovered from the SDK repository manifest and must remain under Anthropic's trusted Stainless storage prefix.
cURL
curl -X POST 'https://api.anthropic.com/v1/organizations/federation_rules?beta=true' \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H 'anthropic-version: 2023-06-01' \ -H 'Content-Type: application/json' \ -d '{ "issuer_id": "issuer-id", "match": { "audience": "example-audience", "claims": {}, "condition": "example-condition", "subject_prefix": "example-subject-prefix" }, "name": "example-name", "oauth_scope": "example-oauth-scope", "target": { "service_account_id": "example-service-account-id", "service_account_name": "example-service-account-name", "type": "example-type" }}'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| applies_to_all_workspaces | body | boolean | No | When true, enable this rule for every workspace in the org (including workspaces created later). |
| attributes | body | object | No | CEL expressions `{name: expr}` extracting named values from claims. Not yet supported; any non-empty value is rejected with 400. |
| description | body | string | No | Optional free-text description. |
| issuer_id | body | string | Yes | Tagged ID of the federation issuer. |
| match | body | object | Yes | Does the incoming JWT qualify? All populated fields must pass; omitted fields are skipped. At least one of `subject_prefix` (other than a wildcard-only value like `*`), `claims`, or `condition` is required; `audience` alone is not sufficient. |
| name | body | string | Yes | Slug identifier (lowercase, digits, hyphens). Unique within the organization; a duplicate name returns 409. |
| oauth_scope | body | string | Yes | Space-separated OAuth scopes. OAuth callers may only set `workspace:developer` or `workspace:inference`; other scopes (such as `org:admin`) require a Console session. |
| target | body | object | Yes | Bind to a fixed service account by ID. |
| token_lifetime_seconds | body | integer | No | Lifetime in seconds for access tokens minted via this rule (60-86400). Defaults to 3600 (1h). Minted tokens are capped at `max(60, min(this value, 2 × remaining assertion validity))` seconds. |
| workspace_id | body | string | No | Tagged ID of the workspace to enable this rule for. Required unless `applies_to_all_workspaces` is true. Additional workspaces can be added via the `/federation_rules/{federation_rule_id}/workspaces` sub-resource. |
Response 200 OK
{
"applies_to_all_workspaces": true,
"archived_at": "2026-09-03T00:00:00Z",
"archived_by_actor_id": "string",
"attributes": {},
"created_at": "2026-09-03T00:00:00Z",
"created_by_actor_id": "string",
"description": "string",
"id": "string",
"issuer_id": "string",
"issuer_name": "string",
"match": {
"audience": "string",
"claims": {},
"condition": "string",
"subject_prefix": "string"
},
"name": "string",
"oauth_scope": "string",
"target": {
"service_account_id": "string",
"service_account_name": "string",
"type": "string"
},
"token_lifetime_seconds": 0,
"type": "federation_rule",
"updated_at": "2026-09-03T00:00:00Z",
"updated_by_actor_id": "string",
"workspace_id": "string",
"workspace_ids": [
"string"
]
} Get a free Claude API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.