# Source: https://docs.datadoghq.com/api/latest/csm-agents/

# CSM Agents
Datadog Cloud Security Management (CSM) delivers real-time threat detection and continuous configuration audits across your entire cloud infrastructure, all in a unified view for seamless collaboration and faster remediation. Go to <https://docs.datadoghq.com/security/cloud_security_management> to learn more
## [Get all CSM Agents](https://docs.datadoghq.com/api/latest/csm-agents/#get-all-csm-agents)
  * [v2 (latest)](https://docs.datadoghq.com/api/latest/csm-agents/#get-all-csm-agents-v2)


GET https://api.ap1.datadoghq.com/api/v2/csm/onboarding/agentshttps://api.ap2.datadoghq.com/api/v2/csm/onboarding/agentshttps://api.datadoghq.eu/api/v2/csm/onboarding/agentshttps://api.ddog-gov.com/api/v2/csm/onboarding/agentshttps://api.datadoghq.com/api/v2/csm/onboarding/agentshttps://api.us3.datadoghq.com/api/v2/csm/onboarding/agentshttps://api.us5.datadoghq.com/api/v2/csm/onboarding/agents
### Overview
Get the list of all CSM Agents running on your hosts and containers.
### Arguments
#### Query Strings
Name
Type
Description
page
integer
The page index for pagination (zero-based).
size
integer
The number of items to include in a single page.
query
string
A search query string to filter results (for example, `hostname:COMP-T2H4J27423`).
order_direction
enum
The sort direction for results. Use `asc` for ascending or `desc` for descending.  
Allowed enum values: `asc, desc`
### Response
  * [200](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMAgents-200-v2)
  * [403](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMAgents-403-v2)
  * [429](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMAgents-429-v2)


OK
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


Response object that includes a list of CSM Agents.
Field
Type
Description
data
[object]
A list of Agents.
attributes
object
A CSM Agent returned by the API.
agent_version
string
Version of the Datadog Agent.
aws_fargate
string
AWS Fargate details.
cluster_name
[string]
List of cluster names associated with the Agent.
datadog_agent
string
Unique identifier for the Datadog Agent.
ecs_fargate_task_arn
string
ARN of the ECS Fargate task.
envs
[string]
List of environments associated with the Agent.
host_id
int64
ID of the host.
hostname
string
Name of the host.
install_method_installer_version
string
Version of the installer used for installing the Datadog Agent.
install_method_tool
string
Tool used for installing the Datadog Agent.
is_csm_vm_containers_enabled
boolean
Indicates if CSM VM Containers is enabled.
is_csm_vm_hosts_enabled
boolean
Indicates if CSM VM Hosts is enabled.
is_cspm_enabled
boolean
Indicates if CSPM is enabled.
is_cws_enabled
boolean
Indicates if CWS is enabled.
is_cws_remote_configuration_enabled
boolean
Indicates if CWS Remote Configuration is enabled.
is_remote_configuration_enabled
boolean
Indicates if Remote Configuration is enabled.
os
string
Operating system of the host.
id
string
The ID of the Agent.
type
enum
The type of the resource. The value should always be `datadog_agent`. Allowed enum values: `datadog_agent`
default: `datadog_agent`
meta
object
Metadata related to the paginated response.
page_index
int64
The index of the current page in the paginated results.
page_size
int64
The number of items per page in the paginated results.
total_filtered
int64
Total number of items that match the filter criteria.
```
{
  "data": [
    {
      "attributes": {
        "agent_version": "string",
        "aws_fargate": "string",
        "cluster_name": [],
        "datadog_agent": "string",
        "ecs_fargate_task_arn": "string",
        "envs": [],
        "host_id": "integer",
        "hostname": "string",
        "install_method_installer_version": "string",
        "install_method_tool": "string",
        "is_csm_vm_containers_enabled": false,
        "is_csm_vm_hosts_enabled": false,
        "is_cspm_enabled": false,
        "is_cws_enabled": false,
        "is_cws_remote_configuration_enabled": false,
        "is_remote_configuration_enabled": false,
        "os": "string"
      },
      "id": "fffffc5505f6a006fdf7cf5aae053653",
      "type": "datadog_agent"
    }
  ],
  "meta": {
    "page_index": 0,
    "page_size": 10,
    "total_filtered": 128697
  }
}
```

Copy
Not Authorized
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


API error response.
Expand All
Field
Type
Description
errors [_required_]
[string]
A list of errors.
```
{
  "errors": [
    "Bad Request"
  ]
}
```

Copy
Too many requests
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


API error response.
Expand All
Field
Type
Description
errors [_required_]
[string]
A list of errors.
```
{
  "errors": [
    "Bad Request"
  ]
}
```

Copy
### Code Example
  * [Curl](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=curl)
  * [Python](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=python)
  * [Ruby](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=ruby)
  * [Go](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=go)
  * [Java](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=java)
  * [Rust](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=rust)
  * [Typescript](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=typescript)


#####  Get all CSM Agents
Copy
```
                  # 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.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/csm/onboarding/agents" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"  

                
```

#####  Get all CSM Agents
```
"""
Get all CSM Agents returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.csm_agents_api import CSMAgentsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CSMAgentsApi(api_client)
    response = api_instance.list_all_csm_agents()

    print(response)

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=python) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"


```

#####  Get all CSM Agents
```
# Get all CSM Agents returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CSMAgentsAPI.new
p api_instance.list_all_csm_agents()

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=ruby) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"


```

#####  Get all CSM Agents
```
// Get all CSM Agents 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCSMAgentsApi(apiClient)
	resp, r, err := api.ListAllCSMAgents(ctx, *datadogV2.NewListAllCSMAgentsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CSMAgentsApi.ListAllCSMAgents`:\n%s\n", responseContent)
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=go) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"


```

#####  Get all CSM Agents
```
// Get all CSM Agents returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CsmAgentsApi;
import com.datadog.api.client.v2.model.CsmAgentsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CsmAgentsApi apiInstance = new CsmAgentsApi(defaultClient);

    try {
      CsmAgentsResponse result = apiInstance.listAllCSMAgents();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CsmAgentsApi#listAllCSMAgents");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=java) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"


```

#####  Get all CSM Agents
```
// Get all CSM Agents returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_csm_agents::CSMAgentsAPI;
use datadog_api_client::datadogV2::api_csm_agents::ListAllCSMAgentsOptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CSMAgentsAPI::with_config(configuration);
    let resp = api
        .list_all_csm_agents(ListAllCSMAgentsOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=rust) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run


```

#####  Get all CSM Agents
```
/**
 * Get all CSM Agents returns "OK" response
 */

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

const configuration = client.createConfiguration();
const apiInstance = new v2.CSMAgentsApi(configuration);

apiInstance
  .listAllCSMAgents()
  .then((data: v2.CsmAgentsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=typescript) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"


```

* * *
## [Get all CSM Serverless Agents](https://docs.datadoghq.com/api/latest/csm-agents/#get-all-csm-serverless-agents)
  * [v2 (latest)](https://docs.datadoghq.com/api/latest/csm-agents/#get-all-csm-serverless-agents-v2)


GET https://api.ap1.datadoghq.com/api/v2/csm/onboarding/serverless/agentshttps://api.ap2.datadoghq.com/api/v2/csm/onboarding/serverless/agentshttps://api.datadoghq.eu/api/v2/csm/onboarding/serverless/agentshttps://api.ddog-gov.com/api/v2/csm/onboarding/serverless/agentshttps://api.datadoghq.com/api/v2/csm/onboarding/serverless/agentshttps://api.us3.datadoghq.com/api/v2/csm/onboarding/serverless/agentshttps://api.us5.datadoghq.com/api/v2/csm/onboarding/serverless/agents
### Overview
Get the list of all CSM Serverless Agents running on your hosts and containers.
### Arguments
#### Query Strings
Name
Type
Description
page
integer
The page index for pagination (zero-based).
size
integer
The number of items to include in a single page.
query
string
A search query string to filter results (for example, `hostname:COMP-T2H4J27423`).
order_direction
enum
The sort direction for results. Use `asc` for ascending or `desc` for descending.  
Allowed enum values: `asc, desc`
### Response
  * [200](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMServerlessAgents-200-v2)
  * [403](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMServerlessAgents-403-v2)
  * [429](https://docs.datadoghq.com/api/latest/csm-agents/#ListAllCSMServerlessAgents-429-v2)


OK
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


Response object that includes a list of CSM Agents.
Field
Type
Description
data
[object]
A list of Agents.
attributes
object
A CSM Agent returned by the API.
agent_version
string
Version of the Datadog Agent.
aws_fargate
string
AWS Fargate details.
cluster_name
[string]
List of cluster names associated with the Agent.
datadog_agent
string
Unique identifier for the Datadog Agent.
ecs_fargate_task_arn
string
ARN of the ECS Fargate task.
envs
[string]
List of environments associated with the Agent.
host_id
int64
ID of the host.
hostname
string
Name of the host.
install_method_installer_version
string
Version of the installer used for installing the Datadog Agent.
install_method_tool
string
Tool used for installing the Datadog Agent.
is_csm_vm_containers_enabled
boolean
Indicates if CSM VM Containers is enabled.
is_csm_vm_hosts_enabled
boolean
Indicates if CSM VM Hosts is enabled.
is_cspm_enabled
boolean
Indicates if CSPM is enabled.
is_cws_enabled
boolean
Indicates if CWS is enabled.
is_cws_remote_configuration_enabled
boolean
Indicates if CWS Remote Configuration is enabled.
is_remote_configuration_enabled
boolean
Indicates if Remote Configuration is enabled.
os
string
Operating system of the host.
id
string
The ID of the Agent.
type
enum
The type of the resource. The value should always be `datadog_agent`. Allowed enum values: `datadog_agent`
default: `datadog_agent`
meta
object
Metadata related to the paginated response.
page_index
int64
The index of the current page in the paginated results.
page_size
int64
The number of items per page in the paginated results.
total_filtered
int64
Total number of items that match the filter criteria.
```
{
  "data": [
    {
      "attributes": {
        "agent_version": "string",
        "aws_fargate": "string",
        "cluster_name": [],
        "datadog_agent": "string",
        "ecs_fargate_task_arn": "string",
        "envs": [],
        "host_id": "integer",
        "hostname": "string",
        "install_method_installer_version": "string",
        "install_method_tool": "string",
        "is_csm_vm_containers_enabled": false,
        "is_csm_vm_hosts_enabled": false,
        "is_cspm_enabled": false,
        "is_cws_enabled": false,
        "is_cws_remote_configuration_enabled": false,
        "is_remote_configuration_enabled": false,
        "os": "string"
      },
      "id": "fffffc5505f6a006fdf7cf5aae053653",
      "type": "datadog_agent"
    }
  ],
  "meta": {
    "page_index": 0,
    "page_size": 10,
    "total_filtered": 128697
  }
}
```

Copy
Not Authorized
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


API error response.
Expand All
Field
Type
Description
errors [_required_]
[string]
A list of errors.
```
{
  "errors": [
    "Bad Request"
  ]
}
```

Copy
Too many requests
  * [Model](https://docs.datadoghq.com/api/latest/csm-agents/)
  * [Example](https://docs.datadoghq.com/api/latest/csm-agents/)


API error response.
Expand All
Field
Type
Description
errors [_required_]
[string]
A list of errors.
```
{
  "errors": [
    "Bad Request"
  ]
}
```

Copy
### Code Example
  * [Curl](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=curl)
  * [Python](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=python)
  * [Ruby](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=ruby)
  * [Go](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=go)
  * [Java](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=java)
  * [Rust](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=rust)
  * [Typescript](https://docs.datadoghq.com/api/latest/csm-agents/?code-lang=typescript)


#####  Get all CSM Serverless Agents
Copy
```
                  # 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.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/csm/onboarding/serverless/agents" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"  

                
```

#####  Get all CSM Serverless Agents
```
"""
Get all CSM Serverless Agents returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.csm_agents_api import CSMAgentsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CSMAgentsApi(api_client)
    response = api_instance.list_all_csm_serverless_agents()

    print(response)

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=python) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"


```

#####  Get all CSM Serverless Agents
```
# Get all CSM Serverless Agents returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CSMAgentsAPI.new
p api_instance.list_all_csm_serverless_agents()

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=ruby) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"


```

#####  Get all CSM Serverless Agents
```
// Get all CSM Serverless Agents 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCSMAgentsApi(apiClient)
	resp, r, err := api.ListAllCSMServerlessAgents(ctx, *datadogV2.NewListAllCSMServerlessAgentsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `CSMAgentsApi.ListAllCSMServerlessAgents`:\n%s\n", responseContent)
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=go) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"


```

#####  Get all CSM Serverless Agents
```
// Get all CSM Serverless Agents returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CsmAgentsApi;
import com.datadog.api.client.v2.model.CsmAgentsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    CsmAgentsApi apiInstance = new CsmAgentsApi(defaultClient);

    try {
      CsmAgentsResponse result = apiInstance.listAllCSMServerlessAgents();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CsmAgentsApi#listAllCSMServerlessAgents");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=java) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"


```

#####  Get all CSM Serverless Agents
```
// Get all CSM Serverless Agents returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_csm_agents::CSMAgentsAPI;
use datadog_api_client::datadogV2::api_csm_agents::ListAllCSMServerlessAgentsOptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = CSMAgentsAPI::with_config(configuration);
    let resp = api
        .list_all_csm_serverless_agents(ListAllCSMServerlessAgentsOptionalParams::default())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=rust) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run


```

#####  Get all CSM Serverless Agents
```
/**
 * Get all CSM Serverless Agents returns "OK" response
 */

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

const configuration = client.createConfiguration();
const apiInstance = new v2.CSMAgentsApi(configuration);

apiInstance
  .listAllCSMServerlessAgents()
  .then((data: v2.CsmAgentsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

```

Copy
#### Instructions
First [install the library and its dependencies](https://docs.datadoghq.com/api/latest/?code-lang=typescript) 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.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"


```

* * *
![](https://t.co/1/i/adsct?bci=4&dv=UTC%26en-US%26Google%20Inc.%26Linux%20x86_64%26255%261080%26600%264%2624%261080%26600%260%26na&eci=3&event=%7B%7D&event_id=80a9d9be-c39f-43ee-b691-98b3e82828b6&integration=gtm&p_id=Twitter&p_user_id=0&pl_id=e39ac4b2-4b81-4846-aeec-4ba150899c65&pt=CSM%20Agents&tw_document_href=https%3A%2F%2Fdocs.datadoghq.com%2Fapi%2Flatest%2Fcsm-agents%2F&tw_iframe_status=0&txn_id=nui23&type=javascript&version=2.3.35)![](https://analytics.twitter.com/1/i/adsct?bci=4&dv=UTC%26en-US%26Google%20Inc.%26Linux%20x86_64%26255%261080%26600%264%2624%261080%26600%260%26na&eci=3&event=%7B%7D&event_id=80a9d9be-c39f-43ee-b691-98b3e82828b6&integration=gtm&p_id=Twitter&p_user_id=0&pl_id=e39ac4b2-4b81-4846-aeec-4ba150899c65&pt=CSM%20Agents&tw_document_href=https%3A%2F%2Fdocs.datadoghq.com%2Fapi%2Flatest%2Fcsm-agents%2F&tw_iframe_status=0&txn_id=nui23&type=javascript&version=2.3.35)![](https://id.rlcdn.com/464526.gif)
![](https://bat.bing.com/action/0?ti=4061438&Ver=2&mid=f8d6efd1-6d0e-4d51-8d85-af3dda25f374&bo=2&sid=4fe86b30f0bf11f0874679e4dad5e713&vid=4fe8abf0f0bf11f088d28d16ecb91adf&vids=1&msclkid=N&pi=918639831&lg=en-US&sw=1080&sh=600&sc=24&tl=CSM%20Agents&p=https%3A%2F%2Fdocs.datadoghq.com%2Fapi%2Flatest%2Fcsm-agents%2F&r=&lt=1305&evt=pageLoad&sv=2&asc=G&cdb=AQAS&rn=301957)