Get an application key

GET https://api.ap1.datadoghq.com/api/v1/application_key/{key}https://api.ap2.datadoghq.com/api/v1/application_key/{key}https://api.datadoghq.eu/api/v1/application_key/{key}https://api.ddog-gov.com/api/v1/application_key/{key}https://api.us2.ddog-gov.com/api/v1/application_key/{key}https://api.datadoghq.com/api/v1/application_key/{key}https://api.us3.datadoghq.com/api/v1/application_key/{key}https://api.us5.datadoghq.com/api/v1/application_key/{key}

Overview

Get a given application key. This endpoint is disabled for organizations in One-Time Read mode.

Note: This endpoint is disabled for the Government sites (US1-FED and US2-FED). Use the V2 Key Management endpoints instead.

This endpoint requires any of the following permissions:
  • org_app_keys_read
  • user_app_keys

  • Arguments

    Path Parameters

    Name

    Type

    Description

    key [required]

    string

    The specific APP key you are working with.

    Response

    OK

    An application key response.

    Expand All

    Field

    Type

    Description

    application_key

    object

    An application key with its associated metadata.

    hash

    string

    Hash of an application key.

    name

    string

    Name of an application key.

    owner

    string

    Owner of an application key.

    {
      "application_key": {
        "hash": "1234512345123459cda4eb9ced49a3d84fd0138c",
        "name": "app_key",
        "owner": "test_user"
      }
    }

    Forbidden

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Not Found

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Too many requests

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Code Example

                      # Path parameters
    export key="CHANGE_ME"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/application_key/${key}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get an application key returns "OK" response
    """
    
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v1.api.key_management_api import KeyManagementApi
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.get_application_key(
            key="key",
        )
    
        print(response)
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V1::KeyManagementAPI.new
    p api_instance.get_application_key("key")
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get an application key returns "OK" response
    
    package main
    
    import (
    	"context"
    	"encoding/json"
    	"fmt"
    	"os"
    
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
    )
    
    func main() {
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV1.NewKeyManagementApi(apiClient)
    	resp, r, err := api.GetApplicationKey(ctx, "key")
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetApplicationKey`:\n%s\n", responseContent)
    }
    

    Instructions

    First install the library and its dependencies and then save the example to main.go and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v1.api.KeyManagementApi;
    import com.datadog.api.client.v1.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        try {
          ApplicationKeyResponse result = apiInstance.getApplicationKey("key");
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#getApplicationKey");
          System.err.println("Status code: " + e.getCode());
          System.err.println("Reason: " + e.getResponseBody());
          System.err.println("Response headers: " + e.getResponseHeaders());
          e.printStackTrace();
        }
      }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to Example.java and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV1::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api.get_application_key("key".to_string()).await;
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to src/main.rs and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get an application key returns "OK" response
     */
    
    import { client, v1 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v1.KeyManagementApi(configuration);
    
    const params: v1.KeyManagementApiGetApplicationKeyRequest = {
      key: "key",
    };
    
    apiInstance
      .getApplicationKey(params)
      .then((data: v1.ApplicationKeyResponse) => {
        console.log(
          "API called successfully. Returned data: " + JSON.stringify(data)
        );
      })
      .catch((error: any) => console.error(error));
    

    Instructions

    First install the library and its dependencies and then save the example to example.ts and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

    GET https://api.ap1.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.ap2.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.eu/api/v2/application_keys/{app_key_id}https://api.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.us2.ddog-gov.com/api/v2/application_keys/{app_key_id}https://api.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us3.datadoghq.com/api/v2/application_keys/{app_key_id}https://api.us5.datadoghq.com/api/v2/application_keys/{app_key_id}

    Overview

    Get an application key for your org. This endpoint requires the org_app_keys_read permission.

    Arguments

    Path Parameters

    Name

    Type

    Description

    app_key_id [required]

    string

    The ID of the application key.

    Query Strings

    Name

    Type

    Description

    include

    string

    Resource path for related resources to include in the response. Only owned_by is supported.

    Response

    OK

    Response for retrieving an application key.

    Expand All

    Field

    Type

    Description

    data

    object

    Datadog application key.

    attributes

    object

    Attributes of a full application key.

    created_at

    date-time

    Creation date of the application key.

    key

    string

    The application key.

    last4

    string

    The last four characters of the application key.

    last_used_at

    date-time

    Last usage timestamp of the application key.

    name

    string

    Name of the application key.

    scopes

    [string]

    Array of scopes to grant the application key.

    id

    string

    ID of the application key.

    relationships

    object

    Resources related to the application key.

    owned_by

    object

    Relationship to user.

    data [required]

    object

    Relationship to user object.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    type

    enum

    Application Keys resource type. Allowed enum values: application_keys

    default: application_keys

    included

    [ <oneOf>]

    Array of objects related to the application key.

    Option 1

    object

    User object returned by the API.

    attributes

    object

    Attributes of user object returned by the API.

    created_at

    date-time

    The ISO 8601 timestamp of when the user account was created.

    disabled

    boolean

    Whether the user account is deactivated. Disabled users cannot log in.

    email

    string

    The email address of the user, used for login and notifications.

    handle

    string

    The unique handle (username) of the user, typically matching their email prefix.

    icon

    string

    URL of the user's profile icon, typically a Gravatar URL derived from the email address.

    last_login_time

    date-time

    The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.

    mfa_enabled

    boolean

    Whether multi-factor authentication (MFA) is enabled for the user's account.

    modified_at

    date-time

    The ISO 8601 timestamp of when the user account was last modified.

    name

    string

    The full display name of the user as shown in the Datadog UI.

    service_account

    boolean

    Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.

    status

    string

    The current status of the user account (for example, Active, Pending, or Disabled).

    title

    string

    The job title of the user (for example, "Senior Engineer" or "Product Manager").

    uuid

    string

    The globally unique identifier (UUID) of the user.

    verified

    boolean

    Whether the user's email address has been verified.

    id

    string

    ID of the user.

    relationships

    object

    Relationships of the user object returned by the API.

    org

    object

    Relationship to an organization.

    data [required]

    object

    Relationship to organization object.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_orgs

    object

    Relationship to organizations.

    data [required]

    [object]

    Relationships to organization objects.

    id [required]

    string

    ID of the organization.

    type [required]

    enum

    Organizations resource type. Allowed enum values: orgs

    default: orgs

    other_users

    object

    Relationship to users.

    data [required]

    [object]

    Relationships to user objects.

    id [required]

    string

    A unique identifier that represents the user.

    type [required]

    enum

    Users resource type. Allowed enum values: users

    default: users

    roles

    object

    Relationship to roles.

    data

    [object]

    An array containing type and the unique identifier of a role.

    id

    string

    The unique identifier of the role.

    type

    enum

    Roles type. Allowed enum values: roles

    default: roles

    type

    enum

    Users resource type. Allowed enum values: users

    default: users

    Option 2

    object

    Role object returned by the API.

    attributes

    object

    Attributes of the role.

    created_at

    date-time

    Creation time of the role.

    modified_at

    date-time

    Time of last role modification.

    name

    string

    The name of the role. The name is neither unique nor a stable identifier of the role.

    receives_permissions_from

    [string]

    The managed role from which this role automatically inherits new permissions. Specify one of the following: "Datadog Admin Role", "Datadog Standard Role", or "Datadog Read Only Role". If empty or not specified, the role does not automatically inherit permissions from any managed role.

    user_count

    int64

    Number of users with that role.

    id

    string

    The unique identifier of the role.

    relationships

    object

    Relationships of the role object returned by the API.

    permissions

    object

    Relationship to multiple permissions objects.

    data

    [object]

    Relationships to permission objects.

    id

    string

    ID of the permission.

    type

    enum

    Permissions resource type. Allowed enum values: permissions

    default: permissions

    type [required]

    enum

    Roles type. Allowed enum values: roles

    default: roles

    Option 3

    object

    The definition of LeakedKey object.

    attributes [required]

    object

    The definition of LeakedKeyAttributes object.

    date [required]

    date-time

    The LeakedKeyAttributes date.

    leak_source

    string

    The LeakedKeyAttributes leak_source.

    id [required]

    string

    The LeakedKey id.

    type [required]

    enum

    The definition of LeakedKeyType object. Allowed enum values: leaked_keys

    default: leaked_keys

    {
      "data": {
        "attributes": {
          "created_at": "2020-11-23T10:00:00.000Z",
          "key": "string",
          "last4": "abcd",
          "last_used_at": "2020-12-20T10:00:00.000Z",
          "name": "Application Key for managing dashboards",
          "scopes": [
            "dashboards_read",
            "dashboards_write",
            "dashboards_public_share"
          ]
        },
        "id": "string",
        "relationships": {
          "owned_by": {
            "data": {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          }
        },
        "type": "application_keys"
      },
      "included": [
        {
          "attributes": {
            "created_at": "2019-09-19T10:00:00.000Z",
            "disabled": false,
            "email": "string",
            "handle": "string",
            "icon": "string",
            "last_login_time": "2019-09-19T10:00:00.000Z",
            "mfa_enabled": false,
            "modified_at": "2019-09-19T10:00:00.000Z",
            "name": "string",
            "service_account": false,
            "status": "string",
            "title": "string",
            "uuid": "string",
            "verified": false
          },
          "id": "string",
          "relationships": {
            "org": {
              "data": {
                "id": "00000000-0000-beef-0000-000000000000",
                "type": "orgs"
              }
            },
            "other_orgs": {
              "data": [
                {
                  "id": "00000000-0000-beef-0000-000000000000",
                  "type": "orgs"
                }
              ]
            },
            "other_users": {
              "data": [
                {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              ]
            },
            "roles": {
              "data": [
                {
                  "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
                  "type": "roles"
                }
              ]
            }
          },
          "type": "users"
        }
      ]
    }

    Bad Request

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Forbidden

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Not Found

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Too many requests

    API error response.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Code Example

                      # Path parameters
    export app_key_id="CHANGE_ME"
    # Curl command
    curl -X GET "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/application_keys/${app_key_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
    """
    Get an application key returns "OK" response
    """
    
    from os import environ
    from datadog_api_client import ApiClient, Configuration
    from datadog_api_client.v2.api.key_management_api import KeyManagementApi
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = environ["APPLICATION_KEY_DATA_ID"]
    
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api_instance = KeyManagementApi(api_client)
        response = api_instance.get_application_key(
            app_key_id=APPLICATION_KEY_DATA_ID,
        )
    
        print(response)
    

    Instructions

    First install the library and its dependencies and then save the example to example.py and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
    # Get an application key returns "OK" response
    
    require "datadog_api_client"
    api_instance = DatadogAPIClient::V2::KeyManagementAPI.new
    
    # there is a valid "application_key" in the system
    APPLICATION_KEY_DATA_ID = ENV["APPLICATION_KEY_DATA_ID"]
    p api_instance.get_application_key(APPLICATION_KEY_DATA_ID)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
    // Get an application key returns "OK" response
    
    package main
    
    import (
    	"context"
    	"encoding/json"
    	"fmt"
    	"os"
    
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
    	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
    )
    
    func main() {
    	// there is a valid "application_key" in the system
    	ApplicationKeyDataID := os.Getenv("APPLICATION_KEY_DATA_ID")
    
    	ctx := datadog.NewDefaultContext(context.Background())
    	configuration := datadog.NewConfiguration()
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewKeyManagementApi(apiClient)
    	resp, r, err := api.GetApplicationKey(ctx, ApplicationKeyDataID, *datadogV2.NewGetApplicationKeyOptionalParameters())
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `KeyManagementApi.GetApplicationKey`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `KeyManagementApi.GetApplicationKey`:\n%s\n", responseContent)
    }
    

    Instructions

    First install the library and its dependencies and then save the example to main.go and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
    // Get an application key returns "OK" response
    
    import com.datadog.api.client.ApiClient;
    import com.datadog.api.client.ApiException;
    import com.datadog.api.client.v2.api.KeyManagementApi;
    import com.datadog.api.client.v2.model.ApplicationKeyResponse;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        KeyManagementApi apiInstance = new KeyManagementApi(defaultClient);
    
        // there is a valid "application_key" in the system
        String APPLICATION_KEY_DATA_ID = System.getenv("APPLICATION_KEY_DATA_ID");
    
        try {
          ApplicationKeyResponse result = apiInstance.getApplicationKey(APPLICATION_KEY_DATA_ID);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling KeyManagementApi#getApplicationKey");
          System.err.println("Status code: " + e.getCode());
          System.err.println("Reason: " + e.getResponseBody());
          System.err.println("Response headers: " + e.getResponseHeaders());
          e.printStackTrace();
        }
      }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to Example.java and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
    // Get an application key returns "OK" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_key_management::GetApplicationKeyOptionalParams;
    use datadog_api_client::datadogV2::api_key_management::KeyManagementAPI;
    
    #[tokio::main]
    async fn main() {
        // there is a valid "application_key" in the system
        let application_key_data_id = std::env::var("APPLICATION_KEY_DATA_ID").unwrap();
        let configuration = datadog::Configuration::new();
        let api = KeyManagementAPI::with_config(configuration);
        let resp = api
            .get_application_key(
                application_key_data_id.clone(),
                GetApplicationKeyOptionalParams::default(),
            )
            .await;
        if let Ok(value) = resp {
            println!("{:#?}", value);
        } else {
            println!("{:#?}", resp.unwrap_err());
        }
    }
    

    Instructions

    First install the library and its dependencies and then save the example to src/main.rs and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
    /**
     * Get an application key returns "OK" response
     */
    
    import { client, v2 } from "@datadog/datadog-api-client";
    
    const configuration = client.createConfiguration();
    const apiInstance = new v2.KeyManagementApi(configuration);
    
    // there is a valid "application_key" in the system
    const APPLICATION_KEY_DATA_ID = process.env.APPLICATION_KEY_DATA_ID as string;
    
    const params: v2.KeyManagementApiGetApplicationKeyRequest = {
      appKeyId: APPLICATION_KEY_DATA_ID,
    };
    
    apiInstance
      .getApplicationKey(params)
      .then((data: v2.ApplicationKeyResponse) => {
        console.log(
          "API called successfully. Returned data: " + JSON.stringify(data)
        );
      })
      .catch((error: any) => console.error(error));
    

    Instructions

    First install the library and its dependencies and then save the example to example.ts and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"