@canopy-io/node 0.16.0 → 0.18.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
@@ -67,7 +67,11 @@ interface CanopyClientOptions {
67
67
  apiKey?: string;
68
68
  /** Identity or portal JWT, sent as `Authorization: Bearer`. */
69
69
  accessToken?: string;
70
- /** Defaults to Canopy's hosted API. Set this for a self-hosted instance. */
70
+ /**
71
+ * Defaults to Canopy's hosted API, or to `CANOPY_BASE_URL` when that
72
+ * environment variable is set. Set this, or the variable, for a self-hosted
73
+ * instance.
74
+ */
71
75
  baseUrl?: string;
72
76
  /** Per-attempt deadline. Defaults to 30s; 0 disables. */
73
77
  timeoutMs?: number;
@@ -422,7 +426,7 @@ interface paths {
422
426
  put?: never;
423
427
  /**
424
428
  * Create an identity
425
- * @description Creates a single identity in the active Application's current Environment, optionally assigning an initial role at a node in the same request (`role_id` + `node_id`). Email is normalized (lower-cased, trimmed) and must be unique within the Account — a duplicate returns `409`; passwords are hashed with argon2id and screened against HaveIBeenPwned, so a breached password returns `400`. Returns the created identity with profile metadata only (the password is never echoed).
429
+ * @description Creates a single identity in the active Application's current Environment, optionally assigning an initial role at a node in the same request (`role_id` + `node_id`). Email is normalized (lower-cased, trimmed) and must be unique within the Account — a duplicate returns `409`; passwords are hashed with argon2id and screened against HaveIBeenPwned, so a breached password returns `400`. On the public API a `password_hash` from another system (`password_hash_algorithm`: `bcrypt`, `argon2id`, `pbkdf2_sha256` or `scrypt`) is stored as it is and verified that way at sign-in; the first sign-in that proves it re-hashes to argon2id and runs the breach check, sending a breached password to reset. Returns the created identity with profile metadata only (the password is never echoed).
426
430
  */
427
431
  post: operations["ApiIdentitiesController_createIdentity"];
428
432
  delete?: never;
@@ -669,7 +673,7 @@ interface paths {
669
673
  get?: never;
670
674
  put?: never;
671
675
  /**
672
- * Force-reset an identity's MFA — admin recovery action
676
+ * Force-reset an identity's MFA, as an admin recovery action
673
677
  * @description Force-resets an identity's MFA enrollment (server-to-server admin), clearing all enrolled factors across the Account so the identity must re-enroll on next sign-in. Gated by an Environment-scoped membership check and audited. Returns `204 No Content`; returns `404` when the identity has no membership in this Environment.
674
678
  */
675
679
  post: operations["ApiIdentitiesController_resetIdentityMfa"];
@@ -1086,7 +1090,7 @@ interface paths {
1086
1090
  put?: never;
1087
1091
  /**
1088
1092
  * Preview moving a node
1089
- * @description Reports what moving the node under `parent_node_id` would change, without moving it. `blockers` lists what would refuse the move, with the code and message the move answers `400` with (the schema's parent and child types, depth, a cycle, an organization boundary); when any is listed nothing else is resolved. Otherwise: `subtree_size`, the node and every node beneath it; `identities_gaining`, `identities_losing` and `permissions`, the counts per key, over everyone; `people`, one page of the holders whose access at the node changes (and so beneath it, since grants inside the subtree travel with it), one row per person by name, with the keys `gained` and `lost` and `via`, the grants behind them, and `pagination`. The query narrows the page and never the counts: `q` (name or email), `direction` (`gains` or `loses`), `permission` (one key), `page` and `take` (up to 5000, so a client can export every change in a few reads); and `invites` and `directory_groups`, the pending invitations and directory groups at nodes in the subtree, which move with it. People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts and an empty page, whatever the query. Resolved by the rules `evaluate` applies. Read-only. Send `version` as `If-Match` and `parent_version` in the body on the move, so it applies only to the node and the destination previewed. Gated as the move is: `hierarchy.manage` on the node and on the new parent. Returns `404` when the node or the parent is not found in this Environment.
1093
+ * @description Reports what moving the node under `parent_node_id` would change, without moving it. `blockers` lists what would refuse the move, with the code and message the move answers `400` with (the schema's parent and child types, depth, a cycle, an organization boundary); when any is listed nothing else is resolved. Otherwise: `subtree_size`, the node and every node beneath it; `identities_gaining`, `identities_losing` and `permissions`, the counts per key, over everyone; and `invites` and `directory_groups`, the pending invitations and directory groups at nodes in the subtree, which move with it. People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts, and an empty page from the people route. The preview is kept under `id` until `expires_at`: read the holders whose access at the node changes (and so beneath it, since grants inside the subtree travel with it), one row per person by name with the keys `gained` and `lost` and `via`, the grants behind them, from `GET /api/v1/access-previews/{previewId}/people`, narrowed by `q`, `direction`, `permission`, `page` and `take`, and as a file from `…/people.csv`. Resolved by the rules `evaluate` applies. Read-only. Send `version` as `If-Match` and `parent_version` in the body on the move, so it applies only to the node and the destination previewed. Gated as the move is: `hierarchy.manage` on the node and on the new parent. Returns `404` when the node or the parent is not found in this Environment.
1090
1094
  */
1091
1095
  post: operations["ApiNodesController_previewMoveNode"];
1092
1096
  delete?: never;
@@ -1106,7 +1110,7 @@ interface paths {
1106
1110
  put?: never;
1107
1111
  /**
1108
1112
  * Preview deleting a node
1109
- * @description Reports what deleting the node would remove, without deleting it. `blockers` lists what would refuse the delete (the root node, or an organization node, which is deleted through the organizations API); when any is listed nothing else is counted. Otherwise: `subtree_size`, the node and every node beneath it; `roles`, the role assignments made in the subtree counted by role, and `assignments_total`; `identities_affected`, and `identities_losing_all_access`, those holding no assignment anywhere else in the Environment; `invites`, the pending invitations there, by email; and `directory_groups`, the directory groups mapped there, by name. The same sets the delete removes. `people` is one page of the holders whose assignments go, one row per person by name, with `via`, their assignments that go as role at node, and `pagination`; `q` (name or email), `role_id`, `page` and `take` (up to 5000) narrow the page and never the counts. People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts and an empty page, whatever the query. Read-only. Send `version` as `If-Match` on the delete. Gated as the delete is: `hierarchy.manage` on the node. Returns `404` when the node is not found in this Environment.
1113
+ * @description Reports what deleting the node would remove, without deleting it. `blockers` lists what would refuse the delete (the root node, or an organization node, which is deleted through the organizations API); when any is listed nothing else is counted. Otherwise: `subtree_size`, the node and every node beneath it; `roles`, the role assignments made in the subtree counted by role, and `assignments_total`; `identities_affected`, and `identities_losing_all_access`, those holding no assignment anywhere else in the Environment; `invites`, the pending invitations there, by email; and `directory_groups`, the directory groups mapped there, by name. The same sets the delete removes. People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts, and an empty page from the people route. The preview is kept under `id` until `expires_at`: read the holders whose assignments go, one row per person by name with `via`, their assignments as role at node, from `GET /api/v1/access-previews/{previewId}/people`, narrowed by `q`, `role_id`, `page` and `take`, and as a file from `…/people.csv`. Read-only. Send `version` as `If-Match` on the delete. Gated as the delete is: `hierarchy.manage` on the node. Returns `404` when the node is not found in this Environment.
1110
1114
  */
1111
1115
  post: operations["ApiNodesController_previewDeleteNode"];
1112
1116
  delete?: never;
@@ -1438,7 +1442,7 @@ interface paths {
1438
1442
  put?: never;
1439
1443
  /**
1440
1444
  * Preview moving a node inside an organization
1441
- * @description Reports what moving the node beneath `parent_node_id` would change, without moving it: the same answer as `POST /nodes/{id}/move/preview` (`blockers`, `subtree_size`, the counts per key and a page of the holders gaining and losing keys at the node, with the same query, and the invitations and directory groups that move with the subtree), authorized as the move is. Read-only.
1445
+ * @description Reports what moving the node beneath `parent_node_id` would change, without moving it: the same answer as `POST /nodes/{id}/move/preview` (`blockers`, `subtree_size`, the counts per key, with the holders gaining and losing keys paged from the stored preview by its `id`, and the invitations and directory groups that move with the subtree), authorized as the move is. Read-only.
1442
1446
  */
1443
1447
  post: operations["ApiOrganizationStructureController_previewMoveNode"];
1444
1448
  delete?: never;
@@ -1478,7 +1482,7 @@ interface paths {
1478
1482
  put?: never;
1479
1483
  /**
1480
1484
  * Preview deleting a node inside an organization
1481
- * @description Reports what deleting the node would remove, without deleting it: the same answer as `POST /nodes/{id}/delete/preview` (`blockers`, `subtree_size`, the assignments that go by role and who is left with no access, a page of the people whose assignments go, with the same query, the invitations revoked and the directory groups unmapped), authorized as the delete is. Read-only.
1485
+ * @description Reports what deleting the node would remove, without deleting it: the same answer as `POST /nodes/{id}/delete/preview` (`blockers`, `subtree_size`, the assignments that go by role and who is left with no access, with the people whose assignments go paged from the stored preview by its `id`, the invitations revoked and the directory groups unmapped), authorized as the delete is. Read-only.
1482
1486
  */
1483
1487
  post: operations["ApiOrganizationStructureController_previewDeleteNode"];
1484
1488
  delete?: never;
@@ -2554,7 +2558,7 @@ interface paths {
2554
2558
  put?: never;
2555
2559
  /**
2556
2560
  * Preview replacing a role's permissions
2557
- * @description Reports what replacing the role's permissions with `permission_keys` would change, without changing them: `added` and `removed`, and `blockers`, what would refuse the write, with the code and message it answers (`organization.last_admin`, `rbac.roles_manage_below_organization`); when any is listed no access is resolved. Otherwise, wherever the role is held now: `holders`, the identities it grants something to; `identities_gaining`, `identities_losing` and `permissions`, the counts per key, over everyone; and `people`, one page of the holders whose access changes, one row per person by name (a holder of the role at several nodes is one row), with the keys `gained` and `lost` once their other grants on each lineage are counted, `via`, the role at each node behind them, and `pagination`. The query narrows the page and never the counts: `q` (name or email), `direction` (`gains` or `loses`), `permission` (one key), `page` and `take` (up to 5000). People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts and an empty page, whatever the query. A disabled role (`role_active: false`) grants nothing either way. Resolved by the rules `evaluate` applies. Read-only. A key not in the Environment's catalog returns `404`, as on the write. Send `version` as `If-Match` on the write. Requires the `rbac.manage_roles` permission.
2561
+ * @description Reports what replacing the role's permissions with `permission_keys` would change, without changing them: `added` and `removed`, and `blockers`, what would refuse the write, with the code and message it answers (`organization.last_admin`, `rbac.roles_manage_below_organization`); when any is listed no access is resolved. Otherwise, wherever the role is held now: `holders`, the identities it grants something to; `identities_gaining`, `identities_losing` and `permissions`, the counts per key, over everyone. People are named only for a reader who may see the Environment's people (`people_named`: `env_identities.view` in the Console, and `production_identities.access` in a production Environment; `identity.view` for an API key; access administration at the node for a tenant's administrator); anyone else gets the counts, and an empty page from the people route. The preview is kept under `id` until `expires_at`: read the holders whose access changes, one row per person by name (a holder of the role at several nodes is one row) with the keys `gained` and `lost` once their other grants on each lineage are counted and `via`, the role at each node behind them, from `GET /api/v1/access-previews/{previewId}/people`, narrowed by `q`, `direction`, `permission`, `page` and `take`, and as a file from `…/people.csv`. A disabled role (`role_active: false`) grants nothing either way. Resolved by the rules `evaluate` applies. Read-only. A key not in the Environment's catalog returns `404`, as on the write. Send `version` as `If-Match` on the write. Requires the `rbac.manage_roles` permission.
2558
2562
  */
2559
2563
  post: operations["ApiRolesController_previewRolePermissions"];
2560
2564
  delete?: never;
@@ -2651,6 +2655,46 @@ interface paths {
2651
2655
  patch?: never;
2652
2656
  trace?: never;
2653
2657
  };
2658
+ "/api/v1/access-previews/{previewId}/people": {
2659
+ parameters: {
2660
+ query?: never;
2661
+ header?: never;
2662
+ path?: never;
2663
+ cookie?: never;
2664
+ };
2665
+ /**
2666
+ * List the people a stored access preview reaches
2667
+ * @description One page of the people a stored access preview reaches, by name, one row per person: for a move or a permissions preview the keys `gained` and `lost` with `via`, the grants behind them; for a delete preview `via`, their assignments that go. The preview is the one its id names, made by `POST …/move/preview`, `…/delete/preview` or `…/permissions/preview`; it is read only by the principal that made it, in the Environment it was made in, and only until its `expires_at`, so anyone else's, an expired one and an unknown id all answer `404`. Each read resolves the change again, under the gate its creation passed, and answers `409` `version_mismatch` once the node, its destination or the role has changed since the preview: preview the change again. The query narrows the page and never the preview's counts: `q` (name or email), `direction` (`gains` or `loses`) and `permission` (one key) on a change preview, `role_id` on a delete preview, `page` and `take` (up to 5000). A reader who may not see the Environment's people (`people_named` false on the preview) gets an empty page, whatever the query.
2668
+ */
2669
+ get: operations["ApiAccessPreviewsController_listPeople"];
2670
+ put?: never;
2671
+ post?: never;
2672
+ delete?: never;
2673
+ options?: never;
2674
+ head?: never;
2675
+ patch?: never;
2676
+ trace?: never;
2677
+ };
2678
+ "/api/v1/access-previews/{previewId}/people.csv": {
2679
+ parameters: {
2680
+ query?: never;
2681
+ header?: never;
2682
+ path?: never;
2683
+ cookie?: never;
2684
+ };
2685
+ /**
2686
+ * Export the people a stored access preview reaches
2687
+ * @description Every person the stored preview reaches, as a CSV file: for a move or a permissions preview one line per key gained or lost (`Name`, `Email`, `Change`, `Permission`, `Through`), for a delete preview one line per assignment that goes (`Name`, `Email`, `Role`, `Node`). Cells are neutralised against spreadsheet formula injection. Read under the same rules as the people route: the preview's maker only, in its Environment, until `expires_at` (`404` otherwise), and `409` once what it read has changed. A reader who may not see the Environment's people gets a file with the header line only.
2688
+ */
2689
+ get: operations["ApiAccessPreviewsController_exportPeople"];
2690
+ put?: never;
2691
+ post?: never;
2692
+ delete?: never;
2693
+ options?: never;
2694
+ head?: never;
2695
+ patch?: never;
2696
+ trace?: never;
2697
+ };
2654
2698
  "/api/v1/assignments/app-wide": {
2655
2699
  parameters: {
2656
2700
  query?: never;
@@ -3480,7 +3524,7 @@ interface components {
3480
3524
  assigned_count: number;
3481
3525
  unassigned_count: number;
3482
3526
  };
3483
- CreateIdentityDto: {
3527
+ ApiCreateIdentityDto: {
3484
3528
  email: string;
3485
3529
  first_name: string;
3486
3530
  last_name: string;
@@ -3492,9 +3536,16 @@ interface components {
3492
3536
  role_id?: string;
3493
3537
  /** @description Node for an initial assignment — required if role_id is provided */
3494
3538
  node_id?: string;
3539
+ /** @description An existing password hash to import instead of `password`, written the way `password_hash_algorithm` writes one. The identity signs in with its original password; after the first sign-in that proves it, Canopy replaces the hash with its own argon2id hash and runs the breach check, sending a breached password to reset. */
3540
+ password_hash?: string;
3541
+ /**
3542
+ * @description The algorithm `password_hash` is in. `bcrypt` is the modular crypt string (`$2a$`, `$2b$` or `$2y$`); `argon2id` the PHC string; `pbkdf2_sha256` Django's `pbkdf2_sha256$iterations$salt$hash`; `scrypt` Django's `scrypt$N$salt$r$p$hash`. Required with `password_hash`.
3543
+ * @enum {string}
3544
+ */
3545
+ password_hash_algorithm?: "bcrypt" | "argon2id" | "pbkdf2_sha256" | "scrypt";
3495
3546
  };
3496
- BulkCreateIdentitiesDto: {
3497
- identities: components["schemas"]["CreateIdentityDto"][];
3547
+ ApiBulkCreateIdentitiesDto: {
3548
+ identities: components["schemas"]["ApiCreateIdentityDto"][];
3498
3549
  };
3499
3550
  IdentityDetailResponseDto: {
3500
3551
  id: string;
@@ -3920,69 +3971,30 @@ interface components {
3920
3971
  gaining: number;
3921
3972
  losing: number;
3922
3973
  };
3923
- AssignmentIdentityDto: {
3924
- id: string;
3925
- first_name: string;
3926
- last_name: string;
3927
- name: string;
3928
- email: string;
3929
- avatar_url?: string | null;
3930
- };
3931
- PreviewNodeDto: {
3932
- id: string;
3933
- name: string;
3934
- };
3935
- PreviewGrantDto: {
3936
- /** @description The role */
3937
- role: components["schemas"]["PreviewNodeDto"];
3938
- /** @description Where it is held */
3939
- node: components["schemas"]["PreviewNodeDto"];
3940
- };
3941
- AccessChangeDto: {
3942
- identity: components["schemas"]["AssignmentIdentityDto"];
3943
- /** @description Keys the person gains */
3944
- gained: string[];
3945
- /** @description Keys the person loses */
3946
- lost: string[];
3947
- /** @description The grants that give the keys gained, or gave the keys lost */
3948
- via: components["schemas"]["PreviewGrantDto"][];
3949
- };
3950
- PreviewPageMetaDto: {
3951
- /** @description Current page number (1-based) */
3952
- page: number;
3953
- /** @description People per page */
3954
- take: number;
3955
- /** @description People matching the query */
3956
- item_count: number;
3957
- /** @description Total number of pages */
3958
- page_count: number;
3959
- /** @description Whether a previous page exists */
3960
- has_previous_page: boolean;
3961
- /** @description Whether a next page exists */
3962
- has_next_page: boolean;
3963
- };
3964
- AccessChangePageDto: {
3965
- /** @description One row per person, by name (none unless `people_named`) */
3966
- items: components["schemas"]["AccessChangeDto"][];
3967
- /** @description Paging over the people matching `q`, `direction` and `permission` */
3968
- pagination: components["schemas"]["PreviewPageMetaDto"];
3969
- };
3970
3974
  NamedSampleDto: {
3971
3975
  total: number;
3972
3976
  names: string[];
3973
3977
  };
3974
3978
  NodeMovePreviewDto: {
3979
+ /**
3980
+ * Format: uuid
3981
+ * @description The preview's id: read its people from `GET …/access-previews/:previewId/people`, and as a file from `…/people.csv`, until `expires_at`
3982
+ */
3983
+ id: string;
3984
+ /**
3985
+ * Format: date-time
3986
+ * @description When the preview stops being readable
3987
+ */
3988
+ expires_at: string;
3975
3989
  /** @description What would refuse the change. When any is listed, nothing below is resolved */
3976
3990
  blockers: components["schemas"]["PreviewBlockerDto"][];
3977
- /** @description Whether people are named: false for a reader who may not see the Environment's people, who gets the counts and no list */
3991
+ /** @description Whether people are named: false for a reader who may not see the Environment's people, who gets the counts and an empty people page */
3978
3992
  people_named: boolean;
3979
3993
  /** @description Holders who gain at least one permission */
3980
3994
  identities_gaining: number;
3981
3995
  /** @description Holders who lose at least one permission */
3982
3996
  identities_losing: number;
3983
3997
  permissions: components["schemas"]["PermissionChangeCountDto"][];
3984
- /** @description One page of the people the change reaches. The counts above cover everyone; the page follows the query */
3985
- people: components["schemas"]["AccessChangePageDto"];
3986
3998
  node_id: string;
3987
3999
  parent_node_id: string;
3988
4000
  /** @description The node's version now: send it as `If-Match` on the move */
@@ -3996,27 +4008,30 @@ interface components {
3996
4008
  /** @description Directory groups mapped to nodes in the subtree, which move with it, by name */
3997
4009
  directory_groups: components["schemas"]["NamedSampleDto"];
3998
4010
  };
4011
+ PreviewNodeDto: {
4012
+ id: string;
4013
+ name: string;
4014
+ };
3999
4015
  RoleRemovalCountDto: {
4000
4016
  role: components["schemas"]["PreviewNodeDto"];
4001
4017
  assignments: number;
4002
4018
  identities: number;
4003
4019
  };
4004
- PersonRemovalDto: {
4005
- identity: components["schemas"]["AssignmentIdentityDto"];
4006
- /** @description Their assignments that go, as role at node */
4007
- via: components["schemas"]["PreviewGrantDto"][];
4008
- };
4009
- PersonRemovalPageDto: {
4010
- /** @description One row per person, by name (none unless `people_named`) */
4011
- items: components["schemas"]["PersonRemovalDto"][];
4012
- /** @description Paging over the people matching `q` and `role_id` */
4013
- pagination: components["schemas"]["PreviewPageMetaDto"];
4014
- };
4015
4020
  NodeDeletePreviewDto: {
4021
+ /**
4022
+ * Format: uuid
4023
+ * @description The preview's id: read its people from `GET …/access-previews/:previewId/people`, and as a file from `…/people.csv`, until `expires_at`
4024
+ */
4025
+ id: string;
4026
+ /**
4027
+ * Format: date-time
4028
+ * @description When the preview stops being readable
4029
+ */
4030
+ expires_at: string;
4016
4031
  node_id: string;
4017
4032
  /** @description The node's version now: send it as `If-Match` on the delete */
4018
4033
  version: number;
4019
- /** @description Whether people are named: false for a reader who may not see the Environment's people */
4034
+ /** @description Whether people are named: false for a reader who may not see the Environment's people, who gets the counts and an empty people page */
4020
4035
  people_named: boolean;
4021
4036
  /** @description What would refuse the delete. When any is listed, nothing below is counted */
4022
4037
  blockers: components["schemas"]["PreviewBlockerDto"][];
@@ -4030,13 +4045,19 @@ interface components {
4030
4045
  roles: components["schemas"]["RoleRemovalCountDto"][];
4031
4046
  /** @description How many assignments go in all */
4032
4047
  assignments_total: number;
4033
- /** @description One page of the people whose assignments go. The counts above cover everyone; the page follows the query */
4034
- people: components["schemas"]["PersonRemovalPageDto"];
4035
4048
  /** @description Pending invitations revoked, by email (none listed unless `people_named`) */
4036
4049
  invites: components["schemas"]["NamedSampleDto"];
4037
4050
  /** @description Directory groups unmapped, by name */
4038
4051
  directory_groups: components["schemas"]["NamedSampleDto"];
4039
4052
  };
4053
+ AssignmentIdentityDto: {
4054
+ id: string;
4055
+ first_name: string;
4056
+ last_name: string;
4057
+ name: string;
4058
+ email: string;
4059
+ avatar_url?: string | null;
4060
+ };
4040
4061
  AssignmentRoleDto: {
4041
4062
  id: string;
4042
4063
  name: string;
@@ -5077,17 +5098,25 @@ interface components {
5077
5098
  message: string;
5078
5099
  };
5079
5100
  RolePermissionsPreviewDto: {
5101
+ /**
5102
+ * Format: uuid
5103
+ * @description The preview's id: read its people from `GET …/access-previews/:previewId/people`, and as a file from `…/people.csv`, until `expires_at`
5104
+ */
5105
+ id: string;
5106
+ /**
5107
+ * Format: date-time
5108
+ * @description When the preview stops being readable
5109
+ */
5110
+ expires_at: string;
5080
5111
  /** @description What would refuse the change. When any is listed, nothing below is resolved */
5081
5112
  blockers: components["schemas"]["PreviewBlockerDto"][];
5082
- /** @description Whether people are named: false for a reader who may not see the Environment's people, who gets the counts and no list */
5113
+ /** @description Whether people are named: false for a reader who may not see the Environment's people, who gets the counts and an empty people page */
5083
5114
  people_named: boolean;
5084
5115
  /** @description Holders who gain at least one permission */
5085
5116
  identities_gaining: number;
5086
5117
  /** @description Holders who lose at least one permission */
5087
5118
  identities_losing: number;
5088
5119
  permissions: components["schemas"]["PermissionChangeCountDto"][];
5089
- /** @description One page of the people the change reaches. The counts above cover everyone; the page follows the query */
5090
- people: components["schemas"]["AccessChangePageDto"];
5091
5120
  role_id: string;
5092
5121
  /** @description The role's version now: send it as `If-Match` on the permissions write */
5093
5122
  version: number;
@@ -5192,6 +5221,20 @@ interface components {
5192
5221
  /** @description The deny's permissions this one would lose. */
5193
5222
  loses: string[];
5194
5223
  };
5224
+ PreviewPageMetaDto: {
5225
+ /** @description Current page number (1-based) */
5226
+ page: number;
5227
+ /** @description People per page */
5228
+ take: number;
5229
+ /** @description People matching the query */
5230
+ item_count: number;
5231
+ /** @description Total number of pages */
5232
+ page_count: number;
5233
+ /** @description Whether a previous page exists */
5234
+ has_previous_page: boolean;
5235
+ /** @description Whether a next page exists */
5236
+ has_next_page: boolean;
5237
+ };
5195
5238
  DenyPreviewPeoplePageDto: {
5196
5239
  /** @description One row per person or machine client losing access, by name; machine clients only unless `people_named` */
5197
5240
  items: components["schemas"]["DenyPreviewPersonDto"][];
@@ -5221,6 +5264,21 @@ interface components {
5221
5264
  /** @description Up to 20 of those an exception role spares. */
5222
5265
  kept: components["schemas"]["DenyPreviewKeptDto"][];
5223
5266
  };
5267
+ PreviewGrantDto: {
5268
+ /** @description The role */
5269
+ role: components["schemas"]["PreviewNodeDto"];
5270
+ /** @description Where it is held */
5271
+ node: components["schemas"]["PreviewNodeDto"];
5272
+ };
5273
+ PreviewPersonDto: {
5274
+ identity: components["schemas"]["AssignmentIdentityDto"];
5275
+ /** @description Keys the person gains (a move or a permissions preview) */
5276
+ gained?: string[];
5277
+ /** @description Keys the person loses (a move or a permissions preview) */
5278
+ lost?: string[];
5279
+ /** @description The grants that give the keys gained or gave the keys lost; on a delete preview, the person's assignments that go */
5280
+ via: components["schemas"]["PreviewGrantDto"][];
5281
+ };
5224
5282
  AssignmentsSummaryDto: {
5225
5283
  active_count: number;
5226
5284
  scheduled_count: number;
@@ -5265,6 +5323,11 @@ interface components {
5265
5323
  metadata: Record<string, unknown>;
5266
5324
  /** Format: date-time */
5267
5325
  created_at: string;
5326
+ /**
5327
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5328
+ * @enum {string|null}
5329
+ */
5330
+ channel?: "mcp" | null;
5268
5331
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5269
5332
  actor_label?: string | null;
5270
5333
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5351,6 +5414,11 @@ interface components {
5351
5414
  severity?: "info" | "notice" | "warning" | "critical";
5352
5415
  /** @enum {string} */
5353
5416
  outcome?: "success" | "failure" | "denied";
5417
+ /**
5418
+ * @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server.
5419
+ * @enum {string}
5420
+ */
5421
+ channel?: "mcp";
5354
5422
  /** Format: uuid */
5355
5423
  actor_id?: string;
5356
5424
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
@@ -5393,6 +5461,11 @@ interface components {
5393
5461
  metadata: Record<string, unknown>;
5394
5462
  /** Format: date-time */
5395
5463
  created_at: string;
5464
+ /**
5465
+ * @description The channel the change came in through when it was not a direct call: `mcp` for a write an AI assistant made through the account MCP server, as the actor. NULL for a direct call.
5466
+ * @enum {string|null}
5467
+ */
5468
+ channel?: "mcp" | null;
5396
5469
  /** @description Snapshot label of the actor at write time (email for users / identities, label otherwise). NULL on rows written before the Slice 2 deploy. */
5397
5470
  actor_label?: string | null;
5398
5471
  /** @description Snapshot label of the affected resource at write time. NULL on rows written before the Slice 2 deploy. */
@@ -5800,7 +5873,7 @@ interface components {
5800
5873
  */
5801
5874
  access_mode: "scoped" | "full_access";
5802
5875
  /** @description Permission scopes this key is authorized for, each one the platform offers (`GET .../api-keys/scopes`). Required and must be non-empty when `access_mode` is `scoped`. Must be omitted when `access_mode` is `full_access`. */
5803
- scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "branding.view" | "branding.manage")[];
5876
+ scopes?: ("hierarchy.view" | "hierarchy.manage" | "rbac.view_roles" | "rbac.manage_roles" | "rbac.view_assignments" | "rbac.manage_assignments" | "permissions.evaluate" | "deny.view" | "deny.manage" | "identity.view" | "identity.manage" | "api_key.view" | "api_key.manage" | "webhook.view" | "webhook.manage" | "oauth_client.view" | "oauth_client.manage" | "audit.view" | "branding.view" | "branding.manage")[];
5804
5877
  /** @description Expiration date (ISO 8601). Omit for no expiration. */
5805
5878
  expires_at?: string;
5806
5879
  };
@@ -8378,7 +8451,7 @@ interface operations {
8378
8451
  };
8379
8452
  requestBody: {
8380
8453
  content: {
8381
- "application/json": components["schemas"]["CreateIdentityDto"];
8454
+ "application/json": components["schemas"]["ApiCreateIdentityDto"];
8382
8455
  };
8383
8456
  };
8384
8457
  responses: {
@@ -8393,7 +8466,7 @@ interface operations {
8393
8466
  };
8394
8467
  };
8395
8468
  };
8396
- /** @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 a role carrying `canopy:roles.manage` is placed beneath the organization node (`rbac.roles_manage_below_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
8469
+ /** @description The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), `password_hash` is not written the way `password_hash_algorithm` writes one (`identity.password_hash_invalid`), both `password` and `password_hash` were sent (`identity.password_and_hash_exclusive`), 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 a role carrying `canopy:roles.manage` is placed beneath the organization node (`rbac.roles_manage_below_organization`); or the request sent both an `X-API-Key` and an `Authorization` header */
8397
8470
  400: {
8398
8471
  headers: {
8399
8472
  [name: string]: unknown;
@@ -8404,7 +8477,7 @@ interface operations {
8404
8477
  * "error": {
8405
8478
  * "statusCode": 400,
8406
8479
  * "code": null,
8407
- * "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 a role carrying `canopy:roles.manage` is placed beneath the organization node (`rbac.roles_manage_below_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
8480
+ * "message": "The request failed validation, the password appears in a known data breach (HaveIBeenPwned check), `password_hash` is not written the way `password_hash_algorithm` writes one (`identity.password_hash_invalid`), both `password` and `password_hash` were sent (`identity.password_and_hash_exclusive`), 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 a role carrying `canopy:roles.manage` is placed beneath the organization node (`rbac.roles_manage_below_organization`); or the request sent both an `X-API-Key` and an `Authorization` header",
8408
8481
  * "timestamp": "2026-04-20T12:00:00.000Z",
8409
8482
  * "path": "/api/v1/identities",
8410
8483
  * "method": "POST"
@@ -8698,7 +8771,7 @@ interface operations {
8698
8771
  };
8699
8772
  requestBody: {
8700
8773
  content: {
8701
- "application/json": components["schemas"]["BulkCreateIdentitiesDto"];
8774
+ "application/json": components["schemas"]["ApiBulkCreateIdentitiesDto"];
8702
8775
  };
8703
8776
  };
8704
8777
  responses: {
@@ -12605,18 +12678,7 @@ interface operations {
12605
12678
  };
12606
12679
  ApiNodesController_previewMoveNode: {
12607
12680
  parameters: {
12608
- query?: {
12609
- /** @description Page of people (1-based) */
12610
- page?: number;
12611
- /** @description People per page (1-5000, default 20) */
12612
- take?: number;
12613
- /** @description Only people whose name or email contains this, ignoring case */
12614
- q?: string;
12615
- /** @description Only the people gaining access, or only those losing it */
12616
- direction?: "gains" | "loses";
12617
- /** @description Only the people gaining or losing this permission key (with `direction`, only that side) */
12618
- permission?: string;
12619
- };
12681
+ query?: never;
12620
12682
  header?: never;
12621
12683
  path: {
12622
12684
  id: string;
@@ -12728,16 +12790,7 @@ interface operations {
12728
12790
  };
12729
12791
  ApiNodesController_previewDeleteNode: {
12730
12792
  parameters: {
12731
- query?: {
12732
- /** @description Page of people (1-based) */
12733
- page?: number;
12734
- /** @description People per page (1-5000, default 20) */
12735
- take?: number;
12736
- /** @description Only people whose name or email contains this, ignoring case */
12737
- q?: string;
12738
- /** @description Only the people holding this role in the subtree */
12739
- role_id?: string;
12740
- };
12793
+ query?: never;
12741
12794
  header?: never;
12742
12795
  path: {
12743
12796
  id: string;
@@ -15021,18 +15074,7 @@ interface operations {
15021
15074
  };
15022
15075
  ApiOrganizationStructureController_previewMoveNode: {
15023
15076
  parameters: {
15024
- query?: {
15025
- /** @description Page of people (1-based) */
15026
- page?: number;
15027
- /** @description People per page (1-5000, default 20) */
15028
- take?: number;
15029
- /** @description Only people whose name or email contains this, ignoring case */
15030
- q?: string;
15031
- /** @description Only the people gaining access, or only those losing it */
15032
- direction?: "gains" | "loses";
15033
- /** @description Only the people gaining or losing this permission key (with `direction`, only that side) */
15034
- permission?: string;
15035
- };
15077
+ query?: never;
15036
15078
  header?: never;
15037
15079
  path: {
15038
15080
  id: string;
@@ -15282,16 +15324,7 @@ interface operations {
15282
15324
  };
15283
15325
  ApiOrganizationStructureController_previewDeleteNode: {
15284
15326
  parameters: {
15285
- query?: {
15286
- /** @description Page of people (1-based) */
15287
- page?: number;
15288
- /** @description People per page (1-5000, default 20) */
15289
- take?: number;
15290
- /** @description Only people whose name or email contains this, ignoring case */
15291
- q?: string;
15292
- /** @description Only the people holding this role in the subtree */
15293
- role_id?: string;
15294
- };
15327
+ query?: never;
15295
15328
  header?: never;
15296
15329
  path: {
15297
15330
  id: string;
@@ -24517,18 +24550,7 @@ interface operations {
24517
24550
  };
24518
24551
  ApiRolesController_previewRolePermissions: {
24519
24552
  parameters: {
24520
- query?: {
24521
- /** @description Page of people (1-based) */
24522
- page?: number;
24523
- /** @description People per page (1-5000, default 20) */
24524
- take?: number;
24525
- /** @description Only people whose name or email contains this, ignoring case */
24526
- q?: string;
24527
- /** @description Only the people gaining access, or only those losing it */
24528
- direction?: "gains" | "loses";
24529
- /** @description Only the people gaining or losing this permission key (with `direction`, only that side) */
24530
- permission?: string;
24531
- };
24553
+ query?: never;
24532
24554
  header?: never;
24533
24555
  path: {
24534
24556
  id: string;
@@ -25273,6 +25295,276 @@ interface operations {
25273
25295
  };
25274
25296
  };
25275
25297
  };
25298
+ ApiAccessPreviewsController_listPeople: {
25299
+ parameters: {
25300
+ query?: {
25301
+ /** @description Page of people (1-based) */
25302
+ page?: number;
25303
+ /** @description People per page (1-5000, default 20) */
25304
+ take?: number;
25305
+ /** @description Only people whose name or email contains this, ignoring case */
25306
+ q?: string;
25307
+ /** @description Change previews: only the people gaining access, or only those losing it */
25308
+ direction?: "gains" | "loses";
25309
+ /** @description Change previews: only the people gaining or losing this permission key (with `direction`, only that side) */
25310
+ permission?: string;
25311
+ /** @description Delete previews: only the people holding this role in the subtree */
25312
+ role_id?: string;
25313
+ };
25314
+ header?: never;
25315
+ path: {
25316
+ previewId: string;
25317
+ };
25318
+ cookie?: never;
25319
+ };
25320
+ requestBody?: never;
25321
+ responses: {
25322
+ /** @description One page of the people the preview reaches */
25323
+ 200: {
25324
+ headers: {
25325
+ [name: string]: unknown;
25326
+ };
25327
+ content: {
25328
+ "application/json": {
25329
+ items: components["schemas"]["PreviewPersonDto"][];
25330
+ pagination: components["schemas"]["PageMetaDto"];
25331
+ };
25332
+ };
25333
+ };
25334
+ /** @description The preview id is not a UUID or the query failed validation (`direction` other than `gains` or `loses`, `take` above 5000, `role_id` not a UUID); or the request sent both an `X-API-Key` and an `Authorization` header */
25335
+ 400: {
25336
+ headers: {
25337
+ [name: string]: unknown;
25338
+ };
25339
+ content: {
25340
+ /**
25341
+ * @example {
25342
+ * "error": {
25343
+ * "statusCode": 400,
25344
+ * "code": null,
25345
+ * "message": "The preview id is not a UUID or the query failed validation (`direction` other than `gains` or `loses`, `take` above 5000, `role_id` not a UUID); or the request sent both an `X-API-Key` and an `Authorization` header",
25346
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25347
+ * "path": "/api/v1/access-previews/{previewId}/people",
25348
+ * "method": "GET"
25349
+ * }
25350
+ * }
25351
+ */
25352
+ "application/json": components["schemas"]["ErrorResponseDto"];
25353
+ };
25354
+ };
25355
+ /** @description Invalid or expired token */
25356
+ 401: {
25357
+ headers: {
25358
+ [name: string]: unknown;
25359
+ };
25360
+ content: {
25361
+ /**
25362
+ * @example {
25363
+ * "error": {
25364
+ * "statusCode": 401,
25365
+ * "code": null,
25366
+ * "message": "Invalid or expired token",
25367
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25368
+ * "path": "/api/v1/access-previews/{previewId}/people",
25369
+ * "method": "GET"
25370
+ * }
25371
+ * }
25372
+ */
25373
+ "application/json": components["schemas"]["ErrorResponseDto"];
25374
+ };
25375
+ };
25376
+ /** @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 */
25377
+ 403: {
25378
+ headers: {
25379
+ [name: string]: unknown;
25380
+ };
25381
+ content: {
25382
+ /**
25383
+ * @example {
25384
+ * "error": {
25385
+ * "statusCode": 403,
25386
+ * "code": null,
25387
+ * "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",
25388
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25389
+ * "path": "/api/v1/access-previews/{previewId}/people",
25390
+ * "method": "GET"
25391
+ * }
25392
+ * }
25393
+ */
25394
+ "application/json": components["schemas"]["ErrorResponseDto"];
25395
+ };
25396
+ };
25397
+ /** @description No stored preview with this id was made by this principal in this Environment, or it has expired (`access_preview.not_found`); the node, its destination, the organization or the role the preview read no longer exists; or a resource the path names does not exist. Preview the change again */
25398
+ 404: {
25399
+ headers: {
25400
+ [name: string]: unknown;
25401
+ };
25402
+ content: {
25403
+ /**
25404
+ * @example {
25405
+ * "error": {
25406
+ * "statusCode": 404,
25407
+ * "code": null,
25408
+ * "message": "No stored preview with this id was made by this principal in this Environment, or it has expired (`access_preview.not_found`); the node, its destination, the organization or the role the preview read no longer exists; or a resource the path names does not exist. Preview the change again",
25409
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25410
+ * "path": "/api/v1/access-previews/{previewId}/people",
25411
+ * "method": "GET"
25412
+ * }
25413
+ * }
25414
+ */
25415
+ "application/json": components["schemas"]["ErrorResponseDto"];
25416
+ };
25417
+ };
25418
+ /** @description The node, its destination or the role has changed since the preview was made (`version_mismatch`); preview the change again */
25419
+ 409: {
25420
+ headers: {
25421
+ [name: string]: unknown;
25422
+ };
25423
+ content: {
25424
+ /**
25425
+ * @example {
25426
+ * "error": {
25427
+ * "statusCode": 409,
25428
+ * "code": null,
25429
+ * "message": "The node, its destination or the role has changed since the preview was made (`version_mismatch`); preview the change again",
25430
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25431
+ * "path": "/api/v1/access-previews/{previewId}/people",
25432
+ * "method": "GET"
25433
+ * }
25434
+ * }
25435
+ */
25436
+ "application/json": components["schemas"]["ErrorResponseDto"];
25437
+ };
25438
+ };
25439
+ };
25440
+ };
25441
+ ApiAccessPreviewsController_exportPeople: {
25442
+ parameters: {
25443
+ query?: never;
25444
+ header?: never;
25445
+ path: {
25446
+ previewId: string;
25447
+ };
25448
+ cookie?: never;
25449
+ };
25450
+ requestBody?: never;
25451
+ responses: {
25452
+ /** @description The people as a CSV file */
25453
+ 200: {
25454
+ headers: {
25455
+ [name: string]: unknown;
25456
+ };
25457
+ content: {
25458
+ "text/csv": string;
25459
+ };
25460
+ };
25461
+ /** @description The preview id is not a UUID; or the request sent both an `X-API-Key` and an `Authorization` header */
25462
+ 400: {
25463
+ headers: {
25464
+ [name: string]: unknown;
25465
+ };
25466
+ content: {
25467
+ /**
25468
+ * @example {
25469
+ * "error": {
25470
+ * "statusCode": 400,
25471
+ * "code": null,
25472
+ * "message": "The preview id is not a UUID; or the request sent both an `X-API-Key` and an `Authorization` header",
25473
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25474
+ * "path": "/api/v1/access-previews/{previewId}/people.csv",
25475
+ * "method": "GET"
25476
+ * }
25477
+ * }
25478
+ */
25479
+ "application/json": components["schemas"]["ErrorResponseDto"];
25480
+ };
25481
+ };
25482
+ /** @description Invalid or expired token */
25483
+ 401: {
25484
+ headers: {
25485
+ [name: string]: unknown;
25486
+ };
25487
+ content: {
25488
+ /**
25489
+ * @example {
25490
+ * "error": {
25491
+ * "statusCode": 401,
25492
+ * "code": null,
25493
+ * "message": "Invalid or expired token",
25494
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25495
+ * "path": "/api/v1/access-previews/{previewId}/people",
25496
+ * "method": "GET"
25497
+ * }
25498
+ * }
25499
+ */
25500
+ "application/json": components["schemas"]["ErrorResponseDto"];
25501
+ };
25502
+ };
25503
+ /** @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 */
25504
+ 403: {
25505
+ headers: {
25506
+ [name: string]: unknown;
25507
+ };
25508
+ content: {
25509
+ /**
25510
+ * @example {
25511
+ * "error": {
25512
+ * "statusCode": 403,
25513
+ * "code": null,
25514
+ * "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",
25515
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25516
+ * "path": "/api/v1/access-previews/{previewId}/people",
25517
+ * "method": "GET"
25518
+ * }
25519
+ * }
25520
+ */
25521
+ "application/json": components["schemas"]["ErrorResponseDto"];
25522
+ };
25523
+ };
25524
+ /** @description No stored preview with this id was made by this principal in this Environment, or it has expired (`access_preview.not_found`); the node, its destination, the organization or the role the preview read no longer exists; or a resource the path names does not exist. Preview the change again */
25525
+ 404: {
25526
+ headers: {
25527
+ [name: string]: unknown;
25528
+ };
25529
+ content: {
25530
+ /**
25531
+ * @example {
25532
+ * "error": {
25533
+ * "statusCode": 404,
25534
+ * "code": null,
25535
+ * "message": "No stored preview with this id was made by this principal in this Environment, or it has expired (`access_preview.not_found`); the node, its destination, the organization or the role the preview read no longer exists; or a resource the path names does not exist. Preview the change again",
25536
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25537
+ * "path": "/api/v1/access-previews/{previewId}/people.csv",
25538
+ * "method": "GET"
25539
+ * }
25540
+ * }
25541
+ */
25542
+ "application/json": components["schemas"]["ErrorResponseDto"];
25543
+ };
25544
+ };
25545
+ /** @description The node, its destination or the role has changed since the preview was made (`version_mismatch`); preview the change again */
25546
+ 409: {
25547
+ headers: {
25548
+ [name: string]: unknown;
25549
+ };
25550
+ content: {
25551
+ /**
25552
+ * @example {
25553
+ * "error": {
25554
+ * "statusCode": 409,
25555
+ * "code": null,
25556
+ * "message": "The node, its destination or the role has changed since the preview was made (`version_mismatch`); preview the change again",
25557
+ * "timestamp": "2026-04-20T12:00:00.000Z",
25558
+ * "path": "/api/v1/access-previews/{previewId}/people.csv",
25559
+ * "method": "GET"
25560
+ * }
25561
+ * }
25562
+ */
25563
+ "application/json": components["schemas"]["ErrorResponseDto"];
25564
+ };
25565
+ };
25566
+ };
25567
+ };
25276
25568
  ApiAssignmentsController_listAppWideAssignments: {
25277
25569
  parameters: {
25278
25570
  query?: {
@@ -26265,6 +26557,8 @@ interface operations {
26265
26557
  category?: "auth" | "identity" | "admin_user" | "tenancy" | "hierarchy" | "organization" | "rbac" | "authorization" | "api_keys" | "oauth" | "webhooks" | "invites" | "mfa" | "audit" | "billing" | "sso" | "unknown";
26266
26558
  severity?: "info" | "notice" | "warning" | "critical";
26267
26559
  outcome?: "success" | "failure" | "denied";
26560
+ /** @description Only rows written through this channel: `mcp` for changes an AI assistant made through the account MCP server. */
26561
+ channel?: "mcp";
26268
26562
  actor_id?: string;
26269
26563
  /** @description Free-form actor-type filter (e.g. `user`, `identity`). */
26270
26564
  actor_type?: string;
@@ -30565,6 +30859,48 @@ declare class Canopy {
30565
30859
  constructor(options: CanopyClientOptions);
30566
30860
  }
30567
30861
 
30862
+ /**
30863
+ * Which of a {@link LocalAuthorizer}'s cached answers a change makes stale.
30864
+ *
30865
+ * A webhook delivery and a change-feed entry share one shape, `{ event, data }`,
30866
+ * so both are read here. The rule is the narrowest invalidation that is still
30867
+ * correct: a change that names whose access moved drops those subjects' grants
30868
+ * and nothing else; a change whose reach the event cannot name (a role's
30869
+ * permissions, the hierarchy, a deny on every holder of a role) drops
30870
+ * everything; a change that moves no one's access drops nothing.
30871
+ *
30872
+ * An event this SDK does not know drops everything. A newer Canopy can send
30873
+ * events an older SDK has never seen, and guessing that one is harmless would
30874
+ * be the unsafe direction: a cache cleared for nothing costs one read per
30875
+ * subject, a cache kept past a revocation costs a wrong allow.
30876
+ */
30877
+ /** A change as it arrives: a webhook delivery or a change-feed entry. */
30878
+ interface AuthorizationChange {
30879
+ event: string;
30880
+ data: {
30881
+ resource_type?: string | null;
30882
+ resource_id?: string | null;
30883
+ metadata?: Record<string, unknown> | null;
30884
+ };
30885
+ }
30886
+ /** A principal whose cached grants a change dropped. */
30887
+ interface InvalidatedSubject {
30888
+ principalType: PrincipalType;
30889
+ id: string;
30890
+ }
30891
+ /** What applying one change did to the cache. */
30892
+ type AppliedChange = {
30893
+ event: string;
30894
+ invalidated: "none";
30895
+ } | {
30896
+ event: string;
30897
+ invalidated: "subjects";
30898
+ subjects: InvalidatedSubject[];
30899
+ } | {
30900
+ event: string;
30901
+ invalidated: "all";
30902
+ };
30903
+
30568
30904
  /**
30569
30905
  * The longest a held answer may be kept: five minutes. `ttlMs` is the delay
30570
30906
  * between an access change and it taking effect, and Canopy promises that
@@ -30724,6 +31060,27 @@ interface LocalAuthorizerStats {
30724
31060
  /** Revalidations the server answered `304`, so no tree was transferred. */
30725
31061
  treeNotModified: number;
30726
31062
  }
31063
+ interface ReplayChangesOptions {
31064
+ /**
31065
+ * Where the last replay stopped: the `cursor` it returned. Omit it the
31066
+ * first time, and the replay starts at the oldest change Canopy still
31067
+ * retains.
31068
+ */
31069
+ cursor?: string | null;
31070
+ }
31071
+ interface ReplayChangesResult {
31072
+ /**
31073
+ * Where this replay stopped. Keep it, and pass it to the next replay;
31074
+ * `null` only when the feed has never held a change.
31075
+ */
31076
+ cursor: string | null;
31077
+ /** How many changes were read and applied. */
31078
+ changes: number;
31079
+ /** Whether any change dropped the whole cache. */
31080
+ invalidatedAll: boolean;
31081
+ /** How many subjects' grants were dropped one at a time. */
31082
+ subjectsInvalidated: number;
31083
+ }
30727
31084
  declare class LocalAuthorizer {
30728
31085
  private readonly client;
30729
31086
  private readonly ttlMs;
@@ -30744,6 +31101,13 @@ declare class LocalAuthorizer {
30744
31101
  */
30745
31102
  private readonly pendingGrants;
30746
31103
  private pendingTree;
31104
+ /**
31105
+ * Bumped by every full invalidation. A hierarchy read that began before
31106
+ * the bump answers the caller that was waiting on it but is not kept, so
31107
+ * a read already in flight when a change lands cannot cache what the
31108
+ * change replaced. Grants use the pending map for the same purpose.
31109
+ */
31110
+ private treeGeneration;
30747
31111
  private stats;
30748
31112
  constructor(client: CanopyClient, options?: LocalAuthorizerOptions);
30749
31113
  /**
@@ -30879,6 +31243,41 @@ declare class LocalAuthorizer {
30879
31243
  * top of it — size the TTL to the revocation latency you can promise.
30880
31244
  */
30881
31245
  invalidate(identityId?: string, subject?: SubjectOptions): void;
31246
+ /**
31247
+ * Drop what one change makes stale, from a webhook delivery or a
31248
+ * change-feed entry (the two share one shape). Answers what it dropped.
31249
+ *
31250
+ * A change naming whose access moved (an assignment, an Environment or
31251
+ * organization membership, an identity's status, a deny on one person,
31252
+ * a machine client disabled or deleted) drops those subjects' grants and
31253
+ * keeps everyone else's and the hierarchy warm. A change whose reach it
31254
+ * cannot name (a role, a permission, a node, the hierarchy schema, an
31255
+ * organization created or deleted, a deny on a role or a machine client,
31256
+ * a directory group mapped) drops everything. A change that moves no
31257
+ * one's access (a profile edit, a sign-in policy, a session revoked)
31258
+ * drops nothing. An event this SDK does not know drops everything.
31259
+ *
31260
+ * Check the delivery's signature first (`verifyWebhookSignature`): this
31261
+ * trusts what it is given. Like {@link invalidate}, it reaches this
31262
+ * process only; see there for what that means across several instances.
31263
+ */
31264
+ applyEvent(change: AuthorizationChange): AppliedChange;
31265
+ /**
31266
+ * Read `GET /api/v1/changes` from `cursor` to the newest change and apply
31267
+ * each one, as {@link applyEvent} would a webhook. Answers the cursor to
31268
+ * resume from next time.
31269
+ *
31270
+ * Two uses. After a restart, to catch up on deliveries a process missed
31271
+ * while it was down, before it serves from a cache warmed elsewhere. And
31272
+ * in place of webhooks: every instance polling on an interval shorter
31273
+ * than `ttlMs` sees every change, which a webhook (delivered to one
31274
+ * instance) does not give a fleet.
31275
+ *
31276
+ * The feed holds what the audit log retains, so a cursor older than that
31277
+ * resumes at the oldest change still held. Each page is one request; a
31278
+ * replay with no cursor walks the whole retained window once.
31279
+ */
31280
+ replayChanges(options?: ReplayChangesOptions): Promise<ReplayChangesResult>;
30882
31281
  /** Fire the decision hooks, after the verdict and without waiting on them. */
30883
31282
  private announce;
30884
31283
  /** The node and its ancestors, from the tree this client can read. */
@@ -31119,8 +31518,9 @@ interface TokenVerifierOptions {
31119
31518
  /**
31120
31519
  * The Environment whose tokens are accepted. Every Environment is its own
31121
31520
  * issuer with its own signing keys, at
31122
- * `https://auth.canopy-io.com/environments/<id>`, so on hosted Canopy this is
31123
- * all verification needs. A token from any other Environment fails.
31521
+ * `https://auth.canopy-io.com/environments/<id>` (or under `CANOPY_BASE_URL`
31522
+ * when that environment variable is set), so on hosted Canopy this is all
31523
+ * verification needs. A token from any other Environment fails.
31124
31524
  *
31125
31525
  * Set exactly one of `environmentId` and `issuer`; the constructor throws
31126
31526
  * with neither or both.
@@ -31437,5 +31837,66 @@ type WebhookEventData<Name extends WebhookEventName> = WebhookEvent<Name>["data"
31437
31837
  * event's `metadata` without a cast.
31438
31838
  */
31439
31839
  declare function isWebhookEvent<Name extends WebhookEventName>(delivery: WebhookDelivery, name: Name): delivery is WebhookEvent<Name>;
31840
+ /** The headers a delivery carries, in any of the shapes a server hands them over. */
31841
+ type WebhookHeaders = Headers | Record<string, string | string[] | undefined>;
31842
+ interface VerifyWebhookSignatureInput {
31843
+ /** The request's headers: Node's `req.headers`, a Fetch `Headers`, or a plain record. */
31844
+ headers: WebhookHeaders;
31845
+ /**
31846
+ * The request body exactly as it arrived. Parsing and re-serializing the
31847
+ * JSON changes spacing or key order, and the signature no longer matches.
31848
+ */
31849
+ rawBody: string | Uint8Array;
31850
+ /**
31851
+ * The subscription's signing secret. Pass the old and the new while you
31852
+ * roll a rotated secret out: a delivery signed by either verifies.
31853
+ */
31854
+ secret: string | readonly string[];
31855
+ /**
31856
+ * How far `X-Canopy-Timestamp` may be from this machine's clock, in
31857
+ * seconds, before the delivery is refused as a replay. Default 300. Each
31858
+ * retry is signed again with its own timestamp, so a retried delivery is
31859
+ * never refused for its age.
31860
+ */
31861
+ toleranceSeconds?: number;
31862
+ /** The current time in milliseconds, for tests. Default `Date.now`. */
31863
+ now?: () => number;
31864
+ }
31865
+ /** The default replay window: five minutes either side of this machine's clock. */
31866
+ declare const WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS = 300;
31867
+ /**
31868
+ * Whether a webhook delivery is Canopy's, unaltered and recent.
31869
+ *
31870
+ * Canopy signs `{X-Canopy-Webhook-Id}.{X-Canopy-Timestamp}.{raw body}` with
31871
+ * HMAC-SHA256 under the subscription's signing secret and sends it in
31872
+ * `X-Canopy-Signature` as `v1,<hex>`. For a while after a secret rotation
31873
+ * the header carries two values, the new secret's first; the delivery is
31874
+ * accepted when any value matches any secret given. The comparison is the
31875
+ * Web Crypto HMAC verify, which runs in constant time, so this works in
31876
+ * Node, Deno, Bun and edge workers alike.
31877
+ *
31878
+ * Resolves `false`, never rejects, for a missing header, a timestamp outside
31879
+ * the tolerance, or no match, so a handler refuses with one status:
31880
+ *
31881
+ * app.post(
31882
+ * "/webhooks/canopy",
31883
+ * express.raw({ type: "application/json" }),
31884
+ * async (req, res) => {
31885
+ * const valid = await verifyWebhookSignature({
31886
+ * headers: req.headers,
31887
+ * rawBody: req.body,
31888
+ * secret: process.env.CANOPY_WEBHOOK_SECRET,
31889
+ * });
31890
+ *
31891
+ * if (!valid) {
31892
+ * return res.sendStatus(401);
31893
+ * }
31894
+ *
31895
+ * const delivery = JSON.parse(req.body.toString()) as WebhookDelivery;
31896
+ * // …
31897
+ * },
31898
+ * );
31899
+ */
31900
+ declare function verifyWebhookSignature(input: VerifyWebhookSignatureInput): Promise<boolean>;
31440
31901
 
31441
- 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, type OrganizationStaffActivityItem, 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 };
31902
+ export { type AccessibleNodes, type AppliedChange, type AssignmentItem, Assignments, type AuthorizationChange, 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 InvalidatedSubject, 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, type OrganizationStaffActivityItem, Organizations, type PageFetcher, type PageParams, type PaginateOptions, type Pagination, Paginator, type PartialSuccess, type PermissionItem, Permissions, type PrincipalType, type QueryParams, type ReplayChangesOptions, type ReplayChangesResult, type RequestBody, type RequestOptions, type ResponseBody, type RoleItem, Roles, type Schema, type SubjectOptions, TokenVerifier, type TokenVerifierOptions, type VerifyCallOptions, type VerifyWebhookSignatureInput, WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS, type WebhookDelivery, type WebhookEvent, type WebhookEventData, type WebhookEventName, type WebhookHeaders, authorizationErrorStatus, type components, isCanopyAuthorizerError, isCanopyConnectionError, isCanopyError, isCanopyTokenError, isCursorPagination, isWebhookEvent, type operations, orgContext, paginate, type paths, tokenErrorStatus, verifyWebhookSignature, withConcurrency };