---
title: Get a team hierarchy link
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Teams
---

# Get a team hierarchy link{% #get-a-team-hierarchy-link %}
Copy pageCopied
{% tab title="v2" %}

| Datadog site      | API endpoint                                                            |
| ----------------- | ----------------------------------------------------------------------- |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/team-hierarchy-links/{link_id} |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/team-hierarchy-links/{link_id} |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/team-hierarchy-links/{link_id}      |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/team-hierarchy-links/{link_id}      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/team-hierarchy-links/{link_id}  |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/team-hierarchy-links/{link_id}     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/team-hierarchy-links/{link_id} |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/team-hierarchy-links/{link_id} |

### Overview

Get a single team hierarchy link for the given link_id. This endpoint requires the `teams_read` permission.

OAuth apps require the `teams_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#teams) to access this endpoint.



### Arguments

#### Path Parameters

| Name                      | Type   | Description                          |
| ------------------------- | ------ | ------------------------------------ |
| link_id [*required*] | string | The team hierarchy link's identifier |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Team hierarchy link response

| Parent field  | Field                            | Type      | Description                                                                                                                        |
| ------------- | -------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|               | data                             | object    | Team hierarchy link                                                                                                                |
| data          | attributes [*required*]     | object    | Team hierarchy link attributes                                                                                                     |
| attributes    | created_at [*required*]     | date-time | Timestamp when the team hierarchy link was created                                                                                 |
| attributes    | provisioned_by [*required*] | string    | The provisioner of the team hierarchy link                                                                                         |
| data          | id [*required*]             | string    | The team hierarchy link's identifier                                                                                               |
| data          | relationships                    | object    | Team hierarchy link relationships                                                                                                  |
| relationships | parent_team [*required*]    | object    | Team hierarchy link team relationship                                                                                              |
| parent_team   | data [*required*]           | object    | Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link.          |
| data          | attributes                       | object    | Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. |
| attributes    | avatar                           | string    | The team's avatar                                                                                                                  |
| attributes    | banner                           | int64     | The team's banner                                                                                                                  |
| attributes    | handle [*required*]         | string    | The team's handle                                                                                                                  |
| attributes    | is_managed                       | boolean   | Whether the team is managed                                                                                                        |
| attributes    | is_open_membership               | boolean   | Whether the team has open membership                                                                                               |
| attributes    | link_count                       | int64     | The number of links for the team                                                                                                   |
| attributes    | name [*required*]           | string    | The team's name                                                                                                                    |
| attributes    | summary                          | string    | The team's summary                                                                                                                 |
| attributes    | user_count                       | int64     | The number of users in the team                                                                                                    |
| data          | id [*required*]             | string    | The team's identifier                                                                                                              |
| data          | type [*required*]           | enum      | Team type Allowed enum values: `team`                                                                                              |
| relationships | sub_team [*required*]       | object    | Team hierarchy link team relationship                                                                                              |
| sub_team      | data [*required*]           | object    | Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link.          |
| data          | attributes                       | object    | Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. |
| attributes    | avatar                           | string    | The team's avatar                                                                                                                  |
| attributes    | banner                           | int64     | The team's banner                                                                                                                  |
| attributes    | handle [*required*]         | string    | The team's handle                                                                                                                  |
| attributes    | is_managed                       | boolean   | Whether the team is managed                                                                                                        |
| attributes    | is_open_membership               | boolean   | Whether the team has open membership                                                                                               |
| attributes    | link_count                       | int64     | The number of links for the team                                                                                                   |
| attributes    | name [*required*]           | string    | The team's name                                                                                                                    |
| attributes    | summary                          | string    | The team's summary                                                                                                                 |
| attributes    | user_count                       | int64     | The number of users in the team                                                                                                    |
| data          | id [*required*]             | string    | The team's identifier                                                                                                              |
| data          | type [*required*]           | enum      | Team type Allowed enum values: `team`                                                                                              |
| data          | type [*required*]           | enum      | Team hierarchy link type Allowed enum values: `team_hierarchy_links`                                                               |
|               | included                         | [object]  | Included teams                                                                                                                     |
| included      | attributes                       | object    | Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. |
| attributes    | avatar                           | string    | The team's avatar                                                                                                                  |
| attributes    | banner                           | int64     | The team's banner                                                                                                                  |
| attributes    | handle [*required*]         | string    | The team's handle                                                                                                                  |
| attributes    | is_managed                       | boolean   | Whether the team is managed                                                                                                        |
| attributes    | is_open_membership               | boolean   | Whether the team has open membership                                                                                               |
| attributes    | link_count                       | int64     | The number of links for the team                                                                                                   |
| attributes    | name [*required*]           | string    | The team's name                                                                                                                    |
| attributes    | summary                          | string    | The team's summary                                                                                                                 |
| attributes    | user_count                       | int64     | The number of users in the team                                                                                                    |
| included      | id [*required*]             | string    | The team's identifier                                                                                                              |
| included      | type [*required*]           | enum      | Team type Allowed enum values: `team`                                                                                              |
|               | links                            | object    | When querying team hierarchy links, a set of links for navigation between different pages is included                              |
| links         | first                            | string    | Link to the first page.                                                                                                            |
| links         | last                             | string    | Link to the last page.                                                                                                             |
| links         | next                             | string    | Link to the next page.                                                                                                             |
| links         | prev                             | string    | Link to the previous page.                                                                                                         |
| links         | self                             | string    | Link to the current object.                                                                                                        |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "created_at": "",
      "provisioned_by": "system"
    },
    "id": "b8626d7e-cedd-11eb-abf5-da7ad0900001",
    "relationships": {
      "parent_team": {
        "data": {
          "attributes": {
            "avatar": "string",
            "banner": "integer",
            "handle": "team-handle",
            "is_managed": false,
            "is_open_membership": false,
            "link_count": "integer",
            "name": "Team Name",
            "summary": "string",
            "user_count": "integer"
          },
          "id": "692e8073-12c4-4c71-8408-5090bd44c9c8",
          "type": "team"
        }
      },
      "sub_team": {
        "data": {
          "attributes": {
            "avatar": "string",
            "banner": "integer",
            "handle": "team-handle",
            "is_managed": false,
            "is_open_membership": false,
            "link_count": "integer",
            "name": "Team Name",
            "summary": "string",
            "user_count": "integer"
          },
          "id": "692e8073-12c4-4c71-8408-5090bd44c9c8",
          "type": "team"
        }
      }
    },
    "type": "team_hierarchy_links"
  },
  "included": [
    {
      "attributes": {
        "avatar": "string",
        "banner": "integer",
        "handle": "team-handle",
        "is_managed": false,
        "is_open_membership": false,
        "link_count": "integer",
        "name": "Team Name",
        "summary": "string",
        "user_count": "integer"
      },
      "id": "692e8073-12c4-4c71-8408-5090bd44c9c8",
      "type": "team"
    }
  ],
  "links": {
    "first": "string",
    "last": "string",
    "next": "string",
    "prev": "string",
    "self": "string"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="404" %}
API error response.
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \# Path parameters export link_id="CHANGE_ME" \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/team-hierarchy-links/${link_id}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Get a team hierarchy link returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.teams_api import TeamsApi

# there is a valid "team_hierarchy_link" in the system
TEAM_HIERARCHY_LINK_DATA_ID = environ["TEAM_HIERARCHY_LINK_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = TeamsApi(api_client)
    response = api_instance.get_team_hierarchy_link(
        link_id=TEAM_HIERARCHY_LINK_DATA_ID,
    )

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# Get a team hierarchy link returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::TeamsAPI.new

# there is a valid "team_hierarchy_link" in the system
TEAM_HIERARCHY_LINK_DATA_ID = ENV["TEAM_HIERARCHY_LINK_DATA_ID"]
p api_instance.get_team_hierarchy_link(TEAM_HIERARCHY_LINK_DATA_ID)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// Get a team hierarchy link 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() {
	// there is a valid "team_hierarchy_link" in the system
	TeamHierarchyLinkDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewTeamsApi(apiClient)
	resp, r, err := api.GetTeamHierarchyLink(ctx, TeamHierarchyLinkDataID)

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

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

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// Get a team hierarchy link returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.TeamsApi;
import com.datadog.api.client.v2.model.TeamHierarchyLinkResponse;

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

    // there is a valid "team_hierarchy_link" in the system
    String TEAM_HIERARCHY_LINK_DATA_ID = System.getenv("TEAM_HIERARCHY_LINK_DATA_ID");

    try {
      TeamHierarchyLinkResponse result =
          apiInstance.getTeamHierarchyLink(TEAM_HIERARCHY_LINK_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling TeamsApi#getTeamHierarchyLink");
      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://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// Get a team hierarchy link returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_teams::TeamsAPI;

#[tokio::main]
async fn main() {
    // there is a valid "team_hierarchy_link" in the system
    let team_hierarchy_link_data_id = std::env::var("TEAM_HIERARCHY_LINK_DATA_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = TeamsAPI::with_config(configuration);
    let resp = api
        .get_team_hierarchy_link(team_hierarchy_link_data_id.clone())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * Get a team hierarchy link returns "OK" response
 */

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

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

// there is a valid "team_hierarchy_link" in the system
const TEAM_HIERARCHY_LINK_DATA_ID = process.env
  .TEAM_HIERARCHY_LINK_DATA_ID as string;

const params: v2.TeamsApiGetTeamHierarchyLinkRequest = {
  linkId: TEAM_HIERARCHY_LINK_DATA_ID,
};

apiInstance
  .getTeamHierarchyLink(params)
  .then((data: v2.TeamHierarchyLinkResponse) => {
    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://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"
{% /tab %}
