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. (api_keys) (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. (api_keys) (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 | include | Get an API key. |
list_apikeys | select | 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 | data | Create an API key. | |
update_apikey | update | api_key_id, data | Update an API key. | |
delete_apikey | delete | api_key_id | 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. |
site | string | The 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. |
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) | Number of items to return per 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 include = '{{ include }}'
;
List all API keys available for your account.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.api_keys
WHERE 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
)
SELECT
'{{ data }}' /* required */
RETURNING
data,
included
;
# Description fields are for documentation purposes
- name: api_keys
props:
- name: data
description: |
Object used to create an API key.
value:
attributes:
category: "{{ category }}"
name: "{{ name }}"
remote_config_read_enabled: {{ remote_config_read_enabled }}
type: "{{ type }}"
UPDATE examples
- update_apikey
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_apikey
Delete an API key.
DELETE FROM datadog.organization.api_keys
WHERE api_key_id = '{{ api_key_id }}' --required
;