|
93 | 93 | - name: Workspaces > Members |
94 | 94 | description: Create and manage workspace members. |
95 | 95 | - name: Api-Keys |
96 | | - description: Create, List, Retrieve, Update, and Delete your Portkey Api keys. |
| 96 | + description: Create, List, Retrieve, Update, and Delete your Portkey API keys. |
97 | 97 | - name: Logs Export |
98 | 98 | description: Exports logs service. |
99 | 99 | - name: Audit Logs |
@@ -16355,7 +16355,9 @@ paths: |
16355 | 16355 | post: |
16356 | 16356 | tags: |
16357 | 16357 | - Api-Keys |
16358 | | - summary: Create Api Keys |
| 16358 | + summary: Create API Keys |
| 16359 | + description: | |
| 16360 | + Creates a new API key. |
16359 | 16361 | parameters: |
16360 | 16362 | - name: type |
16361 | 16363 | in: path |
@@ -16588,6 +16590,68 @@ paths: |
16588 | 16590 | ] |
16589 | 16591 | ) |
16590 | 16592 | print(api_key) |
| 16593 | + - lang: python |
| 16594 | + label: User API Key |
| 16595 | + source: | |
| 16596 | + from portkey_ai import Portkey |
| 16597 | + |
| 16598 | + # Initialize the Portkey client |
| 16599 | + portkey = Portkey( |
| 16600 | + api_key="PORTKEY_API_KEY", |
| 16601 | + ) |
| 16602 | + |
| 16603 | + # Create a user API key (requires user_id) |
| 16604 | + api_key = portkey.api_keys.create( |
| 16605 | + name="User API Key", |
| 16606 | + type="workspace", |
| 16607 | + sub_type="user", |
| 16608 | + workspace_id="WORKSPACE_ID", |
| 16609 | + user_id="USER_ID", # Required for user API keys |
| 16610 | + scopes=[ |
| 16611 | + "completions.write", |
| 16612 | + "logs.view" |
| 16613 | + ] |
| 16614 | + ) |
| 16615 | + |
| 16616 | + print(api_key) |
| 16617 | + - lang: javascript |
| 16618 | + label: User API Key |
| 16619 | + source: | |
| 16620 | + import { Portkey } from "portkey-ai"; |
| 16621 | + |
| 16622 | + const portkey = new Portkey({ |
| 16623 | + apiKey: "PORTKEY_API_KEY", |
| 16624 | + }) |
| 16625 | + |
| 16626 | + const apiKey = await portkey.apiKeys.create({ |
| 16627 | + name: "User API Key", |
| 16628 | + type: "workspace", |
| 16629 | + "sub-type": "user", |
| 16630 | + workspace_id: "WORKSPACE_ID", |
| 16631 | + user_id: "USER_ID", // Required for user API keys |
| 16632 | + "scopes": [ |
| 16633 | + "completions.write", |
| 16634 | + "logs.view" |
| 16635 | + ] |
| 16636 | + }) |
| 16637 | + console.log(apiKey); |
| 16638 | + - lang: curl |
| 16639 | + label: User API Key |
| 16640 | + source: | |
| 16641 | + curl -X POST https://api.portkey.ai/v1/api-keys/workspace/user |
| 16642 | + -H "x-portkey-api-key: PORTKEY_API_KEY" \ |
| 16643 | + -H "Content-Type: application/json" \ |
| 16644 | + -d '{ |
| 16645 | + "name":"User API Key", |
| 16646 | + "type":"workspace", |
| 16647 | + "sub-type":"user", |
| 16648 | + "workspace_id":"WORKSPACE_ID", |
| 16649 | + "user_id":"USER_ID", |
| 16650 | + "scopes":[ |
| 16651 | + "completions.write", |
| 16652 | + "logs.view" |
| 16653 | + ] |
| 16654 | + }' |
16591 | 16655 |
|
16592 | 16656 | /api-keys: |
16593 | 16657 | servers: |
@@ -16700,7 +16764,9 @@ paths: |
16700 | 16764 | put: |
16701 | 16765 | tags: |
16702 | 16766 | - Api-Keys |
16703 | | - summary: Update Api Keys |
| 16767 | + summary: Update API Keys |
| 16768 | + description: | |
| 16769 | + Updates an existing API key. The API key type (user vs service) and associated user_id cannot be changed after creation. |
16704 | 16770 | requestBody: |
16705 | 16771 | content: |
16706 | 16772 | application/json: |
@@ -17083,7 +17149,7 @@ paths: |
17083 | 17149 | get: |
17084 | 17150 | tags: |
17085 | 17151 | - Api-Keys |
17086 | | - summary: Get Api Keys |
| 17152 | + summary: Get API Keys |
17087 | 17153 | parameters: |
17088 | 17154 | - name: id |
17089 | 17155 | in: path |
@@ -17180,7 +17246,7 @@ paths: |
17180 | 17246 | delete: |
17181 | 17247 | tags: |
17182 | 17248 | - Api-Keys |
17183 | | - summary: Remove a Api Key |
| 17249 | + summary: Remove an API Key |
17184 | 17250 | parameters: |
17185 | 17251 | - name: id |
17186 | 17252 | in: path |
@@ -31974,6 +32040,7 @@ components: |
31974 | 32040 | user_id: |
31975 | 32041 | type: string |
31976 | 32042 | format: uuid |
| 32043 | + description: "**Required** when sub-type path parameter is 'user'. Not required when sub-type is 'service'." |
31977 | 32044 | example: "c3d4e5f6-a7b8-6c7d-0e1f-2a3b4c5d6e7f" |
31978 | 32045 | rate_limits: |
31979 | 32046 | type: array |
|
0 commit comments