Skip to main content

api_keys

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

Overview

Nameapi_keys
TypeResource
Iddatadog.organization.api_keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the API key.
attributesobjectAttributes of a full API key.
relationshipsobjectResources related to the API key.
typestringAPI Keys resource type. (api_keys) (default: api_keys, example: api_keys)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_apikeyselectapi_key_idincludeGet an API key.
list_apikeysselectpage[size], page[number], sort, filter, filter[created_at][start], filter[created_at][end], filter[modified_at][start], filter[modified_at][end], include, filter[remote_config_read_enabled], filter[category]List all API keys available for your account.
create_apikeyinsertdataCreate an API key.
update_apikeyupdateapi_key_id, dataUpdate an API key.
delete_apikeydeleteapi_key_idDelete an API key.

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.
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
filterstringFilter API keys by the specified string.
filter[category]stringFilter API keys by category.
filter[created_at][end]stringOnly include API keys created on or before the specified date.
filter[created_at][start]stringOnly include API keys created on or after the specified date.
filter[modified_at][end]stringOnly include API keys modified on or before the specified date.
filter[modified_at][start]stringOnly include API keys modified on or after the specified date.
filter[remote_config_read_enabled]booleanFilter API keys by remote config read enabled status.
includestringComma separated list of resource paths for related resources to include in the response. Supported resource paths are created_by and modified_by.
page[number]integer (int64)Specific page number to return.
page[size]integer (int64)Number of items to return per page. The maximum allowed value is 100.
sortstringAPI key attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.

SELECT examples

Get an API key.

SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.api_keys
WHERE api_key_id = '{{ api_key_id }}' -- required
AND include = '{{ include }}'
;

INSERT examples

Create an API key.

INSERT INTO datadog.organization.api_keys (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data,
included
;

UPDATE examples

Update an API key.

UPDATE datadog.organization.api_keys
SET
data = '{{ data }}'
WHERE
api_key_id = '{{ api_key_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;

DELETE examples

Delete an API key.

DELETE FROM datadog.organization.api_keys
WHERE api_key_id = '{{ api_key_id }}' --required
;