For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/api/latest/oauth2-client-public/register-an-oauth2-client.md. A documentation index is available at /llms.txt.

Register an OAuth2 client

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/oauth2/registerhttps://api.ap2.datadoghq.com/api/v2/oauth2/registerhttps://api.datadoghq.eu/api/v2/oauth2/registerhttps://api.ddog-gov.com/api/v2/oauth2/registerhttps://api.us2.ddog-gov.com/api/v2/oauth2/registerhttps://api.uk1.datadoghq.com/api/v2/oauth2/registerhttps://api.datadoghq.com/api/v2/oauth2/registerhttps://api.us3.datadoghq.com/api/v2/oauth2/registerhttps://api.us5.datadoghq.com/api/v2/oauth2/register

Overview

Register an OAuth2 client using the Dynamic Client Registration protocol defined in RFC 7591.

Request

Body Data (required)

Expand All

Field

Type

Description

client_name [required]

string

Human-readable name of the client. Control characters are rejected.

client_uri

string

URL of the home page of the client.

grant_types

[string]

OAuth 2.0 grant types the client may use. Defaults to authorization_code and refresh_token when omitted.

jwks_uri

string

URL referencing the client's JSON Web Key Set.

logo_uri

string

URL referencing a logo for the client.

policy_uri

string

URL pointing to the client's privacy policy.

redirect_uris [required]

[string]

Array of redirection URI strings used by the client in redirect-based flows.

response_types

[string]

OAuth 2.0 response types the client may use. Only code is supported.

scope

string

Space-separated list of scope values the client may request.

token_endpoint_auth_method

string

Requested authentication method for the token endpoint. Only none is supported.

tos_uri

string

URL pointing to the client's terms of service.

{
  "client_name": "Example MCP Client",
  "client_uri": "https://example.com",
  "grant_types": [
    "authorization_code",
    "refresh_token"
  ],
  "jwks_uri": "https://example.com/.well-known/jwks.json",
  "logo_uri": "https://example.com/logo.png",
  "policy_uri": "https://example.com/privacy",
  "redirect_uris": [
    "https://example.com/oauth/callback"
  ],
  "response_types": [
    "code"
  ],
  "scope": "openid profile",
  "token_endpoint_auth_method": "none",
  "tos_uri": "https://example.com/tos"
}

Response

Created

Response payload for a successful OAuth2 dynamic client registration as defined by RFC 7591.

Expand All

Field

Type

Description

client_id [required]

uuid

Unique identifier assigned to the registered client.

client_name [required]

string

Human-readable name of the client.

grant_types [required]

[string]

OAuth 2.0 grant types registered for the client.

redirect_uris [required]

[string]

Redirection URIs registered for the client.

response_types [required]

[string]

OAuth 2.0 response types registered for the client.

token_endpoint_auth_method [required]

string

Authentication method registered for the token endpoint. Always none.

{
  "client_id": "72b68208-36a6-11f0-b21b-da7ad0900002",
  "client_name": "Example MCP Client",
  "grant_types": [
    "authorization_code",
    "refresh_token"
  ],
  "redirect_uris": [
    "https://example.com/oauth/callback"
  ],
  "response_types": [
    "code"
  ],
  "token_endpoint_auth_method": "none"
}

Bad Request

Error payload returned by OAuth2 dynamic client registration as defined by RFC 7591.

Expand All

Field

Type

Description

error [required]

string

Single ASCII error code per RFC 7591, such as invalid_request or invalid_client_metadata.

error_description [required]

string

Human-readable description of the error.

{
  "error": "invalid_client_metadata",
  "error_description": "redirect URI is not well-formed"
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Code Example

                  ## 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.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/oauth2/register" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d @- << EOF { "client_name": "Example MCP Client", "grant_types": [ "authorization_code", "refresh_token" ], "redirect_uris": [ "https://example.com/oauth/callback" ], "response_types": [ "code" ], "token_endpoint_auth_method": "none" } EOF
"""
Register an OAuth2 client returns "Created" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.o_auth2_client_public_api import OAuth2ClientPublicApi
from datadog_api_client.v2.model.o_auth_client_registration_grant_type import OAuthClientRegistrationGrantType
from datadog_api_client.v2.model.o_auth_client_registration_request import OAuthClientRegistrationRequest
from datadog_api_client.v2.model.o_auth_client_registration_response_type import OAuthClientRegistrationResponseType

body = OAuthClientRegistrationRequest(
    client_name="Example MCP Client",
    client_uri="https://example.com",
    grant_types=[
        OAuthClientRegistrationGrantType.AUTHORIZATION_CODE,
        OAuthClientRegistrationGrantType.REFRESH_TOKEN,
    ],
    jwks_uri="https://example.com/.well-known/jwks.json",
    logo_uri="https://example.com/logo.png",
    policy_uri="https://example.com/privacy",
    redirect_uris=[
        "https://example.com/oauth/callback",
    ],
    response_types=[
        OAuthClientRegistrationResponseType.CODE,
    ],
    scope="openid profile",
    token_endpoint_auth_method="none",
    tos_uri="https://example.com/tos",
)

configuration = Configuration()
configuration.unstable_operations["register_o_auth_client"] = True
with ApiClient(configuration) as api_client:
    api_instance = OAuth2ClientPublicApi(api_client)
    response = api_instance.register_o_auth_client(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" python3 "example.py"
# Register an OAuth2 client returns "Created" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.register_o_auth_client".to_sym] = true
end
api_instance = DatadogAPIClient::V2::OAuth2ClientPublicAPI.new

body = DatadogAPIClient::V2::OAuthClientRegistrationRequest.new({
  client_name: "Example MCP Client",
  client_uri: "https://example.com",
  grant_types: [
    DatadogAPIClient::V2::OAuthClientRegistrationGrantType::AUTHORIZATION_CODE,
    DatadogAPIClient::V2::OAuthClientRegistrationGrantType::REFRESH_TOKEN,
  ],
  jwks_uri: "https://example.com/.well-known/jwks.json",
  logo_uri: "https://example.com/logo.png",
  policy_uri: "https://example.com/privacy",
  redirect_uris: [
    "https://example.com/oauth/callback",
  ],
  response_types: [
    DatadogAPIClient::V2::OAuthClientRegistrationResponseType::CODE,
  ],
  scope: "openid profile",
  token_endpoint_auth_method: "none",
  tos_uri: "https://example.com/tos",
})
p api_instance.register_o_auth_client(body)

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.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" rb "example.rb"
// Register an OAuth2 client returns "Created" 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() {
	body := datadogV2.OAuthClientRegistrationRequest{
		ClientName: "Example MCP Client",
		ClientUri:  datadog.PtrString("https://example.com"),
		GrantTypes: []datadogV2.OAuthClientRegistrationGrantType{
			datadogV2.OAUTHCLIENTREGISTRATIONGRANTTYPE_AUTHORIZATION_CODE,
			datadogV2.OAUTHCLIENTREGISTRATIONGRANTTYPE_REFRESH_TOKEN,
		},
		JwksUri:   datadog.PtrString("https://example.com/.well-known/jwks.json"),
		LogoUri:   datadog.PtrString("https://example.com/logo.png"),
		PolicyUri: datadog.PtrString("https://example.com/privacy"),
		RedirectUris: []string{
			"https://example.com/oauth/callback",
		},
		ResponseTypes: []datadogV2.OAuthClientRegistrationResponseType{
			datadogV2.OAUTHCLIENTREGISTRATIONRESPONSETYPE_CODE,
		},
		Scope:                   datadog.PtrString("openid profile"),
		TokenEndpointAuthMethod: datadog.PtrString("none"),
		TosUri:                  datadog.PtrString("https://example.com/tos"),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.RegisterOAuthClient", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewOAuth2ClientPublicApi(apiClient)
	resp, r, err := api.RegisterOAuthClient(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `OAuth2ClientPublicApi.RegisterOAuthClient`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `OAuth2ClientPublicApi.RegisterOAuthClient`:\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.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" go run "main.go"
// Register an OAuth2 client returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OAuth2ClientPublicApi;
import com.datadog.api.client.v2.model.OAuthClientRegistrationGrantType;
import com.datadog.api.client.v2.model.OAuthClientRegistrationRequest;
import com.datadog.api.client.v2.model.OAuthClientRegistrationResponse;
import com.datadog.api.client.v2.model.OAuthClientRegistrationResponseType;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.registerOAuthClient", true);
    OAuth2ClientPublicApi apiInstance = new OAuth2ClientPublicApi(defaultClient);

    OAuthClientRegistrationRequest body =
        new OAuthClientRegistrationRequest()
            .clientName("Example MCP Client")
            .clientUri("https://example.com")
            .grantTypes(
                Arrays.asList(
                    OAuthClientRegistrationGrantType.AUTHORIZATION_CODE,
                    OAuthClientRegistrationGrantType.REFRESH_TOKEN))
            .jwksUri("https://example.com/.well-known/jwks.json")
            .logoUri("https://example.com/logo.png")
            .policyUri("https://example.com/privacy")
            .redirectUris(Collections.singletonList("https://example.com/oauth/callback"))
            .responseTypes(Collections.singletonList(OAuthClientRegistrationResponseType.CODE))
            .scope("openid profile")
            .tokenEndpointAuthMethod("none")
            .tosUri("https://example.com/tos");

    try {
      OAuthClientRegistrationResponse result = apiInstance.registerOAuthClient(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling OAuth2ClientPublicApi#registerOAuthClient");
      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.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" java "Example.java"
// Register an OAuth2 client returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_o_auth2_client_public::OAuth2ClientPublicAPI;
use datadog_api_client::datadogV2::model::OAuthClientRegistrationGrantType;
use datadog_api_client::datadogV2::model::OAuthClientRegistrationRequest;
use datadog_api_client::datadogV2::model::OAuthClientRegistrationResponseType;

#[tokio::main]
async fn main() {
    let body = OAuthClientRegistrationRequest::new(
        "Example MCP Client".to_string(),
        vec!["https://example.com/oauth/callback".to_string()],
    )
    .client_uri("https://example.com".to_string())
    .grant_types(vec![
        OAuthClientRegistrationGrantType::AUTHORIZATION_CODE,
        OAuthClientRegistrationGrantType::REFRESH_TOKEN,
    ])
    .jwks_uri("https://example.com/.well-known/jwks.json".to_string())
    .logo_uri("https://example.com/logo.png".to_string())
    .policy_uri("https://example.com/privacy".to_string())
    .response_types(vec![OAuthClientRegistrationResponseType::CODE])
    .scope("openid profile".to_string())
    .token_endpoint_auth_method("none".to_string())
    .tos_uri("https://example.com/tos".to_string());
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.RegisterOAuthClient", true);
    let api = OAuth2ClientPublicAPI::with_config(configuration);
    let resp = api.register_o_auth_client(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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" cargo run
/**
 * Register an OAuth2 client returns "Created" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.registerOAuthClient"] = true;
const apiInstance = new v2.OAuth2ClientPublicApi(configuration);

const params: v2.OAuth2ClientPublicApiRegisterOAuthClientRequest = {
  body: {
    clientName: "Example MCP Client",
    clientUri: "https://example.com",
    grantTypes: ["authorization_code", "refresh_token"],
    jwksUri: "https://example.com/.well-known/jwks.json",
    logoUri: "https://example.com/logo.png",
    policyUri: "https://example.com/privacy",
    redirectUris: ["https://example.com/oauth/callback"],
    responseTypes: ["code"],
    scope: "openid profile",
    tokenEndpointAuthMethod: "none",
    tosUri: "https://example.com/tos",
  },
};

apiInstance
  .registerOAuthClient(params)
  .then((data: v2.OAuthClientRegistrationResponse) => {
    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.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" tsc "example.ts"