picked 0.0.1-dev.1795388735478 → 0.0.1-dev.1795567554153

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.
@@ -49,9 +49,8 @@ const picked = createClient({
49
49
  })
50
50
  ```
51
51
 
52
- Each tool is an entry of its own in the sidebar. In React use `usePicked()`, and in Svelte use
53
- `getPicked()`. To show a tool in a different place, see
54
- [How to add a tool to the devtools](/how-to/add-a-tool-to-the-devtools).
52
+ Your tools appear under a **Custom Tools** tab. In React use `usePicked()`, and in Svelte
53
+ use `getPicked()`.
55
54
 
56
55
  ## Related
57
56
 
@@ -279,10 +279,11 @@ package. `options.timeoutMs` sets the time limit of one request. The default is
279
279
 
280
280
  A request throws these errors:
281
281
 
282
- | Error | When |
283
- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
284
- | `AdminApiResponseError` | The answer has GraphQL errors. The `message` has the message of each error, one on each line. `codes` has the code of each error. |
285
- | `Error` | The request fails, it takes more than its time limit, or the answer has an HTTP error and no GraphQL errors. |
282
+ | Error | When |
283
+ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
284
+ | `AdminApiResponseError` | The answer has GraphQL errors. The `message` has the message of each error, one on each line. `codes` has the code of each error. |
285
+ | `AdminApiRateLimitError` | Picked refuses the request with a `429` status 4 times. The client waits about 1 second before it sends each retry. |
286
+ | `Error` | The request fails, it takes more than its time limit, or the answer has an HTTP error and no GraphQL errors. |
286
287
 
287
288
  ```ts
288
289
  import { graphql } from '@picked/admin-api-client'
@@ -5,8 +5,8 @@ layout: docs
5
5
 
6
6
  # Labels
7
7
 
8
- A label is a name and a value on a lead, a project, a workflow run or an app installation. A
9
- workflow sets and removes labels with tool nodes. A label can expire, a write can be conditional, and a node
8
+ A label is a name and a value on a lead, a project, a workflow run, an app installation or an
9
+ organization. A workflow sets and removes labels with tool nodes. A label can expire, a write can be conditional, and a node
10
10
  can increment a `number` label.
11
11
 
12
12
  ## Name, type and value
@@ -18,22 +18,54 @@ can increment a `number` label.
18
18
  | Type | `text`, `number`, `boolean` or `json`. It tells how to read the value. |
19
19
  | Value | Text. A `number` label holds a number, a `boolean` label holds `true` or `false`, and a `json` label holds a JSON document. |
20
20
 
21
- The lead, the project or the run that has a label is the owner of the label. An owner has
21
+ The lead, the project, the run, the installation or the organization that has a label is the
22
+ owner of the label. An owner has
22
23
  one label for each namespace and key.
23
24
 
24
25
  ## Owners
25
26
 
26
- | Owner | Where the labels stay | Scope to read the labels | Scope to set and remove the labels |
27
- | ---------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | ---------------------------------- |
28
- | Lead | Until you delete the lead. Picked deletes the labels of a lead with the lead. | `ORGANIZATION_LEADS_READ` | `ORGANIZATION_LEADS_UPDATE` |
29
- | Project | Picked keeps the labels when you delete the project. These labels hold data for all the runs of the project. | `ORGANIZATION_PROJECTS_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
30
- | Workflow run | With the run. Picked does not delete a run. | `ORGANIZATION_WORKSPACE_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
31
- | App installation | Until you uninstall the app. Picked deletes the labels of an installation with the installation. | `ORGANIZATION_APPS_READ` | `ORGANIZATION_APPS_UPDATE` |
27
+ | Owner | Where the labels stay | Scope to read the labels | Scope to set and remove the labels |
28
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- | ---------------------------------- |
29
+ | Lead | Until you delete the lead. Picked deletes the labels of a lead with the lead. | `ORGANIZATION_LEADS_READ` | `ORGANIZATION_LEADS_UPDATE` |
30
+ | Project | Picked keeps the labels when you delete the project. These labels hold data for all the runs of the project. | `ORGANIZATION_PROJECTS_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
31
+ | Workflow run | With the run. Picked does not delete a run. | `ORGANIZATION_WORKSPACE_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
32
+ | App installation | Until you uninstall the app. Picked deletes the labels of an installation with the installation. | `ORGANIZATION_APPS_READ` | `ORGANIZATION_APPS_UPDATE` |
33
+ | Organization | Picked keeps the labels when you delete the organization. All the projects of the organization share these labels. | `ORGANIZATION_READ` | `ORGANIZATION_UPDATE` |
32
34
 
33
35
  A run reads, sets and removes its own labels without a scope. An app installation reads, sets
34
36
  and removes its own labels with its own token, without a scope. The owner type of an app
35
37
  installation in the API is `APP_INSTALLATION`.
36
38
 
39
+ ## Organization labels
40
+
41
+ The labels of an organization are not in a project. All the projects of the organization read
42
+ and write the same labels. Use them for data that more than one project must share, for
43
+ example:
44
+
45
+ - A counter of the calls that one call center takes in a day, for all the brands of the
46
+ organization.
47
+ - A label that only one run at a time can hold for one visitor, across all the brands of the
48
+ organization.
49
+
50
+ The owner type of an organization in the API is `ORGANIZATION`, and the owner ID is the ID of
51
+ the organization.
52
+
53
+ All the members of an organization have `ORGANIZATION_READ` for it, and can read its labels.
54
+ To change the labels, you must have `ORGANIZATION_UPDATE` for all the organization. The scope
55
+ for one project is not enough. Do not keep data in an organization label that some members
56
+ must not see.
57
+
58
+ A workflow run can read and write only the labels of its own organization. To save a workflow
59
+ that uses **Set organization labels** or **Remove organization labels**, you must have
60
+ `ORGANIZATION_UPDATE` for all the organization. An API key for one project cannot read or
61
+ write organization labels.
62
+
63
+ All the projects of the organization use the same namespaces and keys. Two projects that set
64
+ the same namespace and key change the same label.
65
+
66
+ When a run changes an organization label, its task records the operation. When you change an
67
+ organization label in the dashboard or with the API, Picked does not record an operation.
68
+
37
69
  ## Secret labels
38
70
 
39
71
  Only the labels of an app installation can be secret. A secret label has `secret: true`.
@@ -50,14 +82,16 @@ to [How to store data for an installation](/how-to/apps/store-data-for-an-instal
50
82
 
51
83
  The **Labels** card shows the labels of one owner, in one section for each namespace.
52
84
 
53
- | Page | Where the card shows | Scope to change the labels |
54
- | -------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------ |
55
- | Lead | Next to the responses, or below them on a medium screen. On a narrow screen, it is on the **Labels** tab. | `ORGANIZATION_LEADS_UPDATE` |
56
- | Project labels | At `…/<project>/settings/labels`. The page opens for `ORGANIZATION_PROJECTS_READ`. | `ORGANIZATION_PROJECTS_UPDATE` |
57
- | Run | Below the details of the run. On a narrow screen, the card is on the **Labels** tab. | `ORGANIZATION_PROJECTS_UPDATE` |
85
+ | Page | Where the card shows | Scope to change the labels |
86
+ | ------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------ |
87
+ | Lead | Next to the responses, or below them on a medium screen. On a narrow screen, it is on the **Labels** tab. | `ORGANIZATION_LEADS_UPDATE` |
88
+ | Project labels | At `…/<project>/settings/labels`. The page opens for `ORGANIZATION_PROJECTS_READ`. | `ORGANIZATION_PROJECTS_UPDATE` |
89
+ | Organization labels | At `/<organization>/settings/labels`. The page opens for `ORGANIZATION_READ`. | `ORGANIZATION_UPDATE` |
90
+ | Run | Below the details of the run. On a narrow screen, the card is on the **Labels** tab. | `ORGANIZATION_PROJECTS_UPDATE` |
58
91
 
59
92
  The project settings have a **Labels** link to the Project labels page. To open the project
60
- settings, you must have `ORGANIZATION_PROJECTS_UPDATE`.
93
+ settings, you must have `ORGANIZATION_PROJECTS_UPDATE`. The organization settings have a
94
+ **Labels** link to the Organization labels page.
61
95
 
62
96
  Without the scope, the card shows the labels, and you cannot change them.
63
97
 
@@ -74,41 +108,46 @@ With the scope, the card has these controls:
74
108
  A label with an expiry shows the time until it expires. You can remove it, but you cannot
75
109
  change its value.
76
110
 
77
- ## Visitor data in project and run labels
111
+ ## Visitor data in project, run and organization labels
78
112
 
79
- The labels of a project and of a run stay after Picked deletes a lead. Picked does not delete
80
- visitor data in a project label or a run label with the lead. Visitor data is, for example, an
113
+ The labels of a project, of a run and of an organization stay after Picked deletes a lead.
114
+ Picked does not delete visitor data in these labels with the lead. Visitor data is, for example, an
81
115
  email address, a phone number or a Picked ID.
82
116
 
83
- A project label or a run label can have the `sha256` hash of a visitor identifier as its key.
84
- With a hash, a workflow can hold a label for one visitor across runs. Use `expiresIn` to set
117
+ A project label, a run label or an organization label can have the `sha256` hash of a visitor
118
+ identifier as its key. With a hash, a workflow can hold a label for one visitor across runs. An
119
+ organization label with a hash connects one visitor across all the projects of the
120
+ organization. Use `expiresIn` to set
85
121
  how long the label stays. Refer to [Example: one run at a time for each visitor](#example-one-run-at-a-time-for-each-visitor).
86
122
 
87
123
  ## Tools
88
124
 
89
- | Tool | Name in the editor | Owner | Output | Scopes |
90
- | ----------------------- | ------------------------- | ------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------- |
91
- | `set_lead_labels` | **Set lead labels** | The lead in its `lead` argument | `lead` and `count` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
92
- | `remove_lead_labels` | **Remove lead labels** | The lead in its `lead` argument | `lead` and `removed` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
93
- | `create_lead` | **Create lead** | The lead that it makes | `lead`, `created` and `labelCount` | `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE` |
94
- | `set_project_labels` | **Set project labels** | The project of the run | `project` and `count` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
95
- | `remove_project_labels` | **Remove project labels** | The project of the run | `project` and `removed` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
96
- | `get_project` | **Get project** | The project of the run | `project` | `ORGANIZATION_PROJECTS_READ` |
97
- | `set_run_labels` | **Set run labels** | The run | `run` and `count` | None |
98
- | `remove_run_labels` | **Remove run labels** | The run | `run` and `removed` | None |
99
- | `get_run` | **Get run** | The run | `run` | None |
100
-
101
- **Set project labels**, **Remove project labels**, **Set run labels**, **Remove run labels**,
102
- **Get project** and **Get run** have no argument for the owner.
103
-
104
- The `lead`, `project` and `run` outputs hold the labels of the owner at the time that a later
105
- node reads them, as `labels.<namespace>.<key>`:
106
-
107
- | Output | Fields |
108
- | --------- | ------------------------- |
109
- | `lead` | The lead, and `labels` |
110
- | `project` | `id`, `name` and `labels` |
111
- | `run` | `id` and `labels` |
125
+ | Tool | Name in the editor | Owner | Output | Scopes |
126
+ | ---------------------------- | ------------------------------ | ------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------- |
127
+ | `set_lead_labels` | **Set lead labels** | The lead in its `lead` argument | `lead` and `count` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
128
+ | `remove_lead_labels` | **Remove lead labels** | The lead in its `lead` argument | `lead` and `removed` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
129
+ | `create_lead` | **Create lead** | The lead that it makes | `lead`, `created` and `labelCount` | `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE` |
130
+ | `set_project_labels` | **Set project labels** | The project of the run | `project` and `count` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
131
+ | `remove_project_labels` | **Remove project labels** | The project of the run | `project` and `removed` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
132
+ | `get_project` | **Get project** | The project of the run | `project` | `ORGANIZATION_PROJECTS_READ` |
133
+ | `set_organization_labels` | **Set organization labels** | The organization of the run | `organization` and `count` | `ORGANIZATION_UPDATE` and `ORGANIZATION_READ` |
134
+ | `remove_organization_labels` | **Remove organization labels** | The organization of the run | `organization` and `removed` | `ORGANIZATION_UPDATE` and `ORGANIZATION_READ` |
135
+ | `get_organization` | **Get organization** | The organization of the run | `organization` | `ORGANIZATION_READ` |
136
+ | `set_run_labels` | **Set run labels** | The run | `run` and `count` | None |
137
+ | `remove_run_labels` | **Remove run labels** | The run | `run` and `removed` | None |
138
+ | `get_run` | **Get run** | The run | `run` | None |
139
+
140
+ The project, organization and run tools have no argument for the owner.
141
+
142
+ The `lead`, `project`, `organization` and `run` outputs hold the labels of the owner. They show
143
+ the labels when a later node reads them, as `labels.<namespace>.<key>`:
144
+
145
+ | Output | Fields |
146
+ | -------------- | ------------------------- |
147
+ | `lead` | The lead, and `labels` |
148
+ | `project` | `id`, `name` and `labels` |
149
+ | `organization` | `id`, `name` and `labels` |
150
+ | `run` | `id` and `labels` |
112
151
 
113
152
  For example, `{{ nodes.project.project.labels.cms.sent_today }}` reads the label
114
153
  `cms.sent_today` of the project.
@@ -125,8 +164,8 @@ For the run tools in a test run, refer to
125
164
 
126
165
  ## A row that sets a label
127
166
 
128
- The `labels` argument of **Set lead labels**, **Set project labels**, **Set run labels** and
129
- **Create lead** is a list of rows. Each row sets one label.
167
+ The `labels` argument of **Set lead labels**, **Set project labels**, **Set organization
168
+ labels**, **Set run labels** and **Create lead** is a list of rows. Each row sets one label.
130
169
 
131
170
  | Field | Type | Default | Description |
132
171
  | -------------- | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
@@ -177,7 +216,7 @@ it shows no rows. **Replace with rows** removes the template after you confirm i
177
216
  A label with `expiresIn` expires that number of seconds after the node sets it. Picked does
178
217
  not show an expired label:
179
218
 
180
- - The `lead`, `project` or `run` output of a tool does not have it.
219
+ - The `lead`, `project`, `organization` or `run` output of a tool does not have it.
181
220
  - A lead search clause does not match it. A negative clause, such as `-cms.status:*`, matches
182
221
  the lead.
183
222
  - A lead sorts as if it does not have the label.
@@ -210,8 +249,8 @@ A row with `increment` cannot have `onlyIfAbsent`.
210
249
 
211
250
  ## Atomic writes
212
251
 
213
- **Set lead labels**, **Set project labels** and **Set run labels** have an `atomic`
214
- argument. In the workflow editor, it is the **Atomic** checkbox. When it is `true`, the node
252
+ **Set lead labels**, **Set project labels**, **Set organization labels** and **Set run labels**
253
+ have an `atomic` argument. In the workflow editor, it is the **Atomic** checkbox. When it is `true`, the node
215
254
  takes all of its labels or none of them. If one conditional row does not take its label, the
216
255
  node sets no label, records no operation, and gives a `count` of 0.
217
256
 
@@ -235,8 +274,8 @@ When Picked starts a node again after it added its amount, the node adds the amo
235
274
 
236
275
  ## A row that removes a label
237
276
 
238
- The `labels` argument of **Remove lead labels**, **Remove project labels** and **Remove run
239
- labels** is a list of rows. Each row removes one label.
277
+ The `labels` argument of **Remove lead labels**, **Remove project labels**, **Remove
278
+ organization labels** and **Remove run labels** is a list of rows. Each row removes one label.
240
279
 
241
280
  | Field | Type | Default | Description |
242
281
  | ----------- | ---- | --------- | ------------------------------------------------------------------------------------------------- |
@@ -295,7 +334,7 @@ only while the run holds it:
295
334
 
296
335
  This **Set project labels** node holds a label for the visitor of the run for one hour,
297
336
  unless a different run holds it. The key is the `sha256` hash of the Picked ID, and the label
298
- expires. Refer to [the rule for visitor data](#visitor-data-in-project-and-run-labels).
337
+ expires. Refer to [the rule for visitor data](#visitor-data-in-project-run-and-organization-labels).
299
338
 
300
339
  ```json
301
340
  {
@@ -15,23 +15,26 @@ in short form.
15
15
 
16
16
  ## Tools
17
17
 
18
- | Tool | Name in the editor | What it does | Output |
19
- | ----------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
20
- | `workflow_noop` | **Log a message** | Records the text in its `message` argument on the node. | `message` |
21
- | `search_leads` | **Search leads** | Finds the leads that match a query in the leads query language, the newest lead first. It finds 20 or fewer. | `leads` |
22
- | `get_lead` | **Get lead** | Reads the lead of the visitor whose action started the run. `exists` is `false` when the visitor has no lead. | `lead` and `exists` |
23
- | `create_lead` | **Create lead** | Creates a lead for the visitor, and sets the labels in its `labels` argument on it. | `lead`, `created` and `labelCount` |
24
- | `upsert_lead` | **Create or update lead** | Updates the lead of the visitor with the responses of the action. If the lead is too old, it creates a lead. | `lead`, `created`, `updated`, `changedKeys` and `labelCount` |
25
- | `set_lead_labels` | **Set lead labels** | Adds labels to the lead in its `lead` argument, or changes them. | `lead` and `count` |
26
- | `remove_lead_labels` | **Remove lead labels** | Removes labels from the lead in its `lead` argument. | `lead` and `removed` |
27
- | `set_project_labels` | **Set project labels** | Adds labels to the project of the run, or changes them. | `project` and `count` |
28
- | `remove_project_labels` | **Remove project labels** | Removes labels from the project of the run. | `project` and `removed` |
29
- | `get_project` | **Get project** | Reads the project of the run and its labels. | `project` |
30
- | `set_run_labels` | **Set run labels** | Adds labels to the run, or changes them. | `run` and `count` |
31
- | `remove_run_labels` | **Remove run labels** | Removes labels from the run. | `run` and `removed` |
32
- | `get_run` | **Get run** | Reads the run and its labels. | `run` |
33
- | `http` | **External API** | Sends a request to an external API that the project registered. The registration holds the credential. | `status`, `ok`, `body`, `bodyTruncated` and `durationMs` |
34
- | `action_response` | **Action response** | Sends the payload in its `payload` argument to the visitor who started the action in its `actionId` argument. | `actionId` and `recorded` |
18
+ | Tool | Name in the editor | What it does | Output |
19
+ | ---------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
20
+ | `workflow_noop` | **Log a message** | Records the text in its `message` argument on the node. | `message` |
21
+ | `search_leads` | **Search leads** | Finds the leads that match a query in the leads query language, the newest lead first. It finds 20 or fewer. | `leads` |
22
+ | `get_lead` | **Get lead** | Reads the lead of the visitor whose action started the run. `exists` is `false` when the visitor has no lead. | `lead` and `exists` |
23
+ | `create_lead` | **Create lead** | Creates a lead for the visitor, and sets the labels in its `labels` argument on it. | `lead`, `created` and `labelCount` |
24
+ | `upsert_lead` | **Create or update lead** | Updates the lead of the visitor with the responses of the action. If the lead is too old, it creates a lead. | `lead`, `created`, `updated`, `changedKeys` and `labelCount` |
25
+ | `set_lead_labels` | **Set lead labels** | Adds labels to the lead in its `lead` argument, or changes them. | `lead` and `count` |
26
+ | `remove_lead_labels` | **Remove lead labels** | Removes labels from the lead in its `lead` argument. | `lead` and `removed` |
27
+ | `set_project_labels` | **Set project labels** | Adds labels to the project of the run, or changes them. | `project` and `count` |
28
+ | `remove_project_labels` | **Remove project labels** | Removes labels from the project of the run. | `project` and `removed` |
29
+ | `get_project` | **Get project** | Reads the project of the run and its labels. | `project` |
30
+ | `set_organization_labels` | **Set organization labels** | Adds labels to the organization of the run, or changes them. All the projects of the organization share them. | `organization` and `count` |
31
+ | `remove_organization_labels` | **Remove organization labels** | Removes labels from the organization of the run. | `organization` and `removed` |
32
+ | `get_organization` | **Get organization** | Reads the organization of the run and its labels. | `organization` |
33
+ | `set_run_labels` | **Set run labels** | Adds labels to the run, or changes them. | `run` and `count` |
34
+ | `remove_run_labels` | **Remove run labels** | Removes labels from the run. | `run` and `removed` |
35
+ | `get_run` | **Get run** | Reads the run and its labels. | `run` |
36
+ | `http` | **External API** | Sends a request to an external API that the project registered. The registration holds the credential. | `status`, `ok`, `body`, `bodyTruncated` and `durationMs` |
37
+ | `action_response` | **Action response** | Sends the payload in its `payload` argument to the visitor who started the action in its `actionId` argument. | `actionId` and `recorded` |
35
38
 
36
39
  ## Create or update lead
37
40
 
@@ -49,6 +49,7 @@ operation, or MFA. They match the `AuthErrorCode` enum in the schema.
49
49
  | `EMAIL_NOT_CONFIRMED` | The account is there, but nobody verified the email address. See [Authentication](/reference/management-api/authentication#the-mutations). |
50
50
  | `USER_NOT_FOUND` | There is no account with that email address. |
51
51
  | `USER_ALREADY_EXISTS` | An account with that email address is there already. The API returns this when you create an account. |
52
+ | `SIGNUP_DISABLED` | Picked does not accept a new account for this request. The `accountCreate` mutation does not return this code: it gives the same result for each email address. |
52
53
  | `WEAK_PASSWORD` | The password is not strong enough. |
53
54
  | `INVALID_TOKEN` | The token is invalid or malformed. This covers a verification token, a reset token, and a magic link token. |
54
55
  | `TOKEN_EXPIRED` | The token expired. Ask for a new one. |
@@ -46,7 +46,7 @@ answers `EMAIL_CODE`. Never creates an account. Returns `RATE_LIMITED` past 10 r
46
46
  from one IP address, or when the project's email quota is spent.
47
47
 
48
48
  ```graphql
49
- sessionStart(input: SessionStartInput!): SessionStartPayload!
49
+ sessionStart(input: SessionStartInput!): SessionStartPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
50
50
  ```
51
51
 
52
52
  ### `sessionCreate`
@@ -54,7 +54,7 @@ sessionStart(input: SessionStartInput!): SessionStartPayload!
54
54
  Signs in with an email address and password and returns an `AAL1` session.
55
55
 
56
56
  ```graphql
57
- sessionCreate(input: SessionCreateInput!): SessionCreatePayload!
57
+ sessionCreate(input: SessionCreateInput!): SessionCreatePayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
58
58
  ```
59
59
 
60
60
  ### `sessionRefresh`
@@ -62,7 +62,7 @@ sessionCreate(input: SessionCreateInput!): SessionCreatePayload!
62
62
  Exchanges a refresh token for a new session.
63
63
 
64
64
  ```graphql
65
- sessionRefresh(input: SessionRefreshInput!): SessionRefreshPayload!
65
+ sessionRefresh(input: SessionRefreshInput!): SessionRefreshPayload! @rateLimit(rule: "session-refresh-ip", key: IP)
66
66
  ```
67
67
 
68
68
  ### `accountCreate`
@@ -72,7 +72,7 @@ reveal whether the address has an account. Returns `RATE_LIMITED` when the proje
72
72
  is spent.
73
73
 
74
74
  ```graphql
75
- accountCreate(input: AccountCreateInput!): AccountCreatePayload!
75
+ accountCreate(input: AccountCreateInput!): AccountCreatePayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
76
76
  ```
77
77
 
78
78
  ### `accountVerifyEmail`
@@ -80,7 +80,7 @@ accountCreate(input: AccountCreateInput!): AccountCreatePayload!
80
80
  Verifies the six-digit code from a confirmation or sign-in email and creates a session.
81
81
 
82
82
  ```graphql
83
- accountVerifyEmail(input: AccountVerifyEmailInput!): AccountVerifyEmailPayload!
83
+ accountVerifyEmail(input: AccountVerifyEmailInput!): AccountVerifyEmailPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
84
84
  ```
85
85
 
86
86
  ### `accountResendVerification`
@@ -90,7 +90,7 @@ account. An address with no account returns an error, so the response reveals wh
90
90
  exists. An address emailed within the minimum send interval returns `RATE_LIMITED`.
91
91
 
92
92
  ```graphql
93
- accountResendVerification(input: AccountResendVerificationInput!): AccountResendVerificationPayload!
93
+ accountResendVerification(input: AccountResendVerificationInput!): AccountResendVerificationPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
94
94
  ```
95
95
 
96
96
  ### `oauthAuthorize`
@@ -98,7 +98,7 @@ accountResendVerification(input: AccountResendVerificationInput!): AccountResend
98
98
  Creates the provider URL that starts a sign-in with an OAuth provider.
99
99
 
100
100
  ```graphql
101
- oauthAuthorize(input: OAuthAuthorizeInput!): OAuthAuthorizePayload!
101
+ oauthAuthorize(input: OAuthAuthorizeInput!): OAuthAuthorizePayload! @rateLimit(rule: "sign-in-ip", key: IP)
102
102
  ```
103
103
 
104
104
  ### `oauthCallback`
@@ -106,7 +106,7 @@ oauthAuthorize(input: OAuthAuthorizeInput!): OAuthAuthorizePayload!
106
106
  Exchanges the authorisation code from an OAuth provider's redirect for a session.
107
107
 
108
108
  ```graphql
109
- oauthCallback(input: OAuthCallbackInput!): OAuthCallbackPayload!
109
+ oauthCallback(input: OAuthCallbackInput!): OAuthCallbackPayload! @rateLimit(rule: "sign-in-ip", key: IP)
110
110
  ```
111
111
 
112
112
  ### `oauthConsentApprove`
@@ -131,7 +131,7 @@ Emails an existing account a sign-in code and link. Never creates an account, an
131
131
  `success: true` for an address with no account.
132
132
 
133
133
  ```graphql
134
- magicLinkSend(input: MagicLinkSendInput!): MagicLinkSendPayload!
134
+ magicLinkSend(input: MagicLinkSendInput!): MagicLinkSendPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
135
135
  ```
136
136
 
137
137
  ### `magicLinkVerify`
@@ -139,7 +139,7 @@ magicLinkSend(input: MagicLinkSendInput!): MagicLinkSendPayload!
139
139
  Verifies the six-digit code from a sign-in or confirmation email and creates a session.
140
140
 
141
141
  ```graphql
142
- magicLinkVerify(input: MagicLinkVerifyInput!): MagicLinkVerifyPayload!
142
+ magicLinkVerify(input: MagicLinkVerifyInput!): MagicLinkVerifyPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
143
143
  ```
144
144
 
145
145
  ### `emailLinkVerify`
@@ -149,7 +149,7 @@ session. The link works once: call this when the recipient confirms, never on op
149
149
  which an email security scanner may do before delivery.
150
150
 
151
151
  ```graphql
152
- emailLinkVerify(input: EmailLinkVerifyInput!): EmailLinkVerifyPayload!
152
+ emailLinkVerify(input: EmailLinkVerifyInput!): EmailLinkVerifyPayload! @rateLimit(rule: "sign-in-ip", key: IP)
153
153
  ```
154
154
 
155
155
  ### `passwordResetSend`
@@ -158,7 +158,7 @@ Sends a password-reset email. Returns `RATE_LIMITED` when the address was emaile
158
158
  minimum send interval or the project's email quota is spent.
159
159
 
160
160
  ```graphql
161
- passwordResetSend(input: PasswordResetSendInput!): PasswordResetSendPayload!
161
+ passwordResetSend(input: PasswordResetSendInput!): PasswordResetSendPayload! @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "sign-in-email", key: EMAIL)
162
162
  ```
163
163
 
164
164
  ### `passwordUpdate`
@@ -168,7 +168,7 @@ sessions and keeps the caller's. An `AAL1` session may set a password only while
168
168
  no verified factor, and otherwise gets `MFA_REQUIRED`.
169
169
 
170
170
  ```graphql
171
- passwordUpdate(input: PasswordUpdateInput!): PasswordUpdatePayload! @auth(mfa: EXEMPT)
171
+ passwordUpdate(input: PasswordUpdateInput!): PasswordUpdatePayload! @auth(mfa: EXEMPT) @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "mfa-user", key: USER)
172
172
  ```
173
173
 
174
174
  ### `mfaFactorEnroll`
@@ -178,7 +178,7 @@ caller's unverified factors, except the two newest enrolled in the last minute;
178
178
  given `friendlyName` is deleted however new.
179
179
 
180
180
  ```graphql
181
- mfaFactorEnroll(input: MfaFactorEnrollInput!): MfaFactorEnrollPayload! @auth(only: USER, mfa: EXEMPT)
181
+ mfaFactorEnroll(input: MfaFactorEnrollInput!): MfaFactorEnrollPayload! @auth(only: USER, mfa: EXEMPT) @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "mfa-user", key: USER)
182
182
  ```
183
183
 
184
184
  ### `mfaChallengeCreate`
@@ -186,7 +186,7 @@ mfaFactorEnroll(input: MfaFactorEnrollInput!): MfaFactorEnrollPayload! @auth(onl
186
186
  Opens a challenge against one of the caller's factors.
187
187
 
188
188
  ```graphql
189
- mfaChallengeCreate(input: MfaChallengeCreateInput!): MfaChallengeCreatePayload! @auth(only: USER, mfa: EXEMPT)
189
+ mfaChallengeCreate(input: MfaChallengeCreateInput!): MfaChallengeCreatePayload! @auth(only: USER, mfa: EXEMPT) @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "mfa-user", key: USER)
190
190
  ```
191
191
 
192
192
  ### `mfaChallengeVerify`
@@ -196,7 +196,7 @@ The user's other sessions keep their level. A wrong code returns `MFA_CHALLENGE_
196
196
  expired challenge `TOKEN_EXPIRED`.
197
197
 
198
198
  ```graphql
199
- mfaChallengeVerify(input: MfaChallengeVerifyInput!): MfaChallengeVerifyPayload! @auth(only: USER, mfa: EXEMPT)
199
+ mfaChallengeVerify(input: MfaChallengeVerifyInput!): MfaChallengeVerifyPayload! @auth(only: USER, mfa: EXEMPT) @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "mfa-user", key: USER)
200
200
  ```
201
201
 
202
202
  ### `mfaFactorUnenroll`
@@ -206,7 +206,7 @@ otherwise returns `MFA_REQUIRED`. A user the MFA policy requires cannot remove t
206
206
  factor (`VALIDATION_ERROR`).
207
207
 
208
208
  ```graphql
209
- mfaFactorUnenroll(input: MfaFactorUnenrollInput!): MfaFactorUnenrollPayload! @auth(only: USER, mfa: EXEMPT)
209
+ mfaFactorUnenroll(input: MfaFactorUnenrollInput!): MfaFactorUnenrollPayload! @auth(only: USER, mfa: EXEMPT) @rateLimit(rule: "sign-in-ip", key: IP) @rateLimit(rule: "mfa-user", key: USER)
210
210
  ```
211
211
 
212
212
  ## Types
@@ -227,6 +227,8 @@ enum AuthErrorCode {
227
227
  USER_NOT_FOUND
228
228
  """A user with the email address already exists."""
229
229
  USER_ALREADY_EXISTS
230
+ """Sign-up refused to create a new user."""
231
+ SIGNUP_DISABLED
230
232
  """The password does not meet the strength rules."""
231
233
  WEAK_PASSWORD
232
234
  """The token or code is invalid."""
@@ -111,6 +111,30 @@ or in which an `@auth` field ran, gets no header.
111
111
  directive @cache(policy: String!) on FIELD_DEFINITION
112
112
  ```
113
113
 
114
+ ### `rateLimit`
115
+
116
+ ```graphql
117
+ """
118
+ Refuses the field with `RATE_LIMITED` once the caller is past the limit of the rate-limit rule
119
+ named `rule`. A field may carry several; it resolves only when the caller is within every limit.
120
+ """
121
+ directive @rateLimit(rule: String!, key: RateLimitKey!) repeatable on FIELD_DEFINITION
122
+ ```
123
+
124
+ ### `RateLimitKey`
125
+
126
+ ```graphql
127
+ """The bucket a `@rateLimit` check counts against."""
128
+ enum RateLimitKey {
129
+ """The client IP address."""
130
+ IP
131
+ """The input email address."""
132
+ EMAIL
133
+ """The signed-in user."""
134
+ USER
135
+ }
136
+ ```
137
+
114
138
  ### `Scope`
115
139
 
116
140
  ```graphql
@@ -115,8 +115,8 @@ An operation with `@auth` needs a caller that has authenticated. `@auth(only: US
115
115
  | [`integrationInstall`](/reference/management-api/schema/integration#integrationinstall) | Mutation | Installs an integration for a project. A project that already has an integration of that type gets a `CONFLICT` error. Scope: `ORGANIZATION_INTEGRATIONS_CREATE` and `ORGANIZATION_PROJECTS_READ`. |
116
116
  | [`integrationUninstall`](/reference/management-api/schema/integration#integrationuninstall) | Mutation | Uninstalls an integration and deletes its configuration. Scope: `ORGANIZATION_INTEGRATIONS_DELETE`. |
117
117
  | [`labeledAppInstallations`](/reference/management-api/schema/app#labeledappinstallations) | Query | Lists the installations of an app that hold a label with the value, oldest first, up to 200 of them. Covers only projects where the user holds the scope; a secret label never matches. Scope: `ORGANIZATION_APPS_READ`. |
118
- | [`labelsDelete`](/reference/management-api/schema/label#labelsdelete) | Mutation | Deletes labels from a lead, a project or a workflow run. Deleting a label that is not set succeeds. A `LEAD` owner needs `ORGANIZATION_LEADS_UPDATE`; the other owners need `ORGANIZATION_PROJECTS_UPDATE`. Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`. |
119
- | [`labelsSet`](/reference/management-api/schema/label#labelsset) | Mutation | Creates or replaces labels on a lead, a project or a workflow run. Labels the call does not name are unchanged. A `LEAD` owner needs `ORGANIZATION_LEADS_UPDATE`; the other owners need `ORGANIZATION_PROJECTS_UPDATE`. Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`. |
118
+ | [`labelsDelete`](/reference/management-api/schema/label#labelsdelete) | Mutation | Deletes labels from an owner. Deleting a label that is not set succeeds. Each owner type needs the write scope `LabelOwnerType` lists for it. Scope: `ORGANIZATION_LEADS_UPDATE`, `ORGANIZATION_PROJECTS_UPDATE`, `ORGANIZATION_APPS_UPDATE` or `ORGANIZATION_UPDATE`. |
119
+ | [`labelsSet`](/reference/management-api/schema/label#labelsset) | Mutation | Creates or replaces labels on an owner. Labels the call does not name are unchanged. Each owner type needs the write scope `LabelOwnerType` lists for it. Scope: `ORGANIZATION_LEADS_UPDATE`, `ORGANIZATION_PROJECTS_UPDATE`, `ORGANIZATION_APPS_UPDATE` or `ORGANIZATION_UPDATE`. |
120
120
  | [`lead`](/reference/management-api/schema/lead#lead) | Query | Reads a lead. Scope: `ORGANIZATION_LEADS_READ`. |
121
121
  | [`leadCreate`](/reference/management-api/schema/lead#leadcreate) | Mutation | Creates a lead and sets its labels, then starts the workflows triggered by `lead.created`. Answers that do not match their fields return `userErrors` and nothing is written. `ORGANIZATION_LEADS_UPDATE` is required only with `labels`. Scope: `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE`. |
122
122
  | [`leadDelete`](/reference/management-api/schema/lead#leaddelete) | Mutation | Deletes a lead and its labels. This cannot be undone. Scope: `ORGANIZATION_LEADS_DELETE`. |
@@ -130,7 +130,7 @@ An operation with `@auth` needs a caller that has authenticated. `@auth(only: US
130
130
  | [`mcpServerDelete`](/reference/management-api/schema/mcp-server#mcpserverdelete) | Mutation | Deletes an MCP server with its stored URL and auth header. Cannot be undone; an unknown ID returns `NOT_FOUND`. Scope: `ORGANIZATION_INTEGRATIONS_DELETE`. |
131
131
  | [`mcpServerRegister`](/reference/management-api/schema/mcp-server#mcpserverregister) | Mutation | Registers a third-party MCP server to a project. Scope: `ORGANIZATION_INTEGRATIONS_CREATE`. |
132
132
  | [`mcpServerUpdate`](/reference/management-api/schema/mcp-server#mcpserverupdate) | Mutation | Renames an MCP server. Scope: `ORGANIZATION_INTEGRATIONS_UPDATE`. |
133
- | [`mcpServerUrlSet`](/reference/management-api/schema/mcp-server#mcpserverurlset) | Mutation | Replaces an MCP server's URL. The result shows only `urlDisplay`. Scope: `ORGANIZATION_INTEGRATIONS_UPDATE`. |
133
+ | [`mcpServerUrlSet`](/reference/management-api/schema/mcp-server#mcpserverurlset) | Mutation | Replaces an MCP server's URL. Of the URL, the result shows only `urlDisplay`. A URL on another origin (scheme, host and port) removes the auth header unless `authHeader` supplies one; `hasAuthHeaderValue` in the result shows whether the server holds one. Scope: `ORGANIZATION_INTEGRATIONS_UPDATE`. |
134
134
  | [`mfaChallengeCreate`](/reference/management-api/schema/auth#mfachallengecreate) | Mutation | Opens a challenge against one of the caller's factors. |
135
135
  | [`mfaChallengeVerify`](/reference/management-api/schema/auth#mfachallengeverify) | Mutation | Verifies an authenticator code against a challenge and returns the caller's session at `AAL2`. The user's other sessions keep their level. A wrong code returns `MFA_CHALLENGE_FAILED`, and an expired challenge `TOKEN_EXPIRED`. |
136
136
  | [`mfaFactorEnroll`](/reference/management-api/schema/auth#mfafactorenroll) | Mutation | Enrols an authenticator app for the caller and returns its secret, once. First deletes the caller's unverified factors, except the two newest enrolled in the last minute; one holding the given `friendlyName` is deleted however new. |