Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

List project API keys

GET
/organization/projects/{project_id}/api_keys

Returns a list of API keys in the project.

List project API keys

curl https://api.openai.com/v1/organization/projects/proj_abc/api_keys?after=key_abc&limit=20&owner_project_access=any \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json"
Response example
{
    "object": "list",
    "data": [
        {
            "object": "organization.project.api_key",
            "redacted_value": "sk-abc...def",
            "name": "My API Key",
            "created_at": 1711471533,
            "last_used_at": 1711471534,
            "id": "key_abc",
            "owner_project_access": "active",
            "owner": {
                "type": "user",
                "user": {
                    "id": "user_abc",
                    "name": "First Last",
                    "email": "user@example.com",
                    "role": "owner",
                    "created_at": 1711471533
                }
            }
        }
    ],
    "first_id": "key_abc",
    "last_id": "key_xyz",
    "has_more": false
}
Path Parameters
project_id: string

The ID of the project.

Query Parameters
after: optional string

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.

limit: optional integer (default: 20)

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

owner_project_access: optional "active" or "inactive" or "any"

Filter API keys by whether the owner currently has effective access to the project. Use active for owners with access, inactive for owners without access, or any for all enabled project API keys. If omitted, the endpoint applies its existing membership-based visibility rules, which may exclude some enabled keys.

One of the following:
"active"
"inactive"
"any"
Returns
data: array of ProjectAPIKey { id, created_at, last_used_at, 6 more }
id: string

The identifier, which can be referenced in API endpoints

created_at: integer

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

formatunixtime
last_used_at: integer or null

The Unix timestamp (in seconds) of when the API key was last used.

formatunixtime
name: string

The name of the API key

object: "organization.project.api_key"

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

owner: object { service_account, type, user }
service_account: optional object { id, created_at, name, role }

The service account that owns a project API key.

id: string

The identifier, which can be referenced in API endpoints

created_at: integer

The Unix timestamp (in seconds) of when the service account was created.

formatunixtime
name: string

The name of the service account.

role: string

The service account’s project role.

type: optional "user" or "service_account"

user or service_account

One of the following:
"user"
"service_account"
user: optional object { id, created_at, email, 2 more }

The user that owns a project API key.

id: string

The identifier, which can be referenced in API endpoints

created_at: integer

The Unix timestamp (in seconds) of when the user was created.

formatunixtime
email: string

The email address of the user.

name: string

The name of the user.

role: string

The user’s project role.

owner_project_access: "active" or "inactive"

Whether the API key’s owner currently has effective access to the project.

One of the following:
"active"
"inactive"
redacted_value: string

The redacted value of the API key

expires_at: optional integer or null

The Unix timestamp (in seconds) when the API key expires, or null if it does not expire.

formatunixtime
has_more: boolean
object: "list"
first_id: optional string or null
last_id: optional string or null
Returns Examples
Response example
{
    "object": "list",
    "data": [
        {
            "object": "organization.project.api_key",
            "redacted_value": "sk-abc...def",
            "name": "My API Key",
            "created_at": 1711471533,
            "last_used_at": 1711471534,
            "id": "key_abc",
            "owner_project_access": "active",
            "owner": {
                "type": "user",
                "user": {
                    "id": "user_abc",
                    "name": "First Last",
                    "email": "user@example.com",
                    "role": "owner",
                    "created_at": 1711471533
                }
            }
        }
    ],
    "first_id": "key_abc",
    "last_id": "key_xyz",
    "has_more": false
}