POST https://api.ap1.datadoghq.com/api/v1/application_key https://api.ap2.datadoghq.com/api/v1/application_key https://api.datadoghq.eu/api/v1/application_key https://api.ddog-gov.com/api/v1/application_key https://api.us2.ddog-gov.com/api/v1/application_key https://api.datadoghq.com/api/v1/application_key https://api.us3.datadoghq.com/api/v1/application_key https://api.us5.datadoghq.com/api/v1/application_key
Overview
Create an application key with a given name.
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 the
user_app_keys permission.
Request Body Data (required)
Expand All
Hash of an application key.
Name of an application key.
Owner of an application key.
{
"name" : "example user"
} Response OK
An application key response.
Expand All
An application key with its associated metadata.
Hash of an application key.
Name of an application key.
Owner of an application key.
{
"application_key" : {
"hash" : "1234512345123459cda4eb9ced49a3d84fd0138c" ,
"name" : "app_key" ,
"owner" : "test_user"
}
} Bad Request
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Forbidden
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Conflict
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Too many requests
Error response object.
Expand All
Array of errors returned by the API.
{
"errors" : [
"Bad Request"
]
} Code Example Copy
## default
#
# Curl command curl -X POST "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 " \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY} " \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY} " \
-d @- << EOF
{
"name": "example key"
}
EOF
"""
Create an application key returns "OK" response
"""
from datadog_api_client import ApiClient , Configuration
from datadog_api_client.v1.api.key_management_api import KeyManagementApi
from datadog_api_client.v1.model.application_key import ApplicationKey
body = ApplicationKey (
name = "example user" ,
)
configuration = Configuration ()
with ApiClient ( configuration ) as api_client :
api_instance = KeyManagementApi ( api_client )
response = api_instance . create_application_key ( body = body )
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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" python3 "example.py"
# Create an application key returns "OK" response
require "datadog_api_client"
api_instance = DatadogAPIClient :: V1 :: KeyManagementAPI . new
body = DatadogAPIClient :: V1 :: ApplicationKey . new ({
name : "example user" ,
})
p api_instance . create_application_key ( body )
Instructions First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE = "datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" rb "example.rb"
// Create 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 () {
body := datadogV1 . ApplicationKey {
Name : datadog . PtrString ( "example user" ),
}
ctx := datadog . NewDefaultContext ( context . Background ())
configuration := datadog . NewConfiguration ()
apiClient := datadog . NewAPIClient ( configuration )
api := datadogV1 . NewKeyManagementApi ( apiClient )
resp , r , err := api . CreateApplicationKey ( ctx , body )
if err != nil {
fmt . Fprintf ( os . Stderr , "Error when calling `KeyManagementApi.CreateApplicationKey`: %v\n" , err )
fmt . Fprintf ( os . Stderr , "Full HTTP response: %v\n" , r )
}
responseContent , _ := json . MarshalIndent ( resp , "" , " " )
fmt . Fprintf ( os . Stdout , "Response from `KeyManagementApi.CreateApplicationKey`:\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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" go run "main.go"
// Create 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.ApplicationKey ;
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 );
ApplicationKey body = new ApplicationKey (). name ( "example user" );
try {
ApplicationKeyResponse result = apiInstance . createApplicationKey ( body );
System . out . println ( result );
} catch ( ApiException e ) {
System . err . println ( "Exception when calling KeyManagementApi#createApplicationKey" );
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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" java "Example.java"
// Create an application key returns "OK" response
use datadog_api_client ::datadog ;
use datadog_api_client ::datadogV1 ::api_key_management ::KeyManagementAPI ;
use datadog_api_client ::datadogV1 ::model ::ApplicationKey ;
#[tokio::main]
async fn main () {
let body = ApplicationKey ::new (). name ( "example user" . to_string ());
let configuration = datadog ::Configuration ::new ();
let api = KeyManagementAPI ::with_config ( configuration );
let resp = api . create_application_key ( body ). 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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" cargo run
/**
* Create 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.KeyManagementApiCreateApplicationKeyRequest = {
body : {
name : "example user" ,
},
};
apiInstance
. createApplicationKey ( 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.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ap1.datadoghq.com ap2.datadoghq.com ddog-gov.com us2.ddog-gov.com " DD_API_KEY = "<API-KEY>" DD_APP_KEY = "<APP-KEY>" tsc "example.ts"