@canopy-io/node 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1522,7 +1522,7 @@ interface paths {
1522
1522
  put?: never;
1523
1523
  /**
1524
1524
  * Add a member to an organization
1525
- * @description Adds a member. Membership is admission, not authority: with `role_id` the member also holds that role at the organization node from the start; without it they belong and hold nothing until a role is assigned. The identity must already hold an active membership in this Environment (invite by email instead for someone who does not). An identity that is already a member returns `409`; roles are added through the assignment routes. Requires the `rbac.manage_assignments` permission at the organization and emits `organization.member.added`. An organization's own administrator, signed in with an identity token and admitted by `canopy:organization.manage` alone, is refused with `403` (`organization.member_add_requires_invite`): the person never agreed to join, so the administrator invites them instead.
1525
+ * @description Adds a member. Membership is admission, not authority: with `role_id` the member also holds that role from the start, at the organization node or at the office or team `node_id` names, for the `effective_from` to `effective_to` window when given; without it they belong and hold nothing until a role is assigned (a place or dates need a role, `400 invite.window_requires_role`). The identity must already hold an active membership in this Environment (invite by email instead for someone who does not). An identity that is already a member returns `409`; roles are added through the assignment routes. Requires the `rbac.manage_assignments` permission at the organization and emits `organization.member.added`. An organization's own administrator, signed in with an identity token and admitted by `canopy:organization.manage` alone, is refused with `403` (`organization.member_add_requires_invite`): the person never agreed to join, so the administrator invites them instead.
1526
1526
  */
1527
1527
  post: operations["ApiOrganizationsController_addMember"];
1528
1528
  delete?: never;
@@ -1586,7 +1586,7 @@ interface paths {
1586
1586
  put?: never;
1587
1587
  /**
1588
1588
  * Invite a member into an organization
1589
- * @description Invites an email into the organization with the role bound to the invitation; acceptance creates the Environment membership and the organization membership in one step. Works for emails with no identity in the Environment — one is created on acceptance. Requires the `identity.manage` permission and emits `invite.created`.
1589
+ * @description Invites an email into the organization. `role_id` is held on acceptance at `node_id`, the organization node (the default) or an office or team beneath it, for the `effective_from` to `effective_to` window when given; with no `role_id` the invitation admits a member holding nothing, which only the organization node allows (`400 invite.malformed_assignment` beneath it). Acceptance creates what is missing in one transaction: the identity, its Environment membership, the organization membership and the role. For someone who already holds an active membership in this Environment the invitation is a request to join (`intent: grant`): accepting is their consent, proven by their password or their own sign-in. Requires the `identity.manage` permission, or `canopy:organization.manage` at the organization or `canopy:access.manage` at the place for the organization's own administrators, and emits `invite.created`.
1590
1590
  */
1591
1591
  post: operations["ApiOrganizationsController_createInvite"];
1592
1592
  delete?: never;
@@ -1976,13 +1976,13 @@ interface paths {
1976
1976
  };
1977
1977
  /**
1978
1978
  * List roles
1979
- * @description Returns the roles defined for the active Application within the current Environment as an unpaginated `{ items }` collection, each enriched with a `permission_count`. By default only active roles are returned; pass `include_inactive=true` to include deactivated roles, and filter by `type=system` or `type=custom`. Requires the `rbac.view_roles` permission.
1979
+ * @description Returns the roles defined for the active Application within the current Environment as an unpaginated `{ items }` collection, each enriched with a `permission_count`, its `scope` and `organization_node_id`. By default only the Environment's own roles are returned, the ones assignable in every organization; `organization_id` lists one organization's own roles, `scope=available` with it what can be held inside that organization (its own and the Environment's), and `scope=all` every role. By default only active roles are returned; pass `include_inactive=true` to include deactivated roles, and filter by `type=system` or `type=custom`. An `organization_id` that is not a live organization returns `404`. Requires the `rbac.view_roles` permission.
1980
1980
  */
1981
1981
  get: operations["ApiRolesController_listRoles"];
1982
1982
  put?: never;
1983
1983
  /**
1984
1984
  * Create a custom role
1985
- * @description Creates a custom role in the active Application for the current Environment from a `name` and optional `description`. The new role is always non-system and starts with no permissions — attach permission keys via the role-permissions endpoint. A name that already exists in the Environment returns `409`. Requires the `rbac.manage_roles` permission and emits a `role.created` audit event.
1985
+ * @description Creates a custom role in the active Application for the current Environment from a `name` and optional `description`. Without `organization_id` it is an Environment role, assignable in every organization; with it, the role belongs to that organization and can be held only at its node or beneath it (`400 rbac.role_outside_organization` elsewhere). The new role is always non-system and starts with no permissions, or with a copy of `copy_from_role_id`'s (an Environment role, or one of the same organization) — otherwise attach permission keys via the role-permissions endpoint. A name already used in the same tier (the Environment's roles, or that organization's own) returns `409`. Requires the `rbac.manage_roles` permission and emits a `role.created` audit event.
1986
1986
  */
1987
1987
  post: operations["ApiRolesController_createRole"];
1988
1988
  delete?: never;
@@ -2450,7 +2450,7 @@ interface paths {
2450
2450
  put?: never;
2451
2451
  /**
2452
2452
  * Register a new OAuth client
2453
- * @description Registers a new confidential OAuth client in the current Environment with the given `name`, `redirect_uris`, and optional `scopes` (defaulting to `openid profile email`), each one of `openid`, `profile`, `email`, `org` and `permissions`; any other value is refused with `400` (`oauth.client_scope_unknown`). Generates the `client_id` and a `client_secret` that is bcrypt-hashed at rest; the raw secret is returned in this response only and is never retrievable again. Responds `201 Created`.
2453
+ * @description Registers a new confidential OAuth client in the current Environment with the given `name`, `redirect_uris`, and optional `scopes` (defaulting to `openid profile email`), each one of `openid`, `profile`, `email`, `org` and `permissions`; any other value is refused with `400` (`oauth.client_scope_unknown`). With `client_kind: machine` it registers a machine client instead: a principal of its own that holds roles (see the assignments routes) and obtains tokens for itself, with an optional `organization_node_id` (the one organization it acts in), optional `allowed_audiences` and the `permissions` scope, the `client_credentials` grant only and no redirect URIs; it counts toward the plan's machine-credential allowance (`409 plan_limit_exceeded`). Generates the `client_id` and a `client_secret` that is bcrypt-hashed at rest; the raw secret is returned in this response only and is never retrievable again. Responds `201 Created`.
2454
2454
  */
2455
2455
  post: operations["ApiOAuthClientsController_create"];
2456
2456
  delete?: never;
@@ -2527,6 +2527,74 @@ interface paths {
2527
2527
  patch?: never;
2528
2528
  trace?: never;
2529
2529
  };
2530
+ "/api/v1/oauth-clients/{id}/assignments": {
2531
+ parameters: {
2532
+ query?: never;
2533
+ header?: never;
2534
+ path?: never;
2535
+ cookie?: never;
2536
+ };
2537
+ /**
2538
+ * List a machine client's role assignments
2539
+ * @description Returns one page of the machine client's role assignments in the current Environment, each with its role and node, searched by role or node name with `q` and sorted with the standard options. `id` is the client's `client_id`. A web client answers `400` (`oauth.client_not_machine`): only a machine client holds roles.
2540
+ */
2541
+ get: operations["ApiOAuthClientsController_listAssignments"];
2542
+ put?: never;
2543
+ /**
2544
+ * Assign a role to a machine client at a node
2545
+ * @description Gives the machine client `role_id` at `node_id`, optionally for a window (`effective_from`, `effective_to`), through the same grant writer and grant ceiling every assignment passes: the caller must hold `rbac.manage_assignments` at the node and may only grant roles they are allowed to. A client pinned to an organization holds roles only at or beneath that organization's node (`409 oauth.client_outside_organization`). Responds `201 Created` with the assignment.
2546
+ */
2547
+ post: operations["ApiOAuthClientsController_assignRole"];
2548
+ delete?: never;
2549
+ options?: never;
2550
+ head?: never;
2551
+ patch?: never;
2552
+ trace?: never;
2553
+ };
2554
+ "/api/v1/oauth-clients/{id}/assignments/{assignmentId}": {
2555
+ parameters: {
2556
+ query?: never;
2557
+ header?: never;
2558
+ path?: never;
2559
+ cookie?: never;
2560
+ };
2561
+ get?: never;
2562
+ put?: never;
2563
+ post?: never;
2564
+ /**
2565
+ * Remove a machine client's assignment
2566
+ * @description Takes one of the machine client's assignments away; an assignment held by anyone else reads as `404`. Responds `204 No Content`.
2567
+ */
2568
+ delete: operations["ApiOAuthClientsController_removeAssignment"];
2569
+ options?: never;
2570
+ head?: never;
2571
+ /**
2572
+ * Change a machine client's assignment
2573
+ * @description Changes the role or the window of one of the machine client's assignments; an assignment held by anyone else reads as `404`. Send `If-Match` with the assignment's `version` to refuse a stale write (`409 assignment.version_mismatch`).
2574
+ */
2575
+ patch: operations["ApiOAuthClientsController_updateAssignment"];
2576
+ trace?: never;
2577
+ };
2578
+ "/api/v1/oauth-clients/{id}/grants": {
2579
+ parameters: {
2580
+ query?: never;
2581
+ header?: never;
2582
+ path?: never;
2583
+ cookie?: never;
2584
+ };
2585
+ /**
2586
+ * Get where a machine client holds each permission
2587
+ * @description Returns one page of where the machine client holds each permission: `(permission, node_id)` pairs at the nodes its active roles were granted at, not expanded through descendants, with `model_version` beside the page so an SDK can cache and evaluate locally. `id` is the client's `client_id`, the `sub` of its tokens. A deactivated client answers an empty page. `include=windows` returns every assignment with its window instead of only those in effect now.
2588
+ */
2589
+ get: operations["ApiOAuthClientsController_getGrants"];
2590
+ put?: never;
2591
+ post?: never;
2592
+ delete?: never;
2593
+ options?: never;
2594
+ head?: never;
2595
+ patch?: never;
2596
+ trace?: never;
2597
+ };
2530
2598
  "/api/v1/api-keys": {
2531
2599
  parameters: {
2532
2600
  query?: never;
@@ -2910,9 +2978,16 @@ interface components {
2910
2978
  };
2911
2979
  AssignmentResponseDto: {
2912
2980
  id: string;
2913
- identity_id: string;
2981
+ /** @description The identity holding the role; null when a machine client holds it. */
2982
+ identity_id: string | null;
2983
+ /** @description The machine OAuth client holding the role; null when a person holds it. */
2984
+ oauth_client_id: string | null;
2914
2985
  application_node_id: string;
2915
2986
  role_id: string;
2987
+ /** @description The role's name, when the read loaded it. */
2988
+ role_name: string | null;
2989
+ /** @description The node's name, when the read loaded it. */
2990
+ node_name: string | null;
2916
2991
  /** Format: date-time */
2917
2992
  effective_from?: string | null;
2918
2993
  /** Format: date-time */
@@ -2968,12 +3043,28 @@ interface components {
2968
3043
  name: string;
2969
3044
  role_id?: string | null;
2970
3045
  node_id?: string | null;
3046
+ /** @description The name of the node at `node_id`, when it has one. */
3047
+ node_name?: string | null;
3048
+ /** @description The organization the invitation joins, when `node_id` is an organization node or sits beneath one. */
3049
+ organization_node_id?: string | null;
3050
+ /**
3051
+ * Format: date-time
3052
+ * @description When the role it grants starts to count.
3053
+ */
3054
+ effective_from?: string | null;
3055
+ /**
3056
+ * Format: date-time
3057
+ * @description When the role it grants stops counting.
3058
+ */
3059
+ effective_to?: string | null;
2971
3060
  has_initial_assignment: boolean;
2972
3061
  /** @enum {string} */
2973
3062
  status: "pending" | "accepted" | "revoked" | "expired";
2974
3063
  /** Format: date-time */
2975
3064
  expires_at: string;
2976
3065
  invited_by: string;
3066
+ /** @description The customer's own administrator who sent it with their identity token; `invited_by` names a platform user instead. */
3067
+ invited_by_identity_id?: string | null;
2977
3068
  /** Format: date-time */
2978
3069
  created_at: string;
2979
3070
  };
@@ -2999,12 +3090,28 @@ interface components {
2999
3090
  name: string;
3000
3091
  role_id?: string | null;
3001
3092
  node_id?: string | null;
3093
+ /** @description The name of the node at `node_id`, when it has one. */
3094
+ node_name?: string | null;
3095
+ /** @description The organization the invitation joins, when `node_id` is an organization node or sits beneath one. */
3096
+ organization_node_id?: string | null;
3097
+ /**
3098
+ * Format: date-time
3099
+ * @description When the role it grants starts to count.
3100
+ */
3101
+ effective_from?: string | null;
3102
+ /**
3103
+ * Format: date-time
3104
+ * @description When the role it grants stops counting.
3105
+ */
3106
+ effective_to?: string | null;
3002
3107
  has_initial_assignment: boolean;
3003
3108
  /** @enum {string} */
3004
3109
  status: "pending" | "accepted" | "revoked" | "expired";
3005
3110
  /** Format: date-time */
3006
3111
  expires_at: string;
3007
3112
  invited_by: string;
3113
+ /** @description The customer's own administrator who sent it with their identity token; `invited_by` names a platform user instead. */
3114
+ invited_by_identity_id?: string | null;
3008
3115
  /** Format: date-time */
3009
3116
  created_at: string;
3010
3117
  /** @description Tokenized URL the invitee would land on. Returned so callers that pass send_email=false can deliver it themselves. */
@@ -3023,7 +3130,7 @@ interface components {
3023
3130
  first_name?: string;
3024
3131
  /** @description Required for `activate`. Ignored for `add_to_app` and `password_reset`. */
3025
3132
  last_name?: string;
3026
- /** @description Role ID — required if node_id is provided */
3133
+ /** @description The role the invitation grants at `node_id`. Required with a `node_id`, except an organization node, where an invitation may admit a member with no role. */
3027
3134
  role_id?: string;
3028
3135
  /** @description Node ID — required if role_id is provided */
3029
3136
  node_id?: string;
@@ -3032,6 +3139,16 @@ interface components {
3032
3139
  * @default true
3033
3140
  */
3034
3141
  send_email: boolean;
3142
+ /**
3143
+ * Format: date-time
3144
+ * @description When the role starts to count (ISO 8601). Copied onto the assignment the invitation grants; needs a role.
3145
+ */
3146
+ effective_from?: string;
3147
+ /**
3148
+ * Format: date-time
3149
+ * @description When the role stops counting (ISO 8601), after `effective_from`. Copied onto the assignment; an invitation whose window has ended by acceptance is refused with `400 invite.window_ended`.
3150
+ */
3151
+ effective_to?: string;
3035
3152
  };
3036
3153
  BulkCreateIdentityInvitesDto: {
3037
3154
  invites: components["schemas"]["CreateIdentityInviteDto"][];
@@ -3212,8 +3329,16 @@ interface components {
3212
3329
  };
3213
3330
  RoleResponseDto: {
3214
3331
  id: string;
3215
- application_id: string;
3216
3332
  name: string;
3333
+ /**
3334
+ * @description `environment`: assignable in every organization. `organization`: belongs to the organization `organization_node_id` names and is held only inside it.
3335
+ * @enum {string}
3336
+ */
3337
+ scope: "environment" | "organization";
3338
+ /** @description The organization this role belongs to; null for an Environment role. */
3339
+ organization_node_id?: string | null;
3340
+ /** @description The name of the organization this role belongs to. Populated on list responses; null for an Environment role. */
3341
+ organization_name?: string | null;
3217
3342
  description?: string | null;
3218
3343
  is_system_role: boolean;
3219
3344
  system_key?: string | null;
@@ -3495,12 +3620,36 @@ interface components {
3495
3620
  identity_id: string;
3496
3621
  /** @description A role to hold at the organization node from the start, from the Environment's roles. Left out, the member belongs and holds nothing until a role is assigned. */
3497
3622
  role_id?: string;
3623
+ /** @description Where the role is held: the organization node (the default) or an office or team beneath it. Needs a role. */
3624
+ node_id?: string;
3625
+ /**
3626
+ * Format: date-time
3627
+ * @description When the role starts to count (ISO 8601). Needs a role.
3628
+ */
3629
+ effective_from?: string;
3630
+ /**
3631
+ * Format: date-time
3632
+ * @description When the role stops counting (ISO 8601), after `effective_from`. Needs a role.
3633
+ */
3634
+ effective_to?: string;
3498
3635
  };
3499
3636
  CreateOrganizationInviteDto: {
3500
3637
  /** @description Email to invite. Works for people with no identity in this Environment — one is created when they accept. */
3501
3638
  email: string;
3502
- /** @description The role the member will hold in this organization on acceptance. */
3503
- role_id: string;
3639
+ /** @description The role the person holds on acceptance, at `node_id`. Optional at the organization node, where accepting admits a member with no role; required for a place beneath it. */
3640
+ role_id?: string;
3641
+ /** @description Where the role is held: the organization node (the default) or an office or team beneath it. Accepting admits the person to the organization either way. */
3642
+ node_id?: string;
3643
+ /**
3644
+ * Format: date-time
3645
+ * @description When the role starts to count (ISO 8601). Copied onto the assignment the invitation grants; needs a role.
3646
+ */
3647
+ effective_from?: string;
3648
+ /**
3649
+ * Format: date-time
3650
+ * @description When the role stops counting (ISO 8601), after `effective_from`. Copied onto the assignment; an invitation whose window has ended by acceptance is refused with `400 invite.window_ended`.
3651
+ */
3652
+ effective_to?: string;
3504
3653
  first_name?: string;
3505
3654
  last_name?: string;
3506
3655
  /**
@@ -3511,8 +3660,16 @@ interface components {
3511
3660
  };
3512
3661
  OrganizationRoleResponseDto: {
3513
3662
  id: string;
3514
- application_id: string;
3515
3663
  name: string;
3664
+ /**
3665
+ * @description `environment`: assignable in every organization. `organization`: belongs to the organization `organization_node_id` names and is held only inside it.
3666
+ * @enum {string}
3667
+ */
3668
+ scope: "environment" | "organization";
3669
+ /** @description The organization this role belongs to; null for an Environment role. */
3670
+ organization_node_id?: string | null;
3671
+ /** @description The name of the organization this role belongs to. Populated on list responses; null for an Environment role. */
3672
+ organization_name?: string | null;
3516
3673
  description?: string | null;
3517
3674
  is_system_role: boolean;
3518
3675
  system_key?: string | null;
@@ -3805,10 +3962,14 @@ interface components {
3805
3962
  role_id: string;
3806
3963
  };
3807
3964
  CreateRoleDto: {
3808
- /** @description Role name */
3965
+ /** @description Role name, unique among the Environment's roles, or among the organization's own when `organization_id` is set */
3809
3966
  name: string;
3810
3967
  /** @description Role description */
3811
3968
  description?: string;
3969
+ /** @description The organization the role belongs to. Omitted, the role is an Environment role, assignable in every organization; set, it can be held only at the organization's node or beneath it. */
3970
+ organization_id?: string;
3971
+ /** @description Start from a copy of this role's permissions (and its description, when none is given). An Environment role, or a role of the same organization. The only way an organization gets its own version of a shared role. */
3972
+ copy_from_role_id?: string;
3812
3973
  };
3813
3974
  UpdateRoleDto: {
3814
3975
  /** @description Updated role name */
@@ -4222,6 +4383,17 @@ interface components {
4222
4383
  id: string;
4223
4384
  client_id: string;
4224
4385
  name: string;
4386
+ /**
4387
+ * @description `web`: a person signs in through it. `machine`: it holds roles of its own and obtains tokens for itself with `client_credentials`.
4388
+ * @enum {string}
4389
+ */
4390
+ client_kind: "web" | "machine";
4391
+ /** @description The organization a machine client acts in: its tokens name it and its roles sit inside it. Null for a client that acts across the Environment, and for a web client. */
4392
+ organization_node_id?: string | null;
4393
+ /** @description That organization's name; null when the client has none. */
4394
+ organization_name?: string | null;
4395
+ /** @description The audiences a machine client may request a token for, beside the Environment's default. Empty for a web client. */
4396
+ allowed_audiences: string[];
4225
4397
  redirect_uris: string[];
4226
4398
  /** @description Where this client may send someone after RP-initiated logout, matched exactly. */
4227
4399
  post_logout_redirect_uris: string[];
@@ -4245,9 +4417,25 @@ interface components {
4245
4417
  };
4246
4418
  CreateOAuthClientDto: {
4247
4419
  name: string;
4248
- redirect_uris: string[];
4420
+ /**
4421
+ * @description `web` (when omitted): a person signs in through this client with the authorization code grant. `machine`: the client is a principal of its own that holds roles and obtains tokens for itself with the `client_credentials` grant, for the audiences it lists, inside at most one organization; it takes no redirect URIs or sign-in fields.
4422
+ * @enum {string}
4423
+ */
4424
+ client_kind?: "web" | "machine";
4425
+ /** @description Machine clients only: the organization the client acts in. Its tokens name it and it may hold roles only inside it. Omitted, the client acts across the Environment. */
4426
+ organization_node_id?: string;
4427
+ /**
4428
+ * @description For a machine client: the audiences (your APIs' identifiers) it may request a token for with `audience`, beside the Environment's `m2m_default_audience`. The token's `aud` names the one asked for.
4429
+ * @example [
4430
+ * "https://api.example.com"
4431
+ * ]
4432
+ */
4433
+ allowed_audiences?: string[];
4434
+ /** @description Required for a web client; a machine client has none. */
4435
+ redirect_uris?: string[];
4249
4436
  /** @description Where this client may send someone after RP-initiated logout. Matched exactly, and separate from `redirect_uris`: receiving an authorization code and being a landing page after sign-out are different kinds of trust. */
4250
4437
  post_logout_redirect_uris?: string[];
4438
+ /** @description What the client's tokens may carry. Omitted, a web client gets `openid`, `profile` and `email`; a machine client gets `permissions`, the only scope it may hold. */
4251
4439
  scopes?: string[];
4252
4440
  /** @description Where Canopy delivers a signed logout token, server to server, when a session this client issued tokens for ends. Omit it and the client is told nothing. */
4253
4441
  backchannel_logout_uri?: string;
@@ -4259,6 +4447,17 @@ interface components {
4259
4447
  id: string;
4260
4448
  client_id: string;
4261
4449
  name: string;
4450
+ /**
4451
+ * @description `web`: a person signs in through it. `machine`: it holds roles of its own and obtains tokens for itself with `client_credentials`.
4452
+ * @enum {string}
4453
+ */
4454
+ client_kind: "web" | "machine";
4455
+ /** @description The organization a machine client acts in: its tokens name it and its roles sit inside it. Null for a client that acts across the Environment, and for a web client. */
4456
+ organization_node_id?: string | null;
4457
+ /** @description That organization's name; null when the client has none. */
4458
+ organization_name?: string | null;
4459
+ /** @description The audiences a machine client may request a token for, beside the Environment's default. Empty for a web client. */
4460
+ allowed_audiences: string[];
4262
4461
  redirect_uris: string[];
4263
4462
  /** @description Where this client may send someone after RP-initiated logout, matched exactly. */
4264
4463
  post_logout_redirect_uris: string[];
@@ -4292,6 +4491,8 @@ interface components {
4292
4491
  post_logout_redirect_uris?: string[];
4293
4492
  scopes?: string[];
4294
4493
  is_active?: boolean;
4494
+ /** @description A machine client's audiences, replaced whole. A web client takes none (`400 oauth.web_client_audiences_invalid`). */
4495
+ allowed_audiences?: string[];
4295
4496
  /** @description Where Canopy delivers a signed logout token when a session this client issued tokens for ends. `null` stops the notifications. */
4296
4497
  backchannel_logout_uri?: string | null;
4297
4498
  invite_redirect_url?: string | null;
@@ -4303,6 +4504,16 @@ interface components {
4303
4504
  /** @description New client secret — shown only once */
4304
4505
  client_secret: string;
4305
4506
  };
4507
+ CreateOAuthClientAssignmentDto: {
4508
+ /** @description The node the role is held at. */
4509
+ node_id: string;
4510
+ /** @description The role the client holds there. */
4511
+ role_id: string;
4512
+ /** @description When the role starts to apply. Omitted, from now. */
4513
+ effective_from?: string;
4514
+ /** @description When the role stops applying. Omitted, never. */
4515
+ effective_to?: string;
4516
+ };
4306
4517
  ApiKeyCreatedResponseDto: {
4307
4518
  id: string;
4308
4519
  name: string;
@@ -4566,9 +4777,16 @@ interface components {
4566
4777
  metadata: {
4567
4778
  /**
4568
4779
  * Format: uuid
4569
- * @description The identity holding the assignment.
4780
+ * @description The identity holding the assignment; null when a machine client holds it.
4570
4781
  */
4571
- identity_id: string;
4782
+ identity_id: string | null;
4783
+ /**
4784
+ * Format: uuid
4785
+ * @description The machine OAuth client holding the assignment; null when a person holds it.
4786
+ */
4787
+ oauth_client_id: string | null;
4788
+ /** @description That machine client's `client_id`: its token's `sub`, the id its grants route takes and an SDK cache names it by. Null when a person holds the assignment. */
4789
+ client_id: string | null;
4572
4790
  /**
4573
4791
  * Format: uuid
4574
4792
  * @description The hierarchy node the role is held at.
@@ -4597,9 +4815,16 @@ interface components {
4597
4815
  metadata: {
4598
4816
  /**
4599
4817
  * Format: uuid
4600
- * @description The identity holding the assignment.
4818
+ * @description The identity holding the assignment; null when a machine client holds it.
4601
4819
  */
4602
- identity_id: string;
4820
+ identity_id: string | null;
4821
+ /**
4822
+ * Format: uuid
4823
+ * @description The machine OAuth client holding the assignment; null when a person holds it.
4824
+ */
4825
+ oauth_client_id: string | null;
4826
+ /** @description That machine client's `client_id`: its token's `sub`, the id its grants route takes and an SDK cache names it by. Null when a person holds the assignment. */
4827
+ client_id: string | null;
4603
4828
  /**
4604
4829
  * Format: uuid
4605
4830
  * @description The hierarchy node the role is held at.
@@ -4623,9 +4848,16 @@ interface components {
4623
4848
  metadata: {
4624
4849
  /**
4625
4850
  * Format: uuid
4626
- * @description The identity holding the assignment.
4851
+ * @description The identity holding the assignment; null when a machine client holds it.
4627
4852
  */
4628
- identity_id: string;
4853
+ identity_id: string | null;
4854
+ /**
4855
+ * Format: uuid
4856
+ * @description The machine OAuth client holding the assignment; null when a person holds it.
4857
+ */
4858
+ oauth_client_id: string | null;
4859
+ /** @description That machine client's `client_id`: its token's `sub`, the id its grants route takes and an SDK cache names it by. Null when a person holds the assignment. */
4860
+ client_id: string | null;
4629
4861
  /**
4630
4862
  * Format: uuid
4631
4863
  * @description The hierarchy node the role is held at.
@@ -4680,9 +4912,16 @@ interface components {
4680
4912
  affected: {
4681
4913
  /**
4682
4914
  * Format: uuid
4683
- * @description The identity holding the assignment.
4915
+ * @description The identity holding the assignment; null when a machine client holds it.
4916
+ */
4917
+ identity_id: string | null;
4918
+ /**
4919
+ * Format: uuid
4920
+ * @description The machine OAuth client holding the assignment; null when a person holds it.
4684
4921
  */
4685
- identity_id: string;
4922
+ oauth_client_id?: string | null;
4923
+ /** @description That machine client's `client_id`: its token's `sub`, the id its grants route takes and an SDK cache names it by. Null when a person holds the assignment. */
4924
+ client_id?: string | null;
4686
4925
  /**
4687
4926
  * Format: uuid
4688
4927
  * @description The hierarchy node the role is held at.
@@ -4726,9 +4965,9 @@ interface components {
4726
4965
  affected: {
4727
4966
  /**
4728
4967
  * Format: uuid
4729
- * @description The identity holding the assignment.
4968
+ * @description The identity holding the assignment; null when a machine client holds it.
4730
4969
  */
4731
- identity_id: string;
4970
+ identity_id: string | null;
4732
4971
  /**
4733
4972
  * Format: uuid
4734
4973
  * @description The hierarchy node the role is held at.
@@ -4992,6 +5231,11 @@ interface components {
4992
5231
  metadata: {
4993
5232
  /** @description The role's name. */
4994
5233
  name: string;
5234
+ /**
5235
+ * Format: uuid
5236
+ * @description The role whose permissions it started from, when it was created as a copy.
5237
+ */
5238
+ copied_from_role_id?: string;
4995
5239
  };
4996
5240
  };
4997
5241
  };
@@ -6668,7 +6912,7 @@ interface operations {
6668
6912
  };
6669
6913
  };
6670
6914
  };
6671
- /** @description The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), or the role named for the initial assignment is a system role that cannot be assigned; or the request sent both an `X-API-Key` and an `Authorization` header */
6915
+ /** @description The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), or the role named for the initial assignment is a system role that cannot be assigned or an organization's own role placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
6672
6916
  400: {
6673
6917
  headers: {
6674
6918
  [name: string]: unknown;
@@ -6679,7 +6923,7 @@ interface operations {
6679
6923
  * "error": {
6680
6924
  * "statusCode": 400,
6681
6925
  * "code": null,
6682
- * "message": "The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), or the role named for the initial assignment is a system role that cannot be assigned; or the request sent both an `X-API-Key` and an `Authorization` header",
6926
+ * "message": "The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), or the role named for the initial assignment is a system role that cannot be assigned or an organization's own role placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
6683
6927
  * "timestamp": "2026-04-20T12:00:00.000Z",
6684
6928
  * "path": "/api/v1/identities",
6685
6929
  * "method": "POST"
@@ -9103,7 +9347,7 @@ interface operations {
9103
9347
  };
9104
9348
  };
9105
9349
  };
9106
- /** @description The request failed validation; `role_id` and `node_id` were not given together; a `password_reset` invite carries a role assignment or names an email with no identity; or `client_id` names no active OAuth client in this Environment, or one with no invite redirect URL; or the request sent both an `X-API-Key` and an `Authorization` header */
9350
+ /** @description The request failed validation; `role_id` came with no `node_id`, or a `node_id` with no `role_id` outside an organization node (`invite.malformed_assignment`); dates came with no role (`invite.window_requires_role`), end before they start, or have already ended (`invite.window_ended`); a `password_reset` invite carries a role assignment or names an email with no identity; or `client_id` names no active OAuth client in this Environment, or one with no invite redirect URL; or the request sent both an `X-API-Key` and an `Authorization` header */
9107
9351
  400: {
9108
9352
  headers: {
9109
9353
  [name: string]: unknown;
@@ -9114,7 +9358,7 @@ interface operations {
9114
9358
  * "error": {
9115
9359
  * "statusCode": 400,
9116
9360
  * "code": null,
9117
- * "message": "The request failed validation; `role_id` and `node_id` were not given together; a `password_reset` invite carries a role assignment or names an email with no identity; or `client_id` names no active OAuth client in this Environment, or one with no invite redirect URL; or the request sent both an `X-API-Key` and an `Authorization` header",
9361
+ * "message": "The request failed validation; `role_id` came with no `node_id`, or a `node_id` with no `role_id` outside an organization node (`invite.malformed_assignment`); dates came with no role (`invite.window_requires_role`), end before they start, or have already ended (`invite.window_ended`); a `password_reset` invite carries a role assignment or names an email with no identity; or `client_id` names no active OAuth client in this Environment, or one with no invite redirect URL; or the request sent both an `X-API-Key` and an `Authorization` header",
9118
9362
  * "timestamp": "2026-04-20T12:00:00.000Z",
9119
9363
  * "path": "/api/v1/identity-invites",
9120
9364
  * "method": "POST"
@@ -9166,7 +9410,7 @@ interface operations {
9166
9410
  "application/json": components["schemas"]["ErrorResponseDto"];
9167
9411
  };
9168
9412
  };
9169
- /** @description A pending invite already exists for this email at this scope, the identity already has access to this Environment, or the node sits inside an organization the identity is not a member of */
9413
+ /** @description A pending invite already exists for this email at this scope, the identity already has access to this Environment and the invitation joins no organization (`invite.identity_already_in_app`), or the identity is already an active member of the organization it joins (`organization.member_exists`) */
9170
9414
  409: {
9171
9415
  headers: {
9172
9416
  [name: string]: unknown;
@@ -9177,7 +9421,7 @@ interface operations {
9177
9421
  * "error": {
9178
9422
  * "statusCode": 409,
9179
9423
  * "code": null,
9180
- * "message": "A pending invite already exists for this email at this scope, the identity already has access to this Environment, or the node sits inside an organization the identity is not a member of",
9424
+ * "message": "A pending invite already exists for this email at this scope, the identity already has access to this Environment and the invitation joins no organization (`invite.identity_already_in_app`), or the identity is already an active member of the organization it joins (`organization.member_exists`)",
9181
9425
  * "timestamp": "2026-04-20T12:00:00.000Z",
9182
9426
  * "path": "/api/v1/identity-invites",
9183
9427
  * "method": "POST"
@@ -11723,7 +11967,7 @@ interface operations {
11723
11967
  };
11724
11968
  };
11725
11969
  };
11726
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header */
11970
+ /** @description The request failed validation, the role is inactive or a system role, the window does not start before it ends, or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
11727
11971
  400: {
11728
11972
  headers: {
11729
11973
  [name: string]: unknown;
@@ -11734,7 +11978,7 @@ interface operations {
11734
11978
  * "error": {
11735
11979
  * "statusCode": 400,
11736
11980
  * "code": null,
11737
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header",
11981
+ * "message": "The request failed validation, the role is inactive or a system role, the window does not start before it ends, or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
11738
11982
  * "timestamp": "2026-04-20T12:00:00.000Z",
11739
11983
  * "path": "/api/v1/organizations/{id}/assignments",
11740
11984
  * "method": "POST"
@@ -11986,7 +12230,7 @@ interface operations {
11986
12230
  };
11987
12231
  };
11988
12232
  };
11989
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header */
12233
+ /** @description The request failed validation, the new role is inactive or a system role, the window does not start before it ends, or an organization's own role would be held outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
11990
12234
  400: {
11991
12235
  headers: {
11992
12236
  [name: string]: unknown;
@@ -11997,7 +12241,7 @@ interface operations {
11997
12241
  * "error": {
11998
12242
  * "statusCode": 400,
11999
12243
  * "code": null,
12000
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header",
12244
+ * "message": "The request failed validation, the new role is inactive or a system role, the window does not start before it ends, or an organization's own role would be held outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
12001
12245
  * "timestamp": "2026-04-20T12:00:00.000Z",
12002
12246
  * "path": "/api/v1/organizations/{id}/assignments/{assignmentId}",
12003
12247
  * "method": "PATCH"
@@ -13934,7 +14178,7 @@ interface operations {
13934
14178
  };
13935
14179
  };
13936
14180
  };
13937
- /** @description The request failed validation; the connection is not in the account, is not an end-user connection, or is not bound to the organization's Environment; or the role is not an active, assignable arrival role in that Environment; or the request sent both an `X-API-Key` and an `Authorization` header */
14181
+ /** @description The request failed validation; the connection is not in the account, is not an end-user connection, or is not bound to the organization's Environment; or the role is not an active, assignable arrival role in that Environment, or is another organization's own (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
13938
14182
  400: {
13939
14183
  headers: {
13940
14184
  [name: string]: unknown;
@@ -13945,7 +14189,7 @@ interface operations {
13945
14189
  * "error": {
13946
14190
  * "statusCode": 400,
13947
14191
  * "code": null,
13948
- * "message": "The request failed validation; the connection is not in the account, is not an end-user connection, or is not bound to the organization's Environment; or the role is not an active, assignable arrival role in that Environment; or the request sent both an `X-API-Key` and an `Authorization` header",
14192
+ * "message": "The request failed validation; the connection is not in the account, is not an end-user connection, or is not bound to the organization's Environment; or the role is not an active, assignable arrival role in that Environment, or is another organization's own (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
13949
14193
  * "timestamp": "2026-04-20T12:00:00.000Z",
13950
14194
  * "path": "/api/v1/organizations/{id}/sso-connections",
13951
14195
  * "method": "POST"
@@ -14317,7 +14561,7 @@ interface operations {
14317
14561
  };
14318
14562
  };
14319
14563
  };
14320
- /** @description The request failed validation, or the role is a system role, which cannot be assigned; or the request sent both an `X-API-Key` and an `Authorization` header */
14564
+ /** @description The request failed validation, the role is a system role, which cannot be assigned, a place or dates came with no role (`invite.window_requires_role`), or the dates end before they start; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
14321
14565
  400: {
14322
14566
  headers: {
14323
14567
  [name: string]: unknown;
@@ -14328,7 +14572,7 @@ interface operations {
14328
14572
  * "error": {
14329
14573
  * "statusCode": 400,
14330
14574
  * "code": null,
14331
- * "message": "The request failed validation, or the role is a system role, which cannot be assigned; or the request sent both an `X-API-Key` and an `Authorization` header",
14575
+ * "message": "The request failed validation, the role is a system role, which cannot be assigned, a place or dates came with no role (`invite.window_requires_role`), or the dates end before they start; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
14332
14576
  * "timestamp": "2026-04-20T12:00:00.000Z",
14333
14577
  * "path": "/api/v1/organizations/{id}/members",
14334
14578
  * "method": "POST"
@@ -14380,7 +14624,7 @@ interface operations {
14380
14624
  "application/json": components["schemas"]["ErrorResponseDto"];
14381
14625
  };
14382
14626
  };
14383
- /** @description The organization, the identity or the role does not exist in this Environment */
14627
+ /** @description The organization, the identity or the role does not exist in this Environment, or `node_id` is not the organization or a place beneath it */
14384
14628
  404: {
14385
14629
  headers: {
14386
14630
  [name: string]: unknown;
@@ -14391,7 +14635,7 @@ interface operations {
14391
14635
  * "error": {
14392
14636
  * "statusCode": 404,
14393
14637
  * "code": null,
14394
- * "message": "The organization, the identity or the role does not exist in this Environment",
14638
+ * "message": "The organization, the identity or the role does not exist in this Environment, or `node_id` is not the organization or a place beneath it",
14395
14639
  * "timestamp": "2026-04-20T12:00:00.000Z",
14396
14640
  * "path": "/api/v1/organizations/{id}/members",
14397
14641
  * "method": "POST"
@@ -14824,7 +15068,7 @@ interface operations {
14824
15068
  };
14825
15069
  };
14826
15070
  };
14827
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header */
15071
+ /** @description The request failed validation; a place beneath the organization was named with no role (`invite.malformed_assignment`); dates came with no role (`invite.window_requires_role`), end before they start, or have already ended (`invite.window_ended`); or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
14828
15072
  400: {
14829
15073
  headers: {
14830
15074
  [name: string]: unknown;
@@ -14835,7 +15079,7 @@ interface operations {
14835
15079
  * "error": {
14836
15080
  * "statusCode": 400,
14837
15081
  * "code": null,
14838
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header",
15082
+ * "message": "The request failed validation; a place beneath the organization was named with no role (`invite.malformed_assignment`); dates came with no role (`invite.window_requires_role`), end before they start, or have already ended (`invite.window_ended`); or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
14839
15083
  * "timestamp": "2026-04-20T12:00:00.000Z",
14840
15084
  * "path": "/api/v1/organizations/{id}/invites",
14841
15085
  * "method": "POST"
@@ -14887,7 +15131,7 @@ interface operations {
14887
15131
  "application/json": components["schemas"]["ErrorResponseDto"];
14888
15132
  };
14889
15133
  };
14890
- /** @description Organization not found */
15134
+ /** @description The organization does not exist, or `node_id` is not the organization or a place beneath it */
14891
15135
  404: {
14892
15136
  headers: {
14893
15137
  [name: string]: unknown;
@@ -14898,7 +15142,7 @@ interface operations {
14898
15142
  * "error": {
14899
15143
  * "statusCode": 404,
14900
15144
  * "code": null,
14901
- * "message": "Organization not found",
15145
+ * "message": "The organization does not exist, or `node_id` is not the organization or a place beneath it",
14902
15146
  * "timestamp": "2026-04-20T12:00:00.000Z",
14903
15147
  * "path": "/api/v1/organizations/{id}/invites",
14904
15148
  * "method": "POST"
@@ -14908,7 +15152,7 @@ interface operations {
14908
15152
  "application/json": components["schemas"]["ErrorResponseDto"];
14909
15153
  };
14910
15154
  };
14911
- /** @description A pending invitation already exists for this email, or the identity already has active access to this Environment */
15155
+ /** @description A pending invitation already exists for this email at this place, or the identity is already an active member of the organization (`organization.member_exists`); give a member a role through the assignment routes */
14912
15156
  409: {
14913
15157
  headers: {
14914
15158
  [name: string]: unknown;
@@ -14919,7 +15163,7 @@ interface operations {
14919
15163
  * "error": {
14920
15164
  * "statusCode": 409,
14921
15165
  * "code": null,
14922
- * "message": "A pending invitation already exists for this email, or the identity already has active access to this Environment",
15166
+ * "message": "A pending invitation already exists for this email at this place, or the identity is already an active member of the organization (`organization.member_exists`); give a member a role through the assignment routes",
14923
15167
  * "timestamp": "2026-04-20T12:00:00.000Z",
14924
15168
  * "path": "/api/v1/organizations/{id}/invites",
14925
15169
  * "method": "POST"
@@ -17919,6 +18163,10 @@ interface operations {
17919
18163
  include_inactive?: "true" | "false";
17920
18164
  /** @description Filter by role origin. */
17921
18165
  type?: "system" | "custom";
18166
+ /** @description Which roles: `environment` (the default) the Environment's own, assignable in every organization; `organization` one organization's own; `available` what can be held inside one organization, its own and the Environment's; `all` every role in the Environment. `organization` and `available` need `organization_id`. */
18167
+ scope?: "environment" | "organization" | "available" | "all";
18168
+ /** @description The organization whose roles to list. Alone, it lists that organization's own roles (`scope=organization`). */
18169
+ organization_id?: string;
17922
18170
  };
17923
18171
  header?: never;
17924
18172
  path?: never;
@@ -18000,6 +18248,27 @@ interface operations {
18000
18248
  "application/json": components["schemas"]["ErrorResponseDto"];
18001
18249
  };
18002
18250
  };
18251
+ /** @description `organization_id` is not a live organization in this Environment */
18252
+ 404: {
18253
+ headers: {
18254
+ [name: string]: unknown;
18255
+ };
18256
+ content: {
18257
+ /**
18258
+ * @example {
18259
+ * "error": {
18260
+ * "statusCode": 404,
18261
+ * "code": null,
18262
+ * "message": "`organization_id` is not a live organization in this Environment",
18263
+ * "timestamp": "2026-04-20T12:00:00.000Z",
18264
+ * "path": "/api/v1/roles",
18265
+ * "method": "GET"
18266
+ * }
18267
+ * }
18268
+ */
18269
+ "application/json": components["schemas"]["ErrorResponseDto"];
18270
+ };
18271
+ };
18003
18272
  };
18004
18273
  };
18005
18274
  ApiRolesController_createRole: {
@@ -18089,6 +18358,27 @@ interface operations {
18089
18358
  "application/json": components["schemas"]["ErrorResponseDto"];
18090
18359
  };
18091
18360
  };
18361
+ /** @description `organization_id` is not a live organization in this Environment, or `copy_from_role_id` names no role that can be copied here (an Environment role, or one of the same organization) */
18362
+ 404: {
18363
+ headers: {
18364
+ [name: string]: unknown;
18365
+ };
18366
+ content: {
18367
+ /**
18368
+ * @example {
18369
+ * "error": {
18370
+ * "statusCode": 404,
18371
+ * "code": null,
18372
+ * "message": "`organization_id` is not a live organization in this Environment, or `copy_from_role_id` names no role that can be copied here (an Environment role, or one of the same organization)",
18373
+ * "timestamp": "2026-04-20T12:00:00.000Z",
18374
+ * "path": "/api/v1/roles",
18375
+ * "method": "POST"
18376
+ * }
18377
+ * }
18378
+ */
18379
+ "application/json": components["schemas"]["ErrorResponseDto"];
18380
+ };
18381
+ };
18092
18382
  /** @description Role name already exists */
18093
18383
  409: {
18094
18384
  headers: {
@@ -18916,7 +19206,7 @@ interface operations {
18916
19206
  };
18917
19207
  };
18918
19208
  };
18919
- /** @description The request failed validation, the role is a system role (system roles are reserved for platform administration), or `effective_from` is not before `effective_to`; or the request sent both an `X-API-Key` and an `Authorization` header */
19209
+ /** @description The request failed validation, the role is a system role (system roles are reserved for platform administration), or `effective_from` is not before `effective_to`; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
18920
19210
  400: {
18921
19211
  headers: {
18922
19212
  [name: string]: unknown;
@@ -18927,7 +19217,7 @@ interface operations {
18927
19217
  * "error": {
18928
19218
  * "statusCode": 400,
18929
19219
  * "code": null,
18930
- * "message": "The request failed validation, the role is a system role (system roles are reserved for platform administration), or `effective_from` is not before `effective_to`; or the request sent both an `X-API-Key` and an `Authorization` header",
19220
+ * "message": "The request failed validation, the role is a system role (system roles are reserved for platform administration), or `effective_from` is not before `effective_to`; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
18931
19221
  * "timestamp": "2026-04-20T12:00:00.000Z",
18932
19222
  * "path": "/api/v1/assignments",
18933
19223
  * "method": "POST"
@@ -19177,7 +19467,7 @@ interface operations {
19177
19467
  };
19178
19468
  };
19179
19469
  };
19180
- /** @description The request failed validation, the role is inactive or a system role, or `effective_from` is not before `effective_to`; or the request sent both an `X-API-Key` and an `Authorization` header */
19470
+ /** @description The request failed validation, the role is inactive or a system role, or `effective_from` is not before `effective_to`; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
19181
19471
  400: {
19182
19472
  headers: {
19183
19473
  [name: string]: unknown;
@@ -19188,7 +19478,7 @@ interface operations {
19188
19478
  * "error": {
19189
19479
  * "statusCode": 400,
19190
19480
  * "code": null,
19191
- * "message": "The request failed validation, the role is inactive or a system role, or `effective_from` is not before `effective_to`; or the request sent both an `X-API-Key` and an `Authorization` header",
19481
+ * "message": "The request failed validation, the role is inactive or a system role, or `effective_from` is not before `effective_to`; or an organization's own role is placed outside that organization (`rbac.role_outside_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
19192
19482
  * "timestamp": "2026-04-20T12:00:00.000Z",
19193
19483
  * "path": "/api/v1/assignments/{id}",
19194
19484
  * "method": "PATCH"
@@ -21596,7 +21886,7 @@ interface operations {
21596
21886
  };
21597
21887
  };
21598
21888
  };
21599
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), or `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`); or the request sent both an `X-API-Key` and an `Authorization` header */
21889
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`) or takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`), or a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
21600
21890
  400: {
21601
21891
  headers: {
21602
21892
  [name: string]: unknown;
@@ -21607,7 +21897,7 @@ interface operations {
21607
21897
  * "error": {
21608
21898
  * "statusCode": 400,
21609
21899
  * "code": null,
21610
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), or `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`); or the request sent both an `X-API-Key` and an `Authorization` header",
21900
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`) or takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`), or a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
21611
21901
  * "timestamp": "2026-04-20T12:00:00.000Z",
21612
21902
  * "path": "/api/v1/oauth-clients",
21613
21903
  * "method": "POST"
@@ -21659,6 +21949,27 @@ interface operations {
21659
21949
  "application/json": components["schemas"]["ErrorResponseDto"];
21660
21950
  };
21661
21951
  };
21952
+ /** @description A machine client: the account has reached its plan's monthly limit on active machine credentials (`m2m_tokens`, API keys and machine clients together); `data` carries the limit, the usage and an upgrade URL */
21953
+ 409: {
21954
+ headers: {
21955
+ [name: string]: unknown;
21956
+ };
21957
+ content: {
21958
+ /**
21959
+ * @example {
21960
+ * "error": {
21961
+ * "statusCode": 409,
21962
+ * "code": null,
21963
+ * "message": "A machine client: the account has reached its plan's monthly limit on active machine credentials (`m2m_tokens`, API keys and machine clients together); `data` carries the limit, the usage and an upgrade URL",
21964
+ * "timestamp": "2026-04-20T12:00:00.000Z",
21965
+ * "path": "/api/v1/oauth-clients",
21966
+ * "method": "POST"
21967
+ * }
21968
+ * }
21969
+ */
21970
+ "application/json": components["schemas"]["ErrorResponseDto"];
21971
+ };
21972
+ };
21662
21973
  /** @description The `Idempotency-Key` was already used by this caller for a request with a different method, path or body. A replay must repeat the original request exactly; a new request takes a new key. */
21663
21974
  422: {
21664
21975
  headers: {
@@ -22007,7 +22318,7 @@ interface operations {
22007
22318
  };
22008
22319
  };
22009
22320
  };
22010
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), or `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`); or the request sent both an `X-API-Key` and an `Authorization` header */
22321
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`) or takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`), or a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
22011
22322
  400: {
22012
22323
  headers: {
22013
22324
  [name: string]: unknown;
@@ -22018,7 +22329,7 @@ interface operations {
22018
22329
  * "error": {
22019
22330
  * "statusCode": 400,
22020
22331
  * "code": null,
22021
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), or `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`); or the request sent both an `X-API-Key` and an `Authorization` header",
22332
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range, `backchannel_logout_uri` names an address Canopy's servers will not call, `initiate_login_uri` is malformed or not `https` (loopback hosts excepted), `scopes` names a scope Canopy does not issue (`oauth.client_scope_unknown`), a machine client names an `organization_node_id` that is not a live organization of this Environment (`oauth.client_organization_invalid`) or takes a web client's field or a scope other than `permissions` (`oauth.machine_client_fields_invalid`), or a web client sends `allowed_audiences` (`oauth.web_client_audiences_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
22022
22333
  * "timestamp": "2026-04-20T12:00:00.000Z",
22023
22334
  * "path": "/api/v1/oauth-clients/{id}",
22024
22335
  * "method": "PATCH"
@@ -22201,22 +22512,24 @@ interface operations {
22201
22512
  };
22202
22513
  };
22203
22514
  };
22204
- ApiApiKeysController_list: {
22515
+ ApiOAuthClientsController_listAssignments: {
22205
22516
  parameters: {
22206
22517
  query?: {
22207
22518
  /** @description Page number (1-based) */
22208
22519
  page?: number;
22209
22520
  /** @description Items per page (1-100, default 20) */
22210
22521
  take?: number;
22211
- /** @description Search key names */
22522
+ /** @description Search role and node names */
22212
22523
  q?: string;
22213
- /** @description Sort column. Defaults to `created`, newest first. */
22214
- sort_by?: "name" | "created";
22524
+ /** @description Sort column. Defaults to `created`, oldest first. */
22525
+ sort_by?: "role" | "node" | "created";
22215
22526
  /** @description Sort direction */
22216
22527
  order?: "asc" | "desc";
22217
22528
  };
22218
22529
  header?: never;
22219
- path?: never;
22530
+ path: {
22531
+ id: string;
22532
+ };
22220
22533
  cookie?: never;
22221
22534
  };
22222
22535
  requestBody?: never;
@@ -22228,12 +22541,12 @@ interface operations {
22228
22541
  };
22229
22542
  content: {
22230
22543
  "application/json": {
22231
- items: components["schemas"]["ApiKeyResponseDto"][];
22544
+ items: components["schemas"]["AssignmentResponseDto"][];
22232
22545
  pagination: components["schemas"]["PageMetaDto"];
22233
22546
  };
22234
22547
  };
22235
22548
  };
22236
- /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header */
22549
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
22237
22550
  400: {
22238
22551
  headers: {
22239
22552
  [name: string]: unknown;
@@ -22244,9 +22557,9 @@ interface operations {
22244
22557
  * "error": {
22245
22558
  * "statusCode": 400,
22246
22559
  * "code": null,
22247
- * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header",
22560
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
22248
22561
  * "timestamp": "2026-04-20T12:00:00.000Z",
22249
- * "path": "/api/v1/api-keys",
22562
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22250
22563
  * "method": "GET"
22251
22564
  * }
22252
22565
  * }
@@ -22267,7 +22580,7 @@ interface operations {
22267
22580
  * "code": null,
22268
22581
  * "message": "Invalid or expired token",
22269
22582
  * "timestamp": "2026-04-20T12:00:00.000Z",
22270
- * "path": "/api/v1/api-keys",
22583
+ * "path": "/api/v1/oauth-clients",
22271
22584
  * "method": "GET"
22272
22585
  * }
22273
22586
  * }
@@ -22288,7 +22601,28 @@ interface operations {
22288
22601
  * "code": null,
22289
22602
  * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
22290
22603
  * "timestamp": "2026-04-20T12:00:00.000Z",
22291
- * "path": "/api/v1/api-keys",
22604
+ * "path": "/api/v1/oauth-clients",
22605
+ * "method": "GET"
22606
+ * }
22607
+ * }
22608
+ */
22609
+ "application/json": components["schemas"]["ErrorResponseDto"];
22610
+ };
22611
+ };
22612
+ /** @description No OAuth client with that id exists in this Environment */
22613
+ 404: {
22614
+ headers: {
22615
+ [name: string]: unknown;
22616
+ };
22617
+ content: {
22618
+ /**
22619
+ * @example {
22620
+ * "error": {
22621
+ * "statusCode": 404,
22622
+ * "code": null,
22623
+ * "message": "No OAuth client with that id exists in this Environment",
22624
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22625
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22292
22626
  * "method": "GET"
22293
22627
  * }
22294
22628
  * }
@@ -22298,27 +22632,659 @@ interface operations {
22298
22632
  };
22299
22633
  };
22300
22634
  };
22301
- ApiApiKeysController_create: {
22635
+ ApiOAuthClientsController_assignRole: {
22302
22636
  parameters: {
22303
22637
  query?: never;
22304
22638
  header?: never;
22305
- path?: never;
22639
+ path: {
22640
+ id: string;
22641
+ };
22306
22642
  cookie?: never;
22307
22643
  };
22308
22644
  requestBody: {
22309
22645
  content: {
22310
- "application/json": components["schemas"]["CreateApiKeyDto"];
22646
+ "application/json": components["schemas"]["CreateOAuthClientAssignmentDto"];
22311
22647
  };
22312
22648
  };
22313
22649
  responses: {
22314
- /** @description API key created — key value is only shown once */
22650
+ /** @description Assignment created */
22315
22651
  201: {
22316
22652
  headers: {
22317
22653
  [name: string]: unknown;
22318
22654
  };
22319
22655
  content: {
22320
22656
  "application/json": {
22321
- data: components["schemas"]["ApiKeyCreatedResponseDto"];
22657
+ data: components["schemas"]["AssignmentResponseDto"];
22658
+ };
22659
+ };
22660
+ };
22661
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
22662
+ 400: {
22663
+ headers: {
22664
+ [name: string]: unknown;
22665
+ };
22666
+ content: {
22667
+ /**
22668
+ * @example {
22669
+ * "error": {
22670
+ * "statusCode": 400,
22671
+ * "code": null,
22672
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
22673
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22674
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22675
+ * "method": "POST"
22676
+ * }
22677
+ * }
22678
+ */
22679
+ "application/json": components["schemas"]["ErrorResponseDto"];
22680
+ };
22681
+ };
22682
+ /** @description Invalid or expired token */
22683
+ 401: {
22684
+ headers: {
22685
+ [name: string]: unknown;
22686
+ };
22687
+ content: {
22688
+ /**
22689
+ * @example {
22690
+ * "error": {
22691
+ * "statusCode": 401,
22692
+ * "code": null,
22693
+ * "message": "Invalid or expired token",
22694
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22695
+ * "path": "/api/v1/oauth-clients",
22696
+ * "method": "GET"
22697
+ * }
22698
+ * }
22699
+ */
22700
+ "application/json": components["schemas"]["ErrorResponseDto"];
22701
+ };
22702
+ };
22703
+ /** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
22704
+ 403: {
22705
+ headers: {
22706
+ [name: string]: unknown;
22707
+ };
22708
+ content: {
22709
+ /**
22710
+ * @example {
22711
+ * "error": {
22712
+ * "statusCode": 403,
22713
+ * "code": null,
22714
+ * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
22715
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22716
+ * "path": "/api/v1/oauth-clients",
22717
+ * "method": "GET"
22718
+ * }
22719
+ * }
22720
+ */
22721
+ "application/json": components["schemas"]["ErrorResponseDto"];
22722
+ };
22723
+ };
22724
+ /** @description No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds */
22725
+ 404: {
22726
+ headers: {
22727
+ [name: string]: unknown;
22728
+ };
22729
+ content: {
22730
+ /**
22731
+ * @example {
22732
+ * "error": {
22733
+ * "statusCode": 404,
22734
+ * "code": null,
22735
+ * "message": "No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds",
22736
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22737
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22738
+ * "method": "POST"
22739
+ * }
22740
+ * }
22741
+ */
22742
+ "application/json": components["schemas"]["ErrorResponseDto"];
22743
+ };
22744
+ };
22745
+ /** @description The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`) */
22746
+ 409: {
22747
+ headers: {
22748
+ [name: string]: unknown;
22749
+ };
22750
+ content: {
22751
+ /**
22752
+ * @example {
22753
+ * "error": {
22754
+ * "statusCode": 409,
22755
+ * "code": null,
22756
+ * "message": "The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`)",
22757
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22758
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22759
+ * "method": "POST"
22760
+ * }
22761
+ * }
22762
+ */
22763
+ "application/json": components["schemas"]["ErrorResponseDto"];
22764
+ };
22765
+ };
22766
+ /** @description The `Idempotency-Key` was already used by this caller for a request with a different method, path or body. A replay must repeat the original request exactly; a new request takes a new key. */
22767
+ 422: {
22768
+ headers: {
22769
+ [name: string]: unknown;
22770
+ };
22771
+ content: {
22772
+ /**
22773
+ * @example {
22774
+ * "error": {
22775
+ * "statusCode": 422,
22776
+ * "code": null,
22777
+ * "message": "The `Idempotency-Key` was already used by this caller for a request with a different method, path or body. A replay must repeat the original request exactly; a new request takes a new key.",
22778
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22779
+ * "path": "/api/v1/oauth-clients/{id}/assignments",
22780
+ * "method": "POST"
22781
+ * }
22782
+ * }
22783
+ */
22784
+ "application/json": components["schemas"]["ErrorResponseDto"];
22785
+ };
22786
+ };
22787
+ };
22788
+ };
22789
+ ApiOAuthClientsController_removeAssignment: {
22790
+ parameters: {
22791
+ query?: never;
22792
+ header?: never;
22793
+ path: {
22794
+ id: string;
22795
+ assignmentId: string;
22796
+ };
22797
+ cookie?: never;
22798
+ };
22799
+ requestBody?: never;
22800
+ responses: {
22801
+ /** @description Assignment removed */
22802
+ 204: {
22803
+ headers: {
22804
+ [name: string]: unknown;
22805
+ };
22806
+ content?: never;
22807
+ };
22808
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
22809
+ 400: {
22810
+ headers: {
22811
+ [name: string]: unknown;
22812
+ };
22813
+ content: {
22814
+ /**
22815
+ * @example {
22816
+ * "error": {
22817
+ * "statusCode": 400,
22818
+ * "code": null,
22819
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
22820
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22821
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
22822
+ * "method": "DELETE"
22823
+ * }
22824
+ * }
22825
+ */
22826
+ "application/json": components["schemas"]["ErrorResponseDto"];
22827
+ };
22828
+ };
22829
+ /** @description Invalid or expired token */
22830
+ 401: {
22831
+ headers: {
22832
+ [name: string]: unknown;
22833
+ };
22834
+ content: {
22835
+ /**
22836
+ * @example {
22837
+ * "error": {
22838
+ * "statusCode": 401,
22839
+ * "code": null,
22840
+ * "message": "Invalid or expired token",
22841
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22842
+ * "path": "/api/v1/oauth-clients",
22843
+ * "method": "GET"
22844
+ * }
22845
+ * }
22846
+ */
22847
+ "application/json": components["schemas"]["ErrorResponseDto"];
22848
+ };
22849
+ };
22850
+ /** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
22851
+ 403: {
22852
+ headers: {
22853
+ [name: string]: unknown;
22854
+ };
22855
+ content: {
22856
+ /**
22857
+ * @example {
22858
+ * "error": {
22859
+ * "statusCode": 403,
22860
+ * "code": null,
22861
+ * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
22862
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22863
+ * "path": "/api/v1/oauth-clients",
22864
+ * "method": "GET"
22865
+ * }
22866
+ * }
22867
+ */
22868
+ "application/json": components["schemas"]["ErrorResponseDto"];
22869
+ };
22870
+ };
22871
+ /** @description No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds */
22872
+ 404: {
22873
+ headers: {
22874
+ [name: string]: unknown;
22875
+ };
22876
+ content: {
22877
+ /**
22878
+ * @example {
22879
+ * "error": {
22880
+ * "statusCode": 404,
22881
+ * "code": null,
22882
+ * "message": "No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds",
22883
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22884
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
22885
+ * "method": "DELETE"
22886
+ * }
22887
+ * }
22888
+ */
22889
+ "application/json": components["schemas"]["ErrorResponseDto"];
22890
+ };
22891
+ };
22892
+ /** @description The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`) */
22893
+ 409: {
22894
+ headers: {
22895
+ [name: string]: unknown;
22896
+ };
22897
+ content: {
22898
+ /**
22899
+ * @example {
22900
+ * "error": {
22901
+ * "statusCode": 409,
22902
+ * "code": null,
22903
+ * "message": "The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`)",
22904
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22905
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
22906
+ * "method": "DELETE"
22907
+ * }
22908
+ * }
22909
+ */
22910
+ "application/json": components["schemas"]["ErrorResponseDto"];
22911
+ };
22912
+ };
22913
+ };
22914
+ };
22915
+ ApiOAuthClientsController_updateAssignment: {
22916
+ parameters: {
22917
+ query?: never;
22918
+ header?: {
22919
+ /** @description Optimistic-lock version of the resource. Send the `version` field returned on read; the server rejects with 409 if the row has changed since. */
22920
+ "If-Match"?: string;
22921
+ };
22922
+ path: {
22923
+ id: string;
22924
+ assignmentId: string;
22925
+ };
22926
+ cookie?: never;
22927
+ };
22928
+ requestBody: {
22929
+ content: {
22930
+ "application/json": components["schemas"]["UpdateAssignmentDto"];
22931
+ };
22932
+ };
22933
+ responses: {
22934
+ /** @description Assignment updated */
22935
+ 200: {
22936
+ headers: {
22937
+ [name: string]: unknown;
22938
+ };
22939
+ content: {
22940
+ "application/json": {
22941
+ data: components["schemas"]["AssignmentResponseDto"];
22942
+ };
22943
+ };
22944
+ };
22945
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
22946
+ 400: {
22947
+ headers: {
22948
+ [name: string]: unknown;
22949
+ };
22950
+ content: {
22951
+ /**
22952
+ * @example {
22953
+ * "error": {
22954
+ * "statusCode": 400,
22955
+ * "code": null,
22956
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
22957
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22958
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
22959
+ * "method": "PATCH"
22960
+ * }
22961
+ * }
22962
+ */
22963
+ "application/json": components["schemas"]["ErrorResponseDto"];
22964
+ };
22965
+ };
22966
+ /** @description Invalid or expired token */
22967
+ 401: {
22968
+ headers: {
22969
+ [name: string]: unknown;
22970
+ };
22971
+ content: {
22972
+ /**
22973
+ * @example {
22974
+ * "error": {
22975
+ * "statusCode": 401,
22976
+ * "code": null,
22977
+ * "message": "Invalid or expired token",
22978
+ * "timestamp": "2026-04-20T12:00:00.000Z",
22979
+ * "path": "/api/v1/oauth-clients",
22980
+ * "method": "GET"
22981
+ * }
22982
+ * }
22983
+ */
22984
+ "application/json": components["schemas"]["ErrorResponseDto"];
22985
+ };
22986
+ };
22987
+ /** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
22988
+ 403: {
22989
+ headers: {
22990
+ [name: string]: unknown;
22991
+ };
22992
+ content: {
22993
+ /**
22994
+ * @example {
22995
+ * "error": {
22996
+ * "statusCode": 403,
22997
+ * "code": null,
22998
+ * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
22999
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23000
+ * "path": "/api/v1/oauth-clients",
23001
+ * "method": "GET"
23002
+ * }
23003
+ * }
23004
+ */
23005
+ "application/json": components["schemas"]["ErrorResponseDto"];
23006
+ };
23007
+ };
23008
+ /** @description No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds */
23009
+ 404: {
23010
+ headers: {
23011
+ [name: string]: unknown;
23012
+ };
23013
+ content: {
23014
+ /**
23015
+ * @example {
23016
+ * "error": {
23017
+ * "statusCode": 404,
23018
+ * "code": null,
23019
+ * "message": "No OAuth client with that id exists in this Environment, the node or role does not exist in it, or the assignment is not one this client holds",
23020
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23021
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
23022
+ * "method": "PATCH"
23023
+ * }
23024
+ * }
23025
+ */
23026
+ "application/json": components["schemas"]["ErrorResponseDto"];
23027
+ };
23028
+ };
23029
+ /** @description The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`) */
23030
+ 409: {
23031
+ headers: {
23032
+ [name: string]: unknown;
23033
+ };
23034
+ content: {
23035
+ /**
23036
+ * @example {
23037
+ * "error": {
23038
+ * "statusCode": 409,
23039
+ * "code": null,
23040
+ * "message": "The client already holds this role at this node (`rbac.assignment_conflict`), the client is pinned to an organization and the node is outside it (`oauth.client_outside_organization`), the caller's `If-Match` is stale (`assignment.version_mismatch`), or the change would leave an organization without an administrator (`organization.last_admin`)",
23041
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23042
+ * "path": "/api/v1/oauth-clients/{id}/assignments/{assignmentId}",
23043
+ * "method": "PATCH"
23044
+ * }
23045
+ * }
23046
+ */
23047
+ "application/json": components["schemas"]["ErrorResponseDto"];
23048
+ };
23049
+ };
23050
+ };
23051
+ };
23052
+ ApiOAuthClientsController_getGrants: {
23053
+ parameters: {
23054
+ query?: {
23055
+ /** @description Page number (1-based) */
23056
+ page?: number;
23057
+ /** @description Items per page (1-100, default 20) */
23058
+ take?: number;
23059
+ /** @description `windows` adds `effective_from` and `effective_to` to every row and includes assignments outside their window, so the caller applies the window itself. */
23060
+ include?: "windows";
23061
+ };
23062
+ header?: never;
23063
+ path: {
23064
+ id: string;
23065
+ };
23066
+ cookie?: never;
23067
+ };
23068
+ requestBody?: never;
23069
+ responses: {
23070
+ /** @description One page of `(permission, node_id)` pairs: the nodes the client's active roles grant each permission at, in effect now unless `include=windows`, with `model_version` beside the page */
23071
+ 200: {
23072
+ headers: {
23073
+ [name: string]: unknown;
23074
+ };
23075
+ content: {
23076
+ "application/json": {
23077
+ /** @description The version of the authorization model these rows describe. A client that evaluates from them refuses a version it does not know rather than guessing. */
23078
+ model_version: number;
23079
+ items: components["schemas"]["IdentityGrantResponseDto"][];
23080
+ pagination: components["schemas"]["PageMetaDto"];
23081
+ };
23082
+ };
23083
+ };
23084
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header */
23085
+ 400: {
23086
+ headers: {
23087
+ [name: string]: unknown;
23088
+ };
23089
+ content: {
23090
+ /**
23091
+ * @example {
23092
+ * "error": {
23093
+ * "statusCode": 400,
23094
+ * "code": null,
23095
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; the client is a web client (`oauth.client_not_machine`); the role is a system role (`rbac.system_role_not_assignable`) or inactive; the role belongs to another organization (`rbac.role_outside_organization`); the window runs backwards (`auth.effective_date_invalid`); or the request sent both an `X-API-Key` and an `Authorization` header",
23096
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23097
+ * "path": "/api/v1/oauth-clients/{id}/grants",
23098
+ * "method": "GET"
23099
+ * }
23100
+ * }
23101
+ */
23102
+ "application/json": components["schemas"]["ErrorResponseDto"];
23103
+ };
23104
+ };
23105
+ /** @description Invalid or expired token */
23106
+ 401: {
23107
+ headers: {
23108
+ [name: string]: unknown;
23109
+ };
23110
+ content: {
23111
+ /**
23112
+ * @example {
23113
+ * "error": {
23114
+ * "statusCode": 401,
23115
+ * "code": null,
23116
+ * "message": "Invalid or expired token",
23117
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23118
+ * "path": "/api/v1/oauth-clients",
23119
+ * "method": "GET"
23120
+ * }
23121
+ * }
23122
+ */
23123
+ "application/json": components["schemas"]["ErrorResponseDto"];
23124
+ };
23125
+ };
23126
+ /** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
23127
+ 403: {
23128
+ headers: {
23129
+ [name: string]: unknown;
23130
+ };
23131
+ content: {
23132
+ /**
23133
+ * @example {
23134
+ * "error": {
23135
+ * "statusCode": 403,
23136
+ * "code": null,
23137
+ * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
23138
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23139
+ * "path": "/api/v1/oauth-clients",
23140
+ * "method": "GET"
23141
+ * }
23142
+ * }
23143
+ */
23144
+ "application/json": components["schemas"]["ErrorResponseDto"];
23145
+ };
23146
+ };
23147
+ /** @description No OAuth client with that id exists in this Environment */
23148
+ 404: {
23149
+ headers: {
23150
+ [name: string]: unknown;
23151
+ };
23152
+ content: {
23153
+ /**
23154
+ * @example {
23155
+ * "error": {
23156
+ * "statusCode": 404,
23157
+ * "code": null,
23158
+ * "message": "No OAuth client with that id exists in this Environment",
23159
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23160
+ * "path": "/api/v1/oauth-clients/{id}/grants",
23161
+ * "method": "GET"
23162
+ * }
23163
+ * }
23164
+ */
23165
+ "application/json": components["schemas"]["ErrorResponseDto"];
23166
+ };
23167
+ };
23168
+ };
23169
+ };
23170
+ ApiApiKeysController_list: {
23171
+ parameters: {
23172
+ query?: {
23173
+ /** @description Page number (1-based) */
23174
+ page?: number;
23175
+ /** @description Items per page (1-100, default 20) */
23176
+ take?: number;
23177
+ /** @description Search key names */
23178
+ q?: string;
23179
+ /** @description Sort column. Defaults to `created`, newest first. */
23180
+ sort_by?: "name" | "created";
23181
+ /** @description Sort direction */
23182
+ order?: "asc" | "desc";
23183
+ };
23184
+ header?: never;
23185
+ path?: never;
23186
+ cookie?: never;
23187
+ };
23188
+ requestBody?: never;
23189
+ responses: {
23190
+ /** @description Paginated list */
23191
+ 200: {
23192
+ headers: {
23193
+ [name: string]: unknown;
23194
+ };
23195
+ content: {
23196
+ "application/json": {
23197
+ items: components["schemas"]["ApiKeyResponseDto"][];
23198
+ pagination: components["schemas"]["PageMetaDto"];
23199
+ };
23200
+ };
23201
+ };
23202
+ /** @description The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header */
23203
+ 400: {
23204
+ headers: {
23205
+ [name: string]: unknown;
23206
+ };
23207
+ content: {
23208
+ /**
23209
+ * @example {
23210
+ * "error": {
23211
+ * "statusCode": 400,
23212
+ * "code": null,
23213
+ * "message": "The request failed validation: a body field, a query parameter or an id in the path is missing, malformed or out of range; or the request sent both an `X-API-Key` and an `Authorization` header",
23214
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23215
+ * "path": "/api/v1/api-keys",
23216
+ * "method": "GET"
23217
+ * }
23218
+ * }
23219
+ */
23220
+ "application/json": components["schemas"]["ErrorResponseDto"];
23221
+ };
23222
+ };
23223
+ /** @description Invalid or expired token */
23224
+ 401: {
23225
+ headers: {
23226
+ [name: string]: unknown;
23227
+ };
23228
+ content: {
23229
+ /**
23230
+ * @example {
23231
+ * "error": {
23232
+ * "statusCode": 401,
23233
+ * "code": null,
23234
+ * "message": "Invalid or expired token",
23235
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23236
+ * "path": "/api/v1/api-keys",
23237
+ * "method": "GET"
23238
+ * }
23239
+ * }
23240
+ */
23241
+ "application/json": components["schemas"]["ErrorResponseDto"];
23242
+ };
23243
+ };
23244
+ /** @description The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment */
23245
+ 403: {
23246
+ headers: {
23247
+ [name: string]: unknown;
23248
+ };
23249
+ content: {
23250
+ /**
23251
+ * @example {
23252
+ * "error": {
23253
+ * "statusCode": 403,
23254
+ * "code": null,
23255
+ * "message": "The bearer token is not an admin or platform token, or the caller lacks the permission this operation checks: a scoped API key without that scope, an admin without the Account capability that covers it, or, for a node-scoped check, a node outside this Environment",
23256
+ * "timestamp": "2026-04-20T12:00:00.000Z",
23257
+ * "path": "/api/v1/api-keys",
23258
+ * "method": "GET"
23259
+ * }
23260
+ * }
23261
+ */
23262
+ "application/json": components["schemas"]["ErrorResponseDto"];
23263
+ };
23264
+ };
23265
+ };
23266
+ };
23267
+ ApiApiKeysController_create: {
23268
+ parameters: {
23269
+ query?: never;
23270
+ header?: never;
23271
+ path?: never;
23272
+ cookie?: never;
23273
+ };
23274
+ requestBody: {
23275
+ content: {
23276
+ "application/json": components["schemas"]["CreateApiKeyDto"];
23277
+ };
23278
+ };
23279
+ responses: {
23280
+ /** @description API key created — key value is only shown once */
23281
+ 201: {
23282
+ headers: {
23283
+ [name: string]: unknown;
23284
+ };
23285
+ content: {
23286
+ "application/json": {
23287
+ data: components["schemas"]["ApiKeyCreatedResponseDto"];
22322
23288
  };
22323
23289
  };
22324
23290
  };
@@ -22385,7 +23351,7 @@ interface operations {
22385
23351
  "application/json": components["schemas"]["ErrorResponseDto"];
22386
23352
  };
22387
23353
  };
22388
- /** @description The account has reached its plan's monthly limit on active API keys (`m2m_tokens`); `data` carries the limit, the usage and an upgrade URL */
23354
+ /** @description The account has reached its plan's monthly limit on active machine credentials (`m2m_tokens`: API keys and machine clients); `data` carries the limit, the usage and an upgrade URL */
22389
23355
  409: {
22390
23356
  headers: {
22391
23357
  [name: string]: unknown;
@@ -22396,7 +23362,7 @@ interface operations {
22396
23362
  * "error": {
22397
23363
  * "statusCode": 409,
22398
23364
  * "code": null,
22399
- * "message": "The account has reached its plan's monthly limit on active API keys (`m2m_tokens`); `data` carries the limit, the usage and an upgrade URL",
23365
+ * "message": "The account has reached its plan's monthly limit on active machine credentials (`m2m_tokens`: API keys and machine clients); `data` carries the limit, the usage and an upgrade URL",
22400
23366
  * "timestamp": "2026-04-20T12:00:00.000Z",
22401
23367
  * "path": "/api/v1/api-keys",
22402
23368
  * "method": "POST"
@@ -23334,8 +24300,27 @@ interface LocalAuthorizerOptions {
23334
24300
  /** Injectable clock, for tests. */
23335
24301
  now?: () => number;
23336
24302
  }
24303
+ /**
24304
+ * Which kind of principal a subject id names. An identity is a person; a
24305
+ * `service` is a machine OAuth client acting for itself, whose id is its
24306
+ * `client_id` (the `sub` of its token). Both ids are UUIDs, so the kind is
24307
+ * stated rather than guessed: it decides where the grants are read from.
24308
+ */
24309
+ type PrincipalType = "identity" | "service";
24310
+ /** Names the subject's kind on the calls that take a bare id. */
24311
+ interface SubjectOptions {
24312
+ /** Defaults to `identity`. */
24313
+ principalType?: PrincipalType;
24314
+ }
23337
24315
  interface LocalAuthorizationQuery {
24316
+ /** The subject: an identity's id, or a machine client's `client_id`. */
23338
24317
  identity_id: string;
24318
+ /**
24319
+ * What `identity_id` names. Defaults to `identity`; set `service` for a
24320
+ * machine client, whose grants are read from its own endpoint. Read it off
24321
+ * the verified token's `type` claim, never off the request.
24322
+ */
24323
+ principal_type?: PrincipalType;
23339
24324
  permission: string;
23340
24325
  /** Defaults to `node`, which is the strict question. */
23341
24326
  scope?: "node" | "app_wide";
@@ -23420,7 +24405,7 @@ declare class LocalAuthorizer {
23420
24405
  * root the readable hierarchy does not contain raises
23421
24406
  * `authorizer.hierarchy_incomplete`, as a check at such a node does.
23422
24407
  */
23423
- grantRoots(identityId: string, permission: string): Promise<{
24408
+ grantRoots(identityId: string, permission: string, subject?: SubjectOptions): Promise<{
23424
24409
  roots: string[];
23425
24410
  envWide: boolean;
23426
24411
  }>;
@@ -23440,19 +24425,19 @@ declare class LocalAuthorizer {
23440
24425
  */
23441
24426
  accessibleNodes(identityId: string, permission: string, options?: {
23442
24427
  maxNodes?: number;
23443
- }): Promise<AccessibleNodes>;
24428
+ } & SubjectOptions): Promise<AccessibleNodes>;
23444
24429
  /**
23445
24430
  * Every permission the identity holds at the node, by grant or by
23446
24431
  * inheritance: the list a screen renders its controls from, answered from
23447
24432
  * the same cached grant roots and tree a check uses.
23448
24433
  */
23449
- permissionsAt(identityId: string, nodeId: string): Promise<string[]>;
24434
+ permissionsAt(identityId: string, nodeId: string, subject?: SubjectOptions): Promise<string[]>;
23450
24435
  /**
23451
24436
  * {@link permissionsAt} for several nodes at once, as node → permissions:
23452
24437
  * the rows of a list each with their own controls, answered from one read
23453
24438
  * of the grant roots and one walk per node.
23454
24439
  */
23455
- permissionsAtMany(identityId: string, nodeIds: readonly string[]): Promise<Map<string, string[]>>;
24440
+ permissionsAtMany(identityId: string, nodeIds: readonly string[], subject?: SubjectOptions): Promise<Map<string, string[]>>;
23456
24441
  private decide;
23457
24442
  /** Counters for observability — how much traffic the cache is actually saving. */
23458
24443
  snapshot(): LocalAuthorizerStats;
@@ -23463,6 +24448,8 @@ declare class LocalAuthorizer {
23463
24448
  * cached hierarchy and every other identity's entries stay warm. This is
23464
24449
  * the shape an assignment webhook wants: the event names the identity
23465
24450
  * whose authority moved, and nothing else needs to pay a refetch for it.
24451
+ * An event naming a machine client (`oauth_client_id`, with `identity_id`
24452
+ * null) passes that client's `client_id` with `principalType: "service"`.
23466
24453
  *
23467
24454
  * With no argument, everything goes: grants and the hierarchy tree. Not
23468
24455
  * needed in normal operation, where entries expire on their own; useful in
@@ -23478,7 +24465,7 @@ declare class LocalAuthorizer {
23478
24465
  * the TTL, and webhook-driven invalidation is a latency optimization on
23479
24466
  * top of it — size the TTL to the revocation latency you can promise.
23480
24467
  */
23481
- invalidate(identityId?: string): void;
24468
+ invalidate(identityId?: string, subject?: SubjectOptions): void;
23482
24469
  /** Fire the decision hooks, after the verdict and without waiting on them. */
23483
24470
  private announce;
23484
24471
  /** The node and its ancestors, from the tree this client can read. */
@@ -23708,7 +24695,7 @@ declare function tokenErrorStatus(error: unknown): FailureStatus;
23708
24695
  * when the endpoint is not served (an SDK newer than the API), or on a 4xx
23709
24696
  * nobody anticipated. No retry fixes these.
23710
24697
  * - `503` when Canopy did not answer, or answered 429 or 5xx.
23711
- * - `403` when Canopy answered that the identity is not in this Environment.
24698
+ * - `403` when Canopy answered that the identity or machine client is not in this Environment.
23712
24699
  */
23713
24700
  declare function authorizationErrorStatus(error: unknown): FailureStatus;
23714
24701
 
@@ -23741,6 +24728,17 @@ interface TokenVerifierOptions {
23741
24728
  * minted for one client being replayed at another.
23742
24729
  */
23743
24730
  audience?: string;
24731
+ /**
24732
+ * The audience a machine client's `service` token must name: the
24733
+ * identifier your API answers to (`https://api.example.com`), the one the
24734
+ * client asked for with `audience` or the Environment's default audience.
24735
+ *
24736
+ * A service token always carries `aud`, and it names the API rather than a
24737
+ * client, so `audience` never applies to it. Admitting a service token
24738
+ * without this throws `token.audience_unverified`, so a token minted for
24739
+ * another of your APIs is never accepted by accident.
24740
+ */
24741
+ serviceAudience?: string;
23744
24742
  /** Where the signing keys live. Defaults to `${issuer}/.well-known/jwks.json`. */
23745
24743
  jwksUri?: string;
23746
24744
  /** How long a fetched key set is reused. Defaults to 10 minutes. */
@@ -23773,10 +24771,12 @@ interface TokenVerifierOptions {
23773
24771
  * The principal types accepted, matched against the `type` claim. Defaults to
23774
24772
  * `["identity"]`: the people who sign in to your application.
23775
24773
  *
23776
- * Canopy also signs tokens for its own administrators (`user`), its staff
23777
- * (`platform`) and, for some flows, API keys (`api_key`), all with the same
23778
- * keys and issuer. A backend that serves your end users should accept none
23779
- * of them, so they are refused unless you name them here.
24774
+ * Canopy also signs tokens for machine clients (`service`, obtained with
24775
+ * the `client_credentials` grant), its own administrators (`user`), its
24776
+ * staff (`platform`) and, for some flows, API keys (`api_key`), all with the
24777
+ * same keys and issuer. A backend that serves your end users should accept
24778
+ * none of them, so they are refused unless you name them here, or admit
24779
+ * them for one call with {@link VerifyCallOptions.alsoAllow}.
23780
24780
  */
23781
24781
  allowedTypes?: ReadonlyArray<CanopyTokenClaims["type"]>;
23782
24782
  /** Injectable for tests and for runtimes with a non-global fetch. */
@@ -23789,10 +24789,20 @@ interface TokenVerifierOptions {
23789
24789
  * anything added later reachable without a version bump.
23790
24790
  */
23791
24791
  interface CanopyTokenClaims {
23792
- /** The identity or user this token acts as. */
24792
+ /**
24793
+ * The principal this token acts as: an identity's id, or, on a `service`
24794
+ * token, the machine client's `client_id`.
24795
+ */
23793
24796
  sub: string;
23794
24797
  /** Which kind of principal `sub` is. */
23795
- type: "user" | "identity" | "api_key" | "platform";
24798
+ type: "user" | "identity" | "service" | "api_key" | "platform";
24799
+ /**
24800
+ * How a `service` token was obtained: always `client_credentials`. Absent
24801
+ * on every other type.
24802
+ */
24803
+ gty?: "client_credentials";
24804
+ /** The OAuth client the token was issued to; on a `service` token, `sub`. */
24805
+ client_id?: string;
23796
24806
  iss: string;
23797
24807
  exp: number;
23798
24808
  iat?: number;
@@ -23833,8 +24843,25 @@ interface CanopyTokenClaims {
23833
24843
  * none at all.
23834
24844
  */
23835
24845
  org_roles?: string[];
24846
+ /**
24847
+ * The ids of the roles in `org_roles`, in the same order. A role's name is
24848
+ * unique only within its tier (the Environment's roles, or one
24849
+ * organization's own), so the id is what identifies a role across
24850
+ * organizations. Minted with `org_id` and `org_roles`.
24851
+ */
24852
+ org_role_ids?: string[];
23836
24853
  [claim: string]: unknown;
23837
24854
  }
24855
+ /** What one call to {@link TokenVerifier.verify} may widen. */
24856
+ interface VerifyCallOptions {
24857
+ /**
24858
+ * Principal types to accept for this call on top of `allowedTypes`, for a
24859
+ * route that admits them: typically `["service"]`, a machine client's
24860
+ * token, on a route built for machines. The verifier's own setting is
24861
+ * unchanged, so every other route keeps refusing them.
24862
+ */
24863
+ alsoAllow?: ReadonlyArray<CanopyTokenClaims["type"]>;
24864
+ }
23838
24865
  /**
23839
24866
  * The organization context a verified token carries: which organization the
23840
24867
  * session is acting in, and the roles it holds at that organization's node.
@@ -23844,6 +24871,8 @@ interface CanopyOrgContext {
23844
24871
  orgId: string;
23845
24872
  /** The roles' names (not ids) held at the organization node: what `org_roles` carries. Empty for a member holding none there. */
23846
24873
  orgRoles: string[];
24874
+ /** The same roles' ids, in the same order: what `org_role_ids` carries. Compare by id, since a name is unique only within its tier. */
24875
+ orgRoleIds: string[];
23847
24876
  }
23848
24877
  /**
23849
24878
  * The organization context of a verified token, or `null` when it has none.
@@ -23870,6 +24899,7 @@ declare function orgContext(claims: CanopyTokenClaims): CanopyOrgContext | null;
23870
24899
  declare class TokenVerifier {
23871
24900
  private readonly issuer;
23872
24901
  private readonly audience;
24902
+ private readonly serviceAudience;
23873
24903
  private readonly jwksUri;
23874
24904
  private readonly jwksCacheMaxAgeMs;
23875
24905
  private readonly jwksMinRefetchIntervalMs;
@@ -23894,7 +24924,7 @@ declare class TokenVerifier {
23894
24924
  * Order matters: the signature is checked before any claim is believed, so
23895
24925
  * nothing downstream ever reads an unverified payload.
23896
24926
  */
23897
- verify(token: string): Promise<CanopyTokenClaims>;
24927
+ verify(token: string, options?: VerifyCallOptions): Promise<CanopyTokenClaims>;
23898
24928
  /** Everything checked after the signature is known good. */
23899
24929
  private assertClaims;
23900
24930
  /**
@@ -23905,6 +24935,9 @@ declare class TokenVerifier {
23905
24935
  * token being verified by something that never said which client it is, and
23906
24936
  * ignoring it would accept a token minted for a different client. So it
23907
24937
  * throws and names the option.
24938
+ *
24939
+ * A service token names the API it was minted for, never a client, so it
24940
+ * is held to `serviceAudience` alone, which it must name.
23908
24941
  */
23909
24942
  private assertAudience;
23910
24943
  /**
@@ -23974,4 +25007,4 @@ type WebhookEventData<Name extends WebhookEventName> = WebhookEvent<Name>["data"
23974
25007
  */
23975
25008
  declare function isWebhookEvent<Name extends WebhookEventName>(delivery: WebhookDelivery, name: Name): delivery is WebhookEvent<Name>;
23976
25009
 
23977
- export { type AccessibleNodes, type AssignmentItem, Assignments, type CallOptions, Canopy, CanopyAuthorizerError, CanopyClient, type CanopyClientOptions, CanopyConnectionError, CanopyError, type CanopyErrorBody, type CanopyOrgContext, type CanopyTokenClaims, CanopyTokenError, type Collection, type ConcurrencyOptions, type ConditionalResult, type CursorPagination, DEFAULT_MAX_NODES, type FailureStatus, Identities, type IdentityAssignmentItem, type IdentityItem, type IdentitySessionItem, type LocalAuthorizationQuery, LocalAuthorizer, type LocalAuthorizerOptions, type LocalAuthorizerStats, type LocalDecision, type LocalDecisionEvent, type LocalDenialReason, MAX_TTL_MS, type OffsetPagination, type OperationId, type OrganizationDirectoryGroupItem, type OrganizationInviteItem, type OrganizationItem, type OrganizationMemberItem, Organizations, type PageFetcher, type PageParams, type PaginateOptions, type Pagination, Paginator, type PartialSuccess, type PermissionItem, Permissions, type QueryParams, type RequestBody, type RequestOptions, type ResponseBody, type RoleItem, Roles, type Schema, TokenVerifier, type TokenVerifierOptions, type WebhookDelivery, type WebhookEvent, type WebhookEventData, type WebhookEventName, authorizationErrorStatus, type components, isCanopyAuthorizerError, isCanopyConnectionError, isCanopyError, isCanopyTokenError, isCursorPagination, isWebhookEvent, type operations, orgContext, paginate, type paths, tokenErrorStatus, withConcurrency };
25010
+ export { type AccessibleNodes, type AssignmentItem, Assignments, type CallOptions, Canopy, CanopyAuthorizerError, CanopyClient, type CanopyClientOptions, CanopyConnectionError, CanopyError, type CanopyErrorBody, type CanopyOrgContext, type CanopyTokenClaims, CanopyTokenError, type Collection, type ConcurrencyOptions, type ConditionalResult, type CursorPagination, DEFAULT_MAX_NODES, type FailureStatus, Identities, type IdentityAssignmentItem, type IdentityItem, type IdentitySessionItem, type LocalAuthorizationQuery, LocalAuthorizer, type LocalAuthorizerOptions, type LocalAuthorizerStats, type LocalDecision, type LocalDecisionEvent, type LocalDenialReason, MAX_TTL_MS, type OffsetPagination, type OperationId, type OrganizationDirectoryGroupItem, type OrganizationInviteItem, type OrganizationItem, type OrganizationMemberItem, Organizations, type PageFetcher, type PageParams, type PaginateOptions, type Pagination, Paginator, type PartialSuccess, type PermissionItem, Permissions, type PrincipalType, type QueryParams, type RequestBody, type RequestOptions, type ResponseBody, type RoleItem, Roles, type Schema, type SubjectOptions, TokenVerifier, type TokenVerifierOptions, type VerifyCallOptions, type WebhookDelivery, type WebhookEvent, type WebhookEventData, type WebhookEventName, authorizationErrorStatus, type components, isCanopyAuthorizerError, isCanopyConnectionError, isCanopyError, isCanopyTokenError, isCursorPagination, isWebhookEvent, type operations, orgContext, paginate, type paths, tokenErrorStatus, withConcurrency };