You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,7 +13,11 @@ import ApiTester from '@site/src/components/ApiTester';
13
13
14
14
Request a scoped API key
15
15
16
-
Initiates the device-flow key request. The response contains an `approvalUrl` the user must visit to review and approve the requested scopes. Poll `GET /auth/key-request/{code}/status` until `status` is `approved` or `denied`.
16
+
Initiates a key request that a user must approve in the dashboard. Supports two flows:
17
+
18
+
**Device flow (no `callbackUrl`)** — for CLI tools, scripts, and desktop apps. The response contains an `approvalUrl` to direct the user to. Poll `GET /auth/key-request/{code}/status` until `status` is `approved`, then read `apiKey` from the response.
19
+
20
+
**Web flow (`callbackUrl` provided)** — for web apps that can receive an HTTP redirect. After the user approves, the dashboard redirects to your `callbackUrl` with a `code` query parameter containing the exchange code. POST that code to `POST /auth/key-request/exchange` to retrieve the API key.
17
21
18
22
### Parameters
19
23
@@ -23,7 +27,7 @@ Initiates the device-flow key request. The response contains an `approvalUrl` th
23
27
| scopes | array | ✓ | body | List of permission scopes the key requires |
24
28
| appDescription | string || body | Short description of what the application does |
25
29
| appUrl | string || body | Homepage or docs URL for the application |
26
-
| callbackUrl | string || body | URL to redirect to after approval (web flow)|
30
+
| callbackUrl | string || body |Enables web flow: URL the dashboard redirects to after approval, with a `code` query parameter containing the exchange code|
27
31
| clientIds | array || body | Foundry client IDs to restrict the key to |
28
32
| suggestedMonthlyLimit | number || body | Suggested per-key monthly request cap (user may override) |
29
33
| suggestedExpiry | string || body | Suggested expiry date ISO 8601 (user may override) |
Returns the current status of a pending key request. When `status` is `approved`, the response includes the newly created `key`. Once the key has been retrieved, the code is invalidated.
201
+
Returns the current status of a pending key request. When `status` is `approved`, the response includes the newly created `apiKey`. Once the key has been retrieved, the status becomes `exchanged` and the key is no longer returned.
198
202
199
203
### Parameters
200
204
@@ -204,7 +208,7 @@ Returns the current status of a pending key request. When `status` is `approved`
Web flow only. After the user approves the request in the dashboard, the relay redirects to the `callbackUrl` with a one-time `code` query parameter. POST that code here to receive the API key. The code is single-use — a second call returns 410.
341
+
342
+
### Parameters
343
+
344
+
| Name | Type | Required | Source | Description |
345
+
|------|------|----------|--------|-------------|
346
+
| code | string | ✓ | body | The exchange code delivered to your callbackUrl |
0 commit comments