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.source

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.source

Path parameters

The ID of the project.source

Query parameters

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.source

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.source

Returns

A list of ProjectApiKey objects.source

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.source

Path parameters

The ID of the project.source

The ID of the API key.source

Returns

The ProjectApiKey object matching the specified ID.source

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.source

Path parameters

The ID of the project.source

The ID of the API key.source

Returns

Confirmation of the key's deletion or an error if the key belonged to a service accountsource

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.source

The object type, which is always organization.project.api_keysource

The redacted value of the API keysource

The name of the API keysource

The Unix timestamp (in seconds) of when the API key was createdsource

The identifier, which can be referenced in API endpointssource

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
        }
    }
}