---
title: Get all aggregated connections
description: Get all aggregated connections.
breadcrumbs: Docs > API > Get all aggregated connections
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Get all aggregated connections

## v2 (latest)

| Datadog site      | API endpoint                                                           |
| ----------------- | ---------------------------------------------------------------------- |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/network/connections/aggregate     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/network/connections/aggregate |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/network/connections/aggregate |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/network/connections/aggregate      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/network/connections/aggregate |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/network/connections/aggregate |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/network/connections/aggregate |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/network/connections/aggregate      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/network/connections/aggregate  |

### Overview

Get all aggregated connections.

This endpoint requires the `network_connections_read` permission.

OAuth apps require the `network_connections_read` authorization [scope](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/scopes.md#cloud-network-monitoring) to access this endpoint.

### Arguments

#### Query Strings

| Field    | Type    | Description                                                                                                                                                                                                                                               |
| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| from     | integer | Unix timestamp (number of seconds since epoch) of the start of the query window. If not provided, the start of the query window is 15 minutes before the `to` timestamp. If neither `from` nor `to` are provided, the query window is `[now - 15m, now]`. |
| to       | integer | Unix timestamp (number of seconds since epoch) of the end of the query window. If not provided, the end of the query window is the current time. If neither `from` nor `to` are provided, the query window is `[now - 15m, now]`.                         |
| group_by | string  | Comma-separated list of fields to group connections by. The maximum number of group_by(s) is 10.                                                                                                                                                          |
| tags     | string  | Comma-separated list of tags to filter connections by.                                                                                                                                                                                                    |
| query    | string  | Free-form search query using AND/OR/NOT operators, wildcards, and parentheses. When provided, takes precedence over the `tags` parameter.                                                                                                                 |
| limit    | integer | The number of connections to be returned. The maximum value is 7500. The default is 100. Default: `100`.                                                                                                                                                  |

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
List of aggregated connections.

| Parent field         | Field                       | Type     | Description                                                                                                                                                                                             |
| -------------------- | --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                      | data                        | [object] | Array of aggregated connection objects.                                                                                                                                                                 |
| data                 | attributes                  | object   | Attributes for an aggregated connection.                                                                                                                                                                |
| attributes           | bytes_sent_by_client        | int64    | The total number of bytes sent by the client over the given period.                                                                                                                                     |
| attributes           | bytes_sent_by_server        | int64    | The total number of bytes sent by the server over the given period.                                                                                                                                     |
| attributes           | group_bys                   | object   | The key, value pairs for each group by.                                                                                                                                                                 |
| additionalProperties | <any-key>                   | [string] | The values for each group by.                                                                                                                                                                           |
| attributes           | packets_sent_by_client      | int64    | The total number of packets sent by the client over the given period.                                                                                                                                   |
| attributes           | packets_sent_by_server      | int64    | The total number of packets sent by the server over the given period.                                                                                                                                   |
| attributes           | rtt_micro_seconds           | int64    | Measured as TCP smoothed round trip time in microseconds (the time between a TCP frame being sent and acknowledged).                                                                                    |
| attributes           | tcp_closed_connections      | int64    | The number of TCP connections in a closed state. Measured in connections per second from the client.                                                                                                    |
| attributes           | tcp_delivered_ce            | int64    | The number of TCP segments acknowledged with the ECN Congestion Experienced (CE) mark, indicating that an upstream router marked packets as experiencing congestion.                                    |
| attributes           | tcp_established_connections | int64    | The number of TCP connections in an established state. Measured in connections per second from the client.                                                                                              |
| attributes           | tcp_probe0_count            | int64    | The number of TCP zero-window probes sent. These probes are sent when the receiver advertises a zero receive window, indicating it cannot accept more data.                                             |
| attributes           | tcp_rcv_ooo_pack            | int64    | The number of TCP packets received out of order. This indicates network-level packet reordering, which can degrade TCP performance by triggering spurious retransmissions and reducing throughput.      |
| attributes           | tcp_recovery_count          | int64    | The number of TCP fast recovery events. Fast recovery retransmits lost segments detected through duplicate ACKs or selective acknowledgment (SACK) without waiting for a retransmission timeout.        |
| attributes           | tcp_refusals                | int64    | The number of TCP connections that were refused by the server. Typically this indicates an attempt to connect to an IP/port that is not receiving connections, or a firewall/security misconfiguration. |
| attributes           | tcp_reord_seen              | int64    | The number of times reordering of sent packets was detected. Reordering detection adjusts the duplicate ACK threshold, preventing spurious retransmissions caused by out-of-order delivery.             |
| attributes           | tcp_resets                  | int64    | The number of TCP connections that were reset by the server.                                                                                                                                            |
| attributes           | tcp_retransmits             | int64    | TCP Retransmits represent detected failures that are retransmitted to ensure delivery. Measured in count of retransmits from the client.                                                                |
| attributes           | tcp_rto_count               | int64    | The number of TCP retransmission timeouts (RTOs). An RTO occurs when an ACK is not received within the estimated round-trip time, forcing the sender to retransmit and halve its congestion window.     |
| attributes           | tcp_timeouts                | int64    | The number of TCP connections that timed out from the perspective of the operating system. This can indicate general connectivity and latency issues.                                                   |
| data                 | id                          | string   | A unique identifier for the aggregated connection based on the group by values.                                                                                                                         |
| data                 | type                        | enum     | Aggregated connection resource type. Allowed enum values: `aggregated_connection`. Default: `aggregated_connection`.                                                                                    |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "bytes_sent_by_client": 100,
        "bytes_sent_by_server": 200,
        "group_bys": {
          "client_team": [
            "networks"
          ],
          "server_service": [
            "hucklebuck"
          ]
        },
        "packets_sent_by_client": 10,
        "packets_sent_by_server": 20,
        "rtt_micro_seconds": 800,
        "tcp_closed_connections": 30,
        "tcp_delivered_ce": 12,
        "tcp_established_connections": 40,
        "tcp_probe0_count": 2,
        "tcp_rcv_ooo_pack": 15,
        "tcp_recovery_count": 8,
        "tcp_refusals": 7,
        "tcp_reord_seen": 4,
        "tcp_resets": 5,
        "tcp_retransmits": 30,
        "tcp_rto_count": 3,
        "tcp_timeouts": 6
      },
      "id": "client_team:networks, server_service:hucklebuck",
      "type": "aggregated_connection"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/network/connections/aggregate" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// Get all aggregated connections 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())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewCloudNetworkMonitoringApi(apiClient)
	resp, r, err := api.GetAggregatedConnections(ctx, *datadogV2.NewGetAggregatedConnectionsOptionalParameters())

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

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Get all aggregated connections returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CloudNetworkMonitoringApi;
import com.datadog.api.client.v2.model.SingleAggregatedConnectionResponseArray;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    CloudNetworkMonitoringApi apiInstance = new CloudNetworkMonitoringApi(defaultClient);

    try {
      SingleAggregatedConnectionResponseArray result = apiInstance.getAggregatedConnections();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling CloudNetworkMonitoringApi#getAggregatedConnections");
      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](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Get all aggregated connections returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloud_network_monitoring_api import CloudNetworkMonitoringApi

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = CloudNetworkMonitoringApi(api_client)
    response = api_instance.get_aggregated_connections()

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Get all aggregated connections returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CloudNetworkMonitoringAPI.new
p api_instance.get_aggregated_connections()
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Get all aggregated connections returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_cloud_network_monitoring::CloudNetworkMonitoringAPI;
use datadog_api_client::datadogV2::api_cloud_network_monitoring::GetAggregatedConnectionsOptionalParams;

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Get all aggregated connections returns "OK" response
 */

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

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.CloudNetworkMonitoringApi(configuration);

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
