Sample - OpenAI API
POST/organization/admin_api_keys

Create an organization admin API key

Creates an organization admin API key. Supply a name and optionally set expires_in_seconds to configure an expiration period; omit the expiration field to create a key that does not expire.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 body fields

Organization admin API key details, including its required name and optional expiration period.

namestringrequired
The name assigned to the organization admin API key.
expires_in_secondsintegeroptional
The number of seconds until the API key expires. Omit this field for a key that does not expire.

1 status code
200Returns the newly created admin API key, including its identifier, redacted value, metadata, and the full `value`, which is returned only once at creation.
objectstringrequired
The object type, which is always `organization.admin_api_key`
Allowed:organization.admin_api_key
idstringrequired
The identifier, which can be referenced in API endpoints
namestringoptional
The name of the API key
redacted_valuestringrequired
The redacted value of the API key
created_atintegerrequired
The Unix timestamp (in seconds) of when the API key was created
expires_atintegerrequired
The Unix timestamp (in seconds) of when the API key expires
last_used_atintegeroptional
The Unix timestamp (in seconds) of when the API key was last used
ownerobjectrequired
valuestringrequired
The value of the API key. Only shown on create.

Error handling

name is required. When supplied, expires_in_seconds must be between 1 and 31536000 seconds; omit it to create a key without an expiration.