Get the user associated with the current authentication context.
The response includes the user’s profile attributes (name, email, handle,
status, MFA state), along with related resources: the user’s organization,
assigned roles with their granted permissions, and team-scoped roles.
No additional permissions are required beyond valid authentication.
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.
"""
Get current user returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.users_apiimportUsersApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsersApi(api_client)response=api_instance.get_current_user()print(response)
// Get current user returns "OK" responsepackagemainimport("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")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsersApi(apiClient)resp,r,err:=api.GetCurrentUser(ctx)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsersApi.GetCurrentUser`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsersApi.GetCurrentUser`:\n%s\n",responseContent)}
// Get current user returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsersApi;importcom.datadog.api.client.v2.model.UserResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsersApiapiInstance=newUsersApi(defaultClient);try{UserResponseresult=apiInstance.getCurrentUser();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsersApi#getCurrentUser");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get current user returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_users::UsersAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsersAPI::with_config(configuration);letresp=api.get_current_user().await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get current user returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsersApi(configuration);apiInstance.getCurrentUser().then((data: v2.UserResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));