@picked/client 0.0.101-next.2 → 0.0.101

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.
Files changed (147) hide show
  1. package/README.md +34 -158
  2. package/dist/{api-BlRFU0Fi.js → api-BOKA2i46.js} +1 -1
  3. package/dist/{api-AaQeg3Ij.cjs → api-C5jUHF3A.cjs} +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/server/index.js +1 -1
  7. package/dist/esm/index.js +2 -2
  8. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  9. package/dist/esm/server/index.js +2 -2
  10. package/dist/{plugin-CVD2TnRC.cjs → plugin-BcB9ah7q.cjs} +1 -1
  11. package/dist/{plugin-DhznDG-h.js → plugin-COWxZiTa.js} +2 -2
  12. package/dist/{preview-unavailable-mW4Pj3Ph.js → preview-unavailable-BJjc3UNr.js} +1 -1
  13. package/dist/{preview-unavailable-xWLCr93y.cjs → preview-unavailable-CV1BonKA.cjs} +1 -1
  14. package/dist/{provider-COb_V-yq.js → provider-CszmtTg3.js} +1 -1
  15. package/dist/{provider-zag5m5GH.cjs → provider-daBChM0G.cjs} +1 -1
  16. package/package.json +5 -5
  17. package/dist/docs/_root.css +0 -101
  18. package/dist/docs/explanation/conditions-and-the-logic-engine.md +0 -94
  19. package/dist/docs/explanation/content-references.md +0 -99
  20. package/dist/docs/explanation/feature-flag-allocation.md +0 -218
  21. package/dist/docs/explanation/how-picked-works.md +0 -124
  22. package/dist/docs/explanation/how-pickedql-works.md +0 -76
  23. package/dist/docs/explanation/pages-and-flows.md +0 -64
  24. package/dist/docs/explanation/the-content-model.md +0 -87
  25. package/dist/docs/explanation/the-two-apis.md +0 -68
  26. package/dist/docs/explanation/why-server-side-rendering.md +0 -76
  27. package/dist/docs/explanation/workspaces-and-versions.md +0 -71
  28. package/dist/docs/how-to/add-a-step-field-or-action.md +0 -43
  29. package/dist/docs/how-to/analytics/index.md +0 -316
  30. package/dist/docs/how-to/archive-or-delete-a-workspace.md +0 -46
  31. package/dist/docs/how-to/authenticate-the-cli.md +0 -101
  32. package/dist/docs/how-to/authenticate-with-a-magic-link.md +0 -47
  33. package/dist/docs/how-to/authenticate-with-a-password.md +0 -59
  34. package/dist/docs/how-to/authenticate-with-an-api-key.md +0 -51
  35. package/dist/docs/how-to/authenticate-with-oauth.md +0 -40
  36. package/dist/docs/how-to/build-a-flow.md +0 -93
  37. package/dist/docs/how-to/call-an-external-api-from-a-workflow.md +0 -102
  38. package/dist/docs/how-to/connect-the-mcp-server.md +0 -46
  39. package/dist/docs/how-to/create-a-content-entry.md +0 -48
  40. package/dist/docs/how-to/create-a-project.md +0 -29
  41. package/dist/docs/how-to/create-an-experience.md +0 -42
  42. package/dist/docs/how-to/create-and-revoke-an-api-key.md +0 -42
  43. package/dist/docs/how-to/debug-with-the-chrome-extension.md +0 -57
  44. package/dist/docs/how-to/define-a-page-layout.md +0 -46
  45. package/dist/docs/how-to/fill-and-publish-a-page.md +0 -66
  46. package/dist/docs/how-to/install-the-gtm-template.md +0 -84
  47. package/dist/docs/how-to/install-the-sdk.md +0 -93
  48. package/dist/docs/how-to/install-the-vite-plugin.md +0 -69
  49. package/dist/docs/how-to/invite-and-remove-members.md +0 -35
  50. package/dist/docs/how-to/point-one-entry-at-another.md +0 -61
  51. package/dist/docs/how-to/preview-a-workspace.md +0 -28
  52. package/dist/docs/how-to/publish-a-workspace.md +0 -30
  53. package/dist/docs/how-to/read-a-feature-flag.md +0 -113
  54. package/dist/docs/how-to/read-a-referenced-entry.md +0 -109
  55. package/dist/docs/how-to/register-a-component.md +0 -55
  56. package/dist/docs/how-to/register-an-action-handler.md +0 -85
  57. package/dist/docs/how-to/register-an-api-that-uses-oauth2.md +0 -107
  58. package/dist/docs/how-to/render-a-step-form.md +0 -131
  59. package/dist/docs/how-to/render-an-unpublished-preview.md +0 -41
  60. package/dist/docs/how-to/retry-a-failed-call-with-a-loop.md +0 -81
  61. package/dist/docs/how-to/reuse-a-section.md +0 -53
  62. package/dist/docs/how-to/reuse-a-step-field-or-action.md +0 -28
  63. package/dist/docs/how-to/roll-back-a-published-version.md +0 -26
  64. package/dist/docs/how-to/run-an-ab-test.md +0 -49
  65. package/dist/docs/how-to/run-code-on-a-form-submission.md +0 -125
  66. package/dist/docs/how-to/server-render-a-page.md +0 -81
  67. package/dist/docs/how-to/set-a-content-security-policy.md +0 -32
  68. package/dist/docs/how-to/set-up-mfa.md +0 -113
  69. package/dist/docs/how-to/switch-workspaces.md +0 -122
  70. package/dist/docs/how-to/upload-and-use-an-asset.mdx +0 -73
  71. package/dist/docs/how-to/validate-a-field.md +0 -52
  72. package/dist/docs/how-to/wait-for-an-action-response.md +0 -182
  73. package/dist/docs/how-to/write-a-condition.md +0 -45
  74. package/dist/docs/how-to/write-a-predicate.md +0 -60
  75. package/dist/docs/index.md +0 -59
  76. package/dist/docs/reference/dashboard/actions.mdx +0 -56
  77. package/dist/docs/reference/dashboard/api-keys.mdx +0 -38
  78. package/dist/docs/reference/dashboard/conditions.mdx +0 -42
  79. package/dist/docs/reference/dashboard/content/asset-library.mdx +0 -63
  80. package/dist/docs/reference/dashboard/content/blocks.mdx +0 -57
  81. package/dist/docs/reference/dashboard/content/content-entries.mdx +0 -95
  82. package/dist/docs/reference/dashboard/content/models.mdx +0 -108
  83. package/dist/docs/reference/dashboard/content/pages.mdx +0 -61
  84. package/dist/docs/reference/dashboard/experiences.mdx +0 -51
  85. package/dist/docs/reference/dashboard/external-apis.md +0 -169
  86. package/dist/docs/reference/dashboard/features.mdx +0 -154
  87. package/dist/docs/reference/dashboard/fields.mdx +0 -106
  88. package/dist/docs/reference/dashboard/flow-builder/canvas.mdx +0 -58
  89. package/dist/docs/reference/dashboard/flow-builder/condition-builder.md +0 -57
  90. package/dist/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +0 -72
  91. package/dist/docs/reference/dashboard/flow-builder/nodes.md +0 -63
  92. package/dist/docs/reference/dashboard/labels.md +0 -321
  93. package/dist/docs/reference/dashboard/lead-search.md +0 -224
  94. package/dist/docs/reference/dashboard/projects.mdx +0 -44
  95. package/dist/docs/reference/dashboard/reports.mdx +0 -43
  96. package/dist/docs/reference/dashboard/steps.mdx +0 -37
  97. package/dist/docs/reference/dashboard/team-management.md +0 -29
  98. package/dist/docs/reference/dashboard/workflow-runs.md +0 -142
  99. package/dist/docs/reference/dashboard/workflow-templates.md +0 -182
  100. package/dist/docs/reference/dashboard/workflow-test-runs.md +0 -77
  101. package/dist/docs/reference/dashboard/workspace-versioning.mdx +0 -30
  102. package/dist/docs/reference/dashboard/workspaces.mdx +0 -76
  103. package/dist/docs/reference/delivery-api/experience-content.md +0 -152
  104. package/dist/docs/reference/delivery-api/index.md +0 -45
  105. package/dist/docs/reference/delivery-api/preview-caching-crawling.md +0 -79
  106. package/dist/docs/reference/delivery-api/project-config.md +0 -65
  107. package/dist/docs/reference/delivery-api/workspace-schema.md +0 -107
  108. package/dist/docs/reference/glossary.md +0 -201
  109. package/dist/docs/reference/management-api/authentication.md +0 -87
  110. package/dist/docs/reference/management-api/authorization-and-scopes.md +0 -291
  111. package/dist/docs/reference/management-api/error-handling.md +0 -232
  112. package/dist/docs/reference/management-api/pagination.md +0 -192
  113. package/dist/docs/reference/pickedql/data-sources.md +0 -174
  114. package/dist/docs/reference/pickedql/dimensions.md +0 -103
  115. package/dist/docs/reference/pickedql/filtering.md +0 -64
  116. package/dist/docs/reference/pickedql/index.md +0 -18
  117. package/dist/docs/reference/pickedql/schema.md +0 -172
  118. package/dist/docs/reference/pickedql/virtual-functions.md +0 -248
  119. package/dist/docs/reference/sdk/actions.md +0 -154
  120. package/dist/docs/reference/sdk/analytics-events.md +0 -453
  121. package/dist/docs/reference/sdk/conditions.md +0 -147
  122. package/dist/docs/reference/sdk/content-security-policy.md +0 -21
  123. package/dist/docs/reference/sdk/content.md +0 -253
  124. package/dist/docs/reference/sdk/experiences.md +0 -51
  125. package/dist/docs/reference/sdk/features.md +0 -256
  126. package/dist/docs/reference/sdk/fields.md +0 -255
  127. package/dist/docs/reference/sdk/index.md +0 -68
  128. package/dist/docs/reference/sdk/plugins/create-experience.md +0 -123
  129. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +0 -74
  130. package/dist/docs/reference/sdk/plugins/index.md +0 -29
  131. package/dist/docs/reference/sdk/plugins/window-object.md +0 -25
  132. package/dist/docs/reference/sdk/predicates.md +0 -43
  133. package/dist/docs/reference/sdk/ssr/index.md +0 -33
  134. package/dist/docs/reference/sdk/ssr/rendering-and-hydration.md +0 -103
  135. package/dist/docs/reference/sdk/ssr/serialize.md +0 -80
  136. package/dist/docs/reference/sdk/ssr/slots-and-placements.md +0 -113
  137. package/dist/docs/reference/sdk/steps.md +0 -86
  138. package/dist/docs/reference/sdk/type-generation.md +0 -265
  139. package/dist/docs/reference/tools/chrome-extension.md +0 -16
  140. package/dist/docs/reference/tools/cli.md +0 -292
  141. package/dist/docs/reference/tools/image-optimisation-service.md +0 -104
  142. package/dist/docs/reference/tools/mcp.md +0 -136
  143. package/dist/docs/reference/tools/vite-plugin.md +0 -163
  144. package/dist/docs/tutorials/first-api-call.md +0 -235
  145. package/dist/docs/tutorials/first-experience-in-the-dashboard.mdx +0 -143
  146. package/dist/docs/tutorials/first-experience.mdx +0 -254
  147. package/dist/docs/tutorials/first-server-rendered-page.mdx +0 -186
@@ -1,316 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to run an analytics query
7
-
8
- This guide gives you a query for each common analytics question. Copy one, put your own
9
- project ID in the `WHERE` clause, and run it.
10
-
11
- Every query must carry a tenant filter. See
12
- [About PickedQL](/explanation/how-pickedql-works) for why, and
13
- [Data sources](/reference/pickedql/data-sources) for every table.
14
-
15
- ## Daily A/B test trend
16
-
17
- ```sql
18
- SELECT
19
- project_local_date,
20
- control_users() AS control,
21
- variant_users() AS variant
22
- FROM metrics
23
- WHERE project_id = '{{ your project ID }}'
24
- AND project_local_date >= '2026-04-01'
25
- GROUP BY project_local_date
26
- ORDER BY project_local_date
27
- ```
28
-
29
- **Result:**
30
-
31
- | project_local_date | control | variant |
32
- | ----------------- | ------- | ------- |
33
- | 2026-04-11 | 4361 | 101 |
34
- | 2026-04-12 | 4178 | 126 |
35
- | 2026-04-13 | 5008 | 176 |
36
-
37
- ## Conversion rate uplift by date
38
-
39
- ```sql
40
- SELECT
41
- project_local_date,
42
- control_conversion_rate() AS control_conversion_rate,
43
- variant_conversion_rate() AS variant_conversion_rate,
44
- conversion_rate_uplift() AS conversion_rate_uplift_pct
45
- FROM metrics
46
- WHERE project_id = '{{ your project ID }}'
47
- AND project_local_date >= '2026-04-01'
48
- GROUP BY project_local_date
49
- ORDER BY project_local_date
50
- ```
51
-
52
- **Result:**
53
-
54
- | project_local_date | control_conversion_rate | variant_conversion_rate | conversion_rate_uplift_pct |
55
- | ----------------- | ----------------------- | ----------------------- | -------------------------- |
56
- | 2026-04-01 | 0.0322 | 0.0349 | 0.0349 |
57
- | 2026-04-02 | 0.0398 | 0.0416 | 0.0416 |
58
- | 2026-04-03 | 0.0462 | 0 | -0.0001 |
59
-
60
- ## Custom conversion rate definition
61
-
62
- Override the default conversion, which counts a `purchase` event, with your own
63
- numerator and denominator. Use this when a form submission, a lead capture, or
64
- another event of your own defines a conversion.
65
-
66
- ```sql
67
- -- Lead capture conversion: form submissions / lead-capture step entries
68
- SELECT
69
- project_local_date,
70
- control_conversion_rate(
71
- numerator='event_type=form_submit_success',
72
- denominator='step_id=lead-capture-step'
73
- ) AS control_lead_cr,
74
- variant_conversion_rate(
75
- numerator='event_type=form_submit_success',
76
- denominator='step_id=lead-capture-step'
77
- ) AS variant_lead_cr
78
- FROM events
79
- WHERE project_id = '{{ your project ID }}'
80
- AND client_local_date >= '2026-04-01'
81
- GROUP BY project_local_date
82
- ORDER BY project_local_date
83
- ```
84
-
85
- You can also combine multiple events with `OR` and group with parentheses:
86
-
87
- ```sql
88
- -- A `checkout_complete` event or an `order_create` event counts as a conversion.
89
- SELECT
90
- control_conversion_rate(
91
- 'event_type=checkout_complete OR event_type=order_create'
92
- ) AS control_cr,
93
- variant_conversion_rate(
94
- 'event_type=checkout_complete OR event_type=order_create'
95
- ) AS variant_cr
96
- FROM events
97
- WHERE project_id = '{{ your project ID }}'
98
- ```
99
-
100
- ## Your own segment with `control_users` and `variant_users`
101
-
102
- On `events`, four functions take an optional filter string: `control_users`,
103
- `variant_users`, `control_sessions`, and `variant_sessions`. The filter counts only a
104
- user or a session that matches your expression. It applies together with the
105
- `variant_type` filter that PickedQL adds.
106
-
107
- ```sql
108
- -- The control users who fired an `app_initialize` event, by step.
109
- SELECT
110
- step_id,
111
- control_users('event_type=app_initialize') AS control_initialized,
112
- variant_users('event_type=app_initialize') AS variant_initialized
113
- FROM events
114
- WHERE project_id = '{{ your project ID }}'
115
- AND client_local_date >= '2026-04-01'
116
- GROUP BY step_id
117
- ORDER BY control_initialized DESC
118
- ```
119
-
120
- The named form (`filter=`) is also supported:
121
-
122
- ```sql
123
- SELECT control_users(filter='event_type=form_submit AND step_id=lead-capture') FROM events
124
- WHERE project_id = '{{ your project ID }}'
125
- ```
126
-
127
- ## Conversion rate from nested virtual functions
128
-
129
- The numerator and the denominator can come from different segments. An example is the
130
- control users who fired an event of your own, divided by **all** users and not by the
131
- control users alone. For that, pass a virtual function call directly as an argument
132
- of the conversion rate:
133
-
134
- ```sql
135
- -- The control users who fired `app_initialize`, over all users of every variant.
136
- SELECT
137
- control_conversion_rate(
138
- control_users('event_type=app_initialize'),
139
- all_users()
140
- ) AS control_initialize_rate
141
- FROM events
142
- WHERE project_id = '{{ your project ID }}'
143
- AND client_local_date >= '2026-04-01'
144
- ```
145
-
146
- ## A/B test by device
147
-
148
- ```sql
149
- SELECT
150
- device_category,
151
- control_users() AS control,
152
- variant_users() AS variant
153
- FROM metrics
154
- WHERE project_id = '{{ your project ID }}'
155
- GROUP BY device_category
156
- ```
157
-
158
- **Result:**
159
-
160
- | device_category | control | variant |
161
- | --------------- | ------- | ------- |
162
- | Phone | 193430 | 1723 |
163
- | Desktop | 23423 | 309 |
164
- | Tablet | 13294 | 65 |
165
-
166
- ## Daily A/B test trend by device
167
-
168
- Combine date and device dimensions to spot device-specific trends:
169
-
170
- ```sql
171
- SELECT
172
- project_local_date,
173
- device_category,
174
- control_users() AS control,
175
- variant_users() AS variant
176
- FROM metrics
177
- WHERE project_id = '{{ your project ID }}'
178
- AND project_local_date >= '2026-04-01'
179
- GROUP BY project_local_date, device_category
180
- ORDER BY project_local_date, device_category
181
- ```
182
-
183
- **Result:**
184
-
185
- | project_local_date | device_category | control | variant |
186
- | ----------------- | --------------- | ------- | ------- |
187
- | 2026-04-13 | Tablet | 175 | 2 |
188
- | 2026-04-14 | Desktop | 37 | 1 |
189
- | 2026-04-14 | Phone | 244 | 1 |
190
-
191
- ## Purchase by UTM source
192
-
193
- ```sql
194
- SELECT
195
- utm_source,
196
- all_users() AS users,
197
- all_purchase_users() AS purchasers
198
- FROM metrics
199
- WHERE project_id = '{{ your project ID }}'
200
- GROUP BY utm_source
201
- ```
202
-
203
- **Result:**
204
-
205
- | utm_source | users | purchasers |
206
- | ---------- | ------ | ---------- |
207
- | `meta` | 12031 | 101 |
208
- | `fb` | 3656 | 31 |
209
- | `an` | 100366 | 299 |
210
-
211
- ## Step funnel for variant users
212
-
213
- Count unique variant users per step to understand the conversion funnel:
214
-
215
- ```sql
216
- SELECT
217
- step_id,
218
- variant_users() AS variant
219
- FROM metrics
220
- WHERE project_id = '{{ your project ID }}'
221
- AND project_local_date >= '2026-04-01'
222
- GROUP BY step_id
223
- ORDER BY variant DESC
224
- ```
225
-
226
- **Result:**
227
-
228
- | step_id | variant |
229
- | ------------------------------ | ------- |
230
- | `who-are-you-protecting-step` | 1093 |
231
- | `about-yourself-step` | 533 |
232
- | `date-of-birth-step` | 435 |
233
- | `employment-status-step` | 408 |
234
- | `nicotine-usage-step` | 407 |
235
- | `coverage-motivation-step` | 405 |
236
- | `lead-capture-step` | 398 |
237
-
238
-
239
- ## Sankey — overall user journey
240
-
241
- A forward window from the starting step. A user who never reaches `targeting_step`
242
- still gives edges, up to `num_nodes_after_start`.
243
-
244
- ```sql
245
- SELECT source, target, users FROM experience_journey
246
- WHERE project_id = '{{ your project ID }}'
247
- AND starting_step = '{{ starting step ID }}'
248
- AND targeting_step = '{{ target step ID }}'
249
- AND num_nodes_after_start = 10
250
- ```
251
-
252
- **Result:**
253
-
254
- | source | target | users |
255
- | ------------------------- | ------------------------- | ----- |
256
- | `001. step-start` | `002. step-questionnaire-1` | 182 |
257
- | `002. step-questionnaire-1` | `003. step-quote` | 144 |
258
- | `003. step-quote` | `004. step-target` | 121 |
259
-
260
- ## Sankey — the top paths to a target step
261
-
262
- A backward window anchored at the target. It also ranks the paths and keeps the ones
263
- with the most users.
264
-
265
- ```sql
266
- SELECT source, target, users FROM experience_journey
267
- WHERE project_id = '{{ your project ID }}'
268
- AND experience_id = '{{ experience ID }}'
269
- AND starting_step = '{{ starting step ID }}'
270
- AND targeting_step = '{{ target step ID }}'
271
- AND num_nodes_before_target = 5
272
- AND top_n_path = 10
273
- ```
274
-
275
- ## Sankey — drop-off view
276
-
277
- Starts at `starting_step` and emits every consecutive transition until `num_nodes_after_start` steps later (no target).
278
-
279
- ```sql
280
- SELECT source, target, users FROM experience_journey
281
- WHERE project_id = '{{ your project ID }}'
282
- AND experience_id = '{{ experience ID }}'
283
- AND starting_step = '{{ starting step ID }}'
284
- AND num_nodes_after_start = 10
285
- ```
286
-
287
- ## List all control users for mobile (user-level)
288
-
289
- Use `events` when you need data at the individual user level:
290
-
291
- ```sql
292
- SELECT
293
- device_category,
294
- user_canonical_id
295
- FROM events
296
- WHERE project_id = '{{ your project ID }}'
297
- AND device_category = 'Mobile'
298
- AND variant_type = 'Control'
299
- ```
300
-
301
- **Result:**
302
-
303
- | device_category | user_canonical_id |
304
- | --------------- | ------------------------------------ |
305
- | Mobile | `019cc336-5a6a-7c32-b638-cdcc983b3e70` |
306
- | Mobile | `019cc336-5a6a-7d8f-994c-69bc28e5f550` |
307
- | Mobile | `019cc80f-503c-7181-b2c6-986b1f76d496` |
308
-
309
- ## Related
310
-
311
- - [About PickedQL](/explanation/how-pickedql-works) — what the layer expands for you.
312
- - [Virtual functions](/reference/pickedql/virtual-functions) — every function.
313
- - [Dimensions](/reference/pickedql/dimensions) — every dimension column.
314
- - [Analytics events](/reference/sdk/analytics-events) — every `event_type` value that a
315
- filter can use.
316
- - [Reports](/reference/dashboard/reports) — the same data as an embedded dashboard.
@@ -1,46 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to archive or delete a workspace
7
-
8
- This guide shows you how to take a draft workspace out of use. Archive it when you want
9
- to keep it. Delete it only when you are certain, because you cannot reverse a delete.
10
-
11
- You cannot archive or delete a live workspace. Make a different workspace live first.
12
-
13
- ## Archive a workspace
14
-
15
- 1. Open the workspace settings page.
16
- 2. Click **Archive workspace** in the page header.
17
- 3. Confirm in the modal.
18
-
19
- The workspace leaves the default list. It stays editable.
20
-
21
- ## Unarchive a workspace
22
-
23
- 1. Open the workspace settings page.
24
- 2. Click **Unarchive workspace** in the page header.
25
-
26
- ## Delete a workspace
27
-
28
- 1. Open the workspace settings page.
29
- 2. Click **Delete workspace**.
30
- 3. Confirm in the modal.
31
-
32
- Picked removes the workspace, and everything in it, permanently.
33
-
34
- ## Rename a workspace
35
-
36
- 1. Open the workspace settings page.
37
- 2. Change the **Workspace name** field.
38
- 3. Click **Save changes**.
39
-
40
- A name is unique inside a project. The dashboard rejects a duplicate name.
41
-
42
- ## Related
43
-
44
- - [About workspaces and versions](/explanation/workspaces-and-versions) — why Picked keeps
45
- these two operations separate.
46
- - [Workspaces](/reference/dashboard/workspaces) — the settings reference.
@@ -1,101 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to authenticate the CLI
7
-
8
- This guide shows you how to install the `picked` command and sign it in. Commands that read
9
- your organizations, projects, and workspaces then know who you are. It expects a Picked
10
- account and a project directory to work in.
11
-
12
- ## 1. Install the CLI
13
-
14
- :::code-group
15
-
16
- ```bash [npm]
17
- npm install picked
18
- ```
19
-
20
- ```bash [pnpm]
21
- pnpm add picked
22
- ```
23
-
24
- ```bash [yarn]
25
- yarn add picked
26
- ```
27
-
28
- :::
29
-
30
- The binary is `picked`. Run it from the directory that holds your `picked.config.ts`, so it
31
- reads your configuration and writes your selection next to it.
32
-
33
- ## 2. Sign in
34
-
35
- ```bash
36
- picked login
37
- ```
38
-
39
- The command opens your browser for a one-time sign-in and prints your identity:
40
-
41
- ```
42
- Opening your browser to sign in...
43
- https://api.picked.app/…/oauth/authorize?…
44
- Logged in as you@example.com (https://api.picked.app)
45
- ```
46
-
47
- If your account must use MFA, the browser asks for the code from your authenticator app
48
- before it signs the CLI in. Picked staff, and members of an organization that requires
49
- MFA, must use it.
50
-
51
- The CLI stores the session in `~/.picked/auth/<origin>.json`. It refreshes the session as it nears expiry.
52
-
53
- ## 3. Confirm the session
54
-
55
- ```bash
56
- picked whoami
57
- ```
58
-
59
- ```
60
- you@example.com (https://api.picked.app)
61
- ```
62
-
63
- Each command acts on the API origin your current directory resolves to, and on no other. To
64
- end the session for that origin:
65
-
66
- ```bash
67
- picked logout
68
- ```
69
-
70
- ```
71
- Logged out of https://api.picked.app.
72
- ```
73
-
74
- ## Run the CLI in CI
75
-
76
- `picked generate types` reads the workspace schema, not your account, so CI needs no
77
- session for it. A workspace you read with `source: 'preview'` needs that workspace's token.
78
- Run `picked workspace use` once on your machine, then give CI the two values it wrote:
79
-
80
- ```bash
81
- PICKED_PROJECT_ID=your-project-id \
82
- PICKED_PREVIEW_TOKEN=$YOUR_CI_SECRET \
83
- picked generate types --check
84
- ```
85
-
86
- `picked workspace list` and `picked workspace use` read your organizations and projects, so
87
- those two do need a session. Run them on your machine, where a browser can sign you in.
88
-
89
- :::note
90
- This is a developer session for local tooling. It is not the same as an
91
- [API key](/reference/dashboard/api-keys), which authenticates server-to-server delivery and
92
- management calls, or [dashboard sign-in](/reference/management-api/authentication). Use an
93
- API key for an application; use `picked login` for the CLI on your machine.
94
- :::
95
-
96
- ## Related
97
-
98
- - [CLI](/reference/tools/cli) — every command, flag, and environment variable.
99
- - [How to switch workspaces](/how-to/switch-workspaces) — the draft-preview workflow.
100
- - [How to create and revoke an API key](/how-to/create-and-revoke-an-api-key) — credentials
101
- for applications.
@@ -1,47 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to authenticate with a magic link
7
-
8
- This guide shows you how to sign a user in through an email address, with no password.
9
-
10
- ## 1. Send the email
11
-
12
- ```graphql
13
- mutation {
14
- magicLinkSend(input: {
15
- email: "user@example.com"
16
- redirectUrl: "https://app.example.com/auth/verify"
17
- }) {
18
- success
19
- }
20
- }
21
- ```
22
-
23
- The user receives an email with a six-digit code and a sign-in link. The mutation does not
24
- create an account. For an address with no account, it returns `success: true` and sends no
25
- email.
26
-
27
- If you send a second request for the same address soon after the first, the mutation
28
- returns `success: true` and sends no new email. The code in the first email stays valid.
29
-
30
- ## 2. Verify the code
31
-
32
- ```graphql
33
- mutation {
34
- magicLinkVerify(input: {
35
- email: "user@example.com"
36
- token: "123456"
37
- }) {
38
- session { accessToken refreshToken }
39
- }
40
- }
41
- ```
42
-
43
- Put the six-digit code from the email in `token`.
44
-
45
- ## Related
46
-
47
- - [Authentication](/reference/management-api/authentication) — every mutation.
@@ -1,59 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to authenticate with a password
7
-
8
- This guide shows you how to get an access token from an email address and a password.
9
-
10
- ## 1. Create a session
11
-
12
- ```graphql
13
- mutation {
14
- sessionCreate(input: {
15
- email: "user@example.com"
16
- password: "secure-password"
17
- }) {
18
- session {
19
- accessToken
20
- refreshToken
21
- expiresAt
22
- aal
23
- user {
24
- mfa { required enrolled }
25
- }
26
- }
27
- }
28
- }
29
- ```
30
-
31
- The session is at `AAL1`. When `user.mfa.required` is `true`, verify a code from an
32
- authenticator app before you call other operations. See
33
- [How to set up MFA](/how-to/set-up-mfa).
34
-
35
- ## 2. Send the token
36
-
37
- ```
38
- Authorization: Bearer <accessToken>
39
- ```
40
-
41
- ## 3. Refresh before it expires
42
-
43
- The `expiresAt` field gives the time at which the access token expires.
44
-
45
- ```graphql
46
- mutation {
47
- sessionRefresh(input: { refreshToken: "v1.refresh-token..." }) {
48
- session { accessToken refreshToken expiresAt }
49
- }
50
- }
51
- ```
52
-
53
- The API invalidates the earlier refresh token. This mutation needs no `Authorization`
54
- header.
55
-
56
- ## Related
57
-
58
- - [Authentication](/reference/management-api/authentication) — every mutation.
59
- - [Your first API call](/tutorials/first-api-call).
@@ -1,51 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to authenticate with an API key
7
-
8
- This guide shows you how to authenticate a server-to-server integration. An API key gives
9
- access for a long time, inside a set of scopes.
10
-
11
- ## 1. Create the key
12
-
13
- Only a user with a session can create a key. Another API key cannot.
14
-
15
- ```graphql
16
- mutation {
17
- apiKeyCreate(input: {
18
- organizationId: "org-id"
19
- name: "CI/CD Pipeline Key"
20
- projectId: "project-id"
21
- scopes: [ORGANIZATION_READ, ORGANIZATION_PROJECTS_READ]
22
- }) {
23
- apiKey
24
- }
25
- }
26
- ```
27
-
28
- The response holds the full key one time only. Keep it in a secure place.
29
-
30
- The scopes that you ask for must all be scopes of the user who creates the key.
31
-
32
- ## 2. Send the key
33
-
34
- ```
35
- x-api-key: pk_live_abc123...
36
- ```
37
-
38
- ## 3. Revoke the key
39
-
40
- ```graphql
41
- mutation {
42
- apiKeyRevoke(input: { keyId: "key-id", organizationId: "org-id" })
43
- }
44
- ```
45
-
46
- ## Related
47
-
48
- - [Authorization and scopes](/reference/management-api/authorization-and-scopes) — every
49
- scope.
50
- - [How to create and revoke an API key](/how-to/create-and-revoke-an-api-key) — the
51
- dashboard path.
@@ -1,40 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to authenticate with OAuth
7
-
8
- This guide shows you how to sign a user in through Google.
9
-
10
- ## 1. Get the authorization URL
11
-
12
- ```graphql
13
- mutation {
14
- oauthAuthorize(input: {
15
- provider: GOOGLE
16
- redirectUrl: "https://app.example.com/auth/callback"
17
- scopes: ["openid", "email", "profile"]
18
- }) {
19
- url
20
- }
21
- }
22
- ```
23
-
24
- ## 2. Send the user to that URL
25
-
26
- Google authenticates the user and sends them back with a `code` parameter.
27
-
28
- ## 3. Exchange the code
29
-
30
- ```graphql
31
- mutation {
32
- oauthCallback(input: { provider: GOOGLE, code: "auth-code-from-google" }) {
33
- session { accessToken refreshToken expiresAt }
34
- }
35
- }
36
- ```
37
-
38
- ## Related
39
-
40
- - [Authentication](/reference/management-api/authentication) — every mutation.