Skip to content
Primary navigation

List all organization and project API keys.

AdminApiKeyListPage admin().organization().adminApiKeys().list(AdminApiKeyListParamsparams = AdminApiKeyListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/organization/admin_api_keys

List organization API keys

ParametersExpand Collapse
AdminApiKeyListParams params
Optional<String> after

Return keys with IDs that come after this ID in the pagination order.

Optional<Long> limit

Maximum number of keys to return.

Optional<Order> order

Order results by creation time, ascending or descending.

ASC("asc")
DESC("desc")
ReturnsExpand Collapse
class AdminApiKey:

Represents an individual Admin API key in an org.

String id

The identifier, which can be referenced in API endpoints

long createdAt

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

formatunixtime
JsonValue; object_ "organization.admin_api_key"constant"organization.admin_api_key"constant

The object type, which is always organization.admin_api_key

Owner owner
Optional<String> id

The identifier, which can be referenced in API endpoints

Optional<Long> createdAt

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

formatunixtime
Optional<String> name

The name of the user

Optional<String> object_

The object type, which is always organization.user

Optional<String> role

Always owner

Optional<String> type

Always user

String redactedValue

The redacted value of the API key

Optional<Long> lastUsedAt

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

formatunixtime
Optional<String> name

The name of the API key

List all organization and project API keys.

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListPage;
import com.openai.models.admin.organization.adminapikeys.AdminApiKeyListParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        AdminApiKeyListPage page = client.admin().organization().adminApiKeys().list();
    }
}
{
  "object": "list",
  "data": [
    {
      "object": "organization.admin_api_key",
      "id": "key_abc",
      "name": "Main Admin Key",
      "redacted_value": "sk-admin...def",
      "created_at": 1711471533,
      "last_used_at": 1711471534,
      "owner": {
        "type": "service_account",
        "object": "organization.service_account",
        "id": "sa_456",
        "name": "My Service Account",
        "created_at": 1711471533,
        "role": "member"
      }
    }
  ],
  "first_id": "key_abc",
  "last_id": "key_abc",
  "has_more": false
}
Returns Examples
{
  "object": "list",
  "data": [
    {
      "object": "organization.admin_api_key",
      "id": "key_abc",
      "name": "Main Admin Key",
      "redacted_value": "sk-admin...def",
      "created_at": 1711471533,
      "last_used_at": 1711471534,
      "owner": {
        "type": "service_account",
        "object": "organization.service_account",
        "id": "sa_456",
        "name": "My Service Account",
        "created_at": 1711471533,
        "role": "member"
      }
    }
  ],
  "first_id": "key_abc",
  "last_id": "key_abc",
  "has_more": false
}