Skip to main content

api_keys

Creates, updates, deletes, gets or lists an api_keys resource.

Overview

Nameapi_keys
TypeResource
Idopenai_admin.projects.api_keys

Fields

The following fields are returned by SELECT queries:

Project API key retrieved successfully.

NameDatatypeDescription
idstringThe identifier, which can be referenced in API endpoints
namestringThe name of the API key
created_atinteger (unixtime)The Unix timestamp (in seconds) of when the API key was created
last_used_atinteger (unixtime)The Unix timestamp (in seconds) of when the API key was last used.
objectstringThe object type, which is always organization.project.api_key (organization.project.api_key)
ownerobject
redacted_valuestringThe redacted value of the API key

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject_id, api_key_id
listselectproject_idlimit, after
deletedeleteproject_id, api_key_id

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_key_idstringThe ID of the API key.
project_idstringThe ID of the project.
afterstringA 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.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

SELECT examples

Project API key retrieved successfully.

SELECT
id,
name,
created_at,
last_used_at,
object,
owner,
redacted_value
FROM openai_admin.projects.api_keys
WHERE project_id = '{{ project_id }}' -- required
AND api_key_id = '{{ api_key_id }}' -- required
;

DELETE examples

No description available.

DELETE FROM openai_admin.projects.api_keys
WHERE project_id = '{{ project_id }}' --required
AND api_key_id = '{{ api_key_id }}' --required
;