api_keys
Creates, updates, deletes, gets or lists an api_keys resource.
Overview
| Name | api_keys |
| Type | Resource |
| Id | datadog.organization.api_keys |
Fields
The following fields are returned by SELECT queries:
- get_apikey
- list_apikeys
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the API key. |
attributes | object | Attributes of a full API key. |
relationships | object | Resources related to the API key. |
type | string | API Keys resource type. (default: api_keys, example: api_keys) |
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the API key. |
attributes | object | Attributes of a partial API key. |
relationships | object | Resources related to the API key. |
type | string | API Keys resource type. (default: api_keys, example: api_keys) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_apikey | select | api_key_id, region | include | Get an API key. |
list_apikeys | select | region | page[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_apikey | insert | region, data__data | Create an API key. | |
update_apikey | update | api_key_id, region, data__data | Update an API key. | |
delete_apikey | delete | api_key_id, region | Delete 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.
| Name | Datatype | Description |
|---|---|---|
api_key_id | string | The ID of the API key. |
region | string | (default: datadoghq.com) |
filter | string | Filter API keys by the specified string. |
filter[category] | string | Filter API keys by category. |
filter[created_at][end] | string | Only include API keys created on or before the specified date. |
filter[created_at][start] | string | Only include API keys created on or after the specified date. |
filter[modified_at][end] | string | Only include API keys modified on or before the specified date. |
filter[modified_at][start] | string | Only include API keys modified on or after the specified date. |
filter[remote_config_read_enabled] | boolean | Filter API keys by remote config read enabled status. |
include | string | Comma 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) | Size for a given page. The maximum allowed value is 100. |
sort | string | API 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_apikey
- list_apikeys
Get an API key.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.api_keys
WHERE api_key_id = '{{ api_key_id }}' -- required
AND region = '{{ region }}' -- required
AND include = '{{ include }}'
;
List all API keys available for your account.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.api_keys
WHERE region = '{{ region }}' -- required
AND page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND sort = '{{ sort }}'
AND filter = '{{ filter }}'
AND filter[created_at][start] = '{{ filter[created_at][start] }}'
AND filter[created_at][end] = '{{ filter[created_at][end] }}'
AND filter[modified_at][start] = '{{ filter[modified_at][start] }}'
AND filter[modified_at][end] = '{{ filter[modified_at][end] }}'
AND include = '{{ include }}'
AND filter[remote_config_read_enabled] = '{{ filter[remote_config_read_enabled] }}'
AND filter[category] = '{{ filter[category] }}'
;
INSERT examples
- create_apikey
- Manifest
Create an API key.
INSERT INTO datadog.organization.api_keys (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data,
included
;
# Description fields are for documentation purposes
- name: api_keys
props:
- name: region
value: string
description: Required parameter for the api_keys resource.
- name: data
value: object
description: |
Object used to create an API key.
UPDATE examples
- update_apikey
Update an API key.
UPDATE datadog.organization.api_keys
SET
data__data = '{{ data }}'
WHERE
api_key_id = '{{ api_key_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data,
included;
DELETE examples
- delete_apikey
Delete an API key.
DELETE FROM datadog.organization.api_keys
WHERE api_key_id = '{{ api_key_id }}' --required
AND region = '{{ region }}' --required
;