Project API keys
Manage API keys for a given project. Supports listing and deleting keys for users. This API does not allow issuing keys for users, as users need to authorize themselves to generate keys.
List project API keys
get https://api.openai.com/v1/organization/projects/{project_id}/api_keys
Returns a list of API keys in the project.
Query parameters
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Returns
A list of ProjectApiKey objects.
Example request
1
2
3
curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20 \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
Retrieve project API key
get https://api.openai.com/v1/organization/projects/{project_id}/api_keys/{key_id}
Retrieves an API key in the project.
Path parameters
Returns
The ProjectApiKey object matching the specified ID.
Example request
1
2
3
curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
Delete project API key
delete https://api.openai.com/v1/organization/projects/{project_id}/api_keys/{key_id}
Deletes an API key from the project.
Path parameters
Returns
Confirmation of the key's deletion or an error if the key belonged to a service account
Example request
1
2
3
curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/api_keys/key_abc \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
The project API key object
Represents an individual API key in a project.
OBJECT The project API key object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"object": "organization.project.api_key",
"redacted_value": "sk-abc...def",
"name": "My API Key",
"created_at": 1711471533,
"id": "key_abc",
"owner": {
"type": "user",
"user": {
"object": "organization.project.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"created_at": 1711471533
}
}
}