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
{{ message }}
Repository navigation
Commit 1657a12
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .speakeasy/out.openapi.yaml
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -43974,7 +43974,7 @@ paths:
43974
43974
- 'API Keys'
43975
43975
x-speakeasy-name-override: 'get'
43976
43976
patch:
43977
-
description: 'Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).'
43977
+
description: "Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).\n\n<Warning>\nYou can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.\n</Warning>"
43978
43978
operationId: 'updateKeys'
43979
43979
parameters:
43980
43980
- description: 'The hash identifier of the API key to update'
@@ -44257,10 +44257,20 @@ paths:
44257
44257
'400':
44258
44258
content:
44259
44259
application/json:
44260
-
example:
44261
-
error:
44262
-
code: 400
44263
-
message: 'Invalid request parameters'
44260
+
examples:
44261
+
invalid_parameters:
44262
+
summary: 'Invalid request parameters'
44263
+
value:
44264
+
error:
44265
+
code: 400
44266
+
message: 'Invalid request parameters'
44267
+
no_update_fields:
44268
+
description: 'Returned when the body contains none of the accepted fields, for example `{"workspace_id": "..."}`. `workspace_id` can''t be changed through the API.'
44269
+
summary: 'No accepted fields in the request body'
44270
+
value:
44271
+
error:
44272
+
code: 400
44273
+
message: 'No update fields provided'
44264
44274
schema:
44265
44275
$ref: '#/components/schemas/BadRequestResponse'
44266
44276
description: 'Bad Request - Invalid request parameters or malformed input'
Copy file name to clipboardExpand all lines: docs/sdks/apikeys/README.mdx
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -273,7 +273,31 @@ with OpenRouter(
273
273
274
274
Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
275
275
276
-
### Example Usage
276
+
\<Warning>
277
+
You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
278
+
</Warning>
279
+
280
+
### Example Usage: invalid_parameters
281
+
282
+
```python
283
+
from openrouter import OpenRouter
284
+
import os
285
+
286
+
287
+
with OpenRouter(
288
+
http_referer="<value>",
289
+
x_open_router_title="<value>",
290
+
x_open_router_categories="<value>",
291
+
api_key=os.getenv("OPENROUTER_API_KEY", ""),
292
+
) as open_router:
293
+
294
+
res = open_router.api_keys.update(hash="f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943")
295
+
296
+
# Handle response
297
+
print(res)
298
+
299
+
```
300
+
### Example Usage: no_update_fields
277
301
278
302
```python
279
303
from openrouter import OpenRouter
@@ -287,7 +311,7 @@ with OpenRouter(
287
311
api_key=os.getenv("OPENROUTER_API_KEY", ""),
288
312
) as open_router:
289
313
290
-
res = open_router.api_keys.update(hash="f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943", disabled=False, include_byok_in_limit=True, limit=75, limit_reset="daily", name="Updated API Key Name")
314
+
res = open_router.api_keys.update(hash="f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943")
Copy file name to clipboardExpand all lines: src/openrouter/api_keys.py
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1428,6 +1428,10 @@ def update(
1428
1428
1429
1429
Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
1430
1430
1431
+
<Warning>
1432
+
You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
1433
+
</Warning>
1434
+
1431
1435
:param hash: The hash identifier of the API key to update
1432
1436
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1433
1437
This is used to track API usage per application.
@@ -1590,6 +1594,10 @@ async def update_async(
1590
1594
1591
1595
Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
1592
1596
1597
+
<Warning>
1598
+
You can't change `workspace_id` through the API. The request body accepts only the fields listed below, and unrecognized fields are ignored. To move a key to another workspace, use the OpenRouter dashboard. If the body contains none of the accepted fields, the request fails with `400` and the message `No update fields provided`.
1599
+
</Warning>
1600
+
1593
1601
:param hash: The hash identifier of the API key to update
1594
1602
:param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
0 commit comments