---
title: Get team hierarchy members
description: List the direct and inherited members of a team, deduplicated by user.
breadcrumbs: Documentación > API > Get team hierarchy members
---

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

# Get team hierarchy members

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

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

### Overview

List the direct and inherited members of a team, deduplicated by user.
Members of descendant teams are included unless `filter[is_direct_only]` is true.
Datadog support users are always excluded.

Use `page[number]` and `page[size]` to paginate through the results.
Invalid query parameters return a JSON:API error with status 400.
Invalid or unknown team UUIDs return status 404.

This endpoint requires the `teams_read` permission.

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

### Arguments

#### Path Parameters

| Field                | Type   | Description                      |
| -------------------- | ------ | -------------------------------- |
| team_id [*required*] | string | UUID of the requested root team. |

#### Query Strings

| Field                            | Type    | Description                                                                                                                                                                                                                                                                                            |
| -------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| filter[is_direct_only]           | boolean | Return only direct members. By default, members inherited from descendant teams are also returned. Default: `false`.                                                                                                                                                                                   |
| filter[include_service_accounts] | boolean | Include service accounts. Datadog support users are always excluded. Default: `true`.                                                                                                                                                                                                                  |
| filter[keyword]                  | string  | Filter by a case-insensitive substring of the user name, handle, or email.                                                                                                                                                                                                                             |
| include                          | string  | Comma-separated resources to include: `user` and `team`. The included team is the requested team. Whitespace is trimmed, and duplicate or empty entries are ignored.                                                                                                                                   |
| sort                             | string  | Comma-separated sort fields: `name`, `handle`, `is_direct`, and `provisioned_by`. Fields are applied in order, each optionally prefixed with `-` for descending order. By default, team admins come first, followed by other direct members, then inherited members, sorted by name within each group. |
| page[number]                     | integer | Zero-based page number. Negative values become 0. Defaults to 0. Default: `0`.                                                                                                                                                                                                                         |
| page[size]                       | integer | Requested number of members per page. Defaults to and maxes out at 100. Default: `100`.                                                                                                                                                                                                                |

### Response

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

{% tabs %}
{% tab label="Model" %}
Direct and inherited members of the requested team.

| Parent field        | Field                          | Type      | Description                                                                                                                                                                                                                                                                                                                                |
| ------------------- | ------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                     | data [*required*]              | [object]  | Membership relationships for users who belong to the requested team or inherit membership through its descendant teams. Each user appears once, even if they belong to multiple teams in the hierarchy. Each relationship identifies the user and requested team, and indicates whether the user is a direct member of the requested team. |
| data                | attributes [*required*]        | object    | Membership attributes relative to the requested team.                                                                                                                                                                                                                                                                                      |
| attributes          | direct_role [*required*]       | string    | Role on the requested team: admin or member. Null for inherited members.                                                                                                                                                                                                                                                                   |
| attributes          | is_direct [*required*]         | boolean   | Whether the user belongs directly to the requested team.                                                                                                                                                                                                                                                                                   |
| attributes          | provisioned_by [*required*]    | string    | Membership provisioner. Null for inherited members.                                                                                                                                                                                                                                                                                        |
| attributes          | provisioned_by_id [*required*] | string    | Identifier supplied by the membership provisioner. Null when unavailable or for inherited members.                                                                                                                                                                                                                                         |
| data                | id [*required*]                | string    | Relationship identifier containing the team UUID and user UUID.                                                                                                                                                                                                                                                                            |
| data                | relationships [*required*]     | object    | User and requested team linkage.                                                                                                                                                                                                                                                                                                           |
| relationships       | team [*required*]              | object    | Linkage to the requested team.                                                                                                                                                                                                                                                                                                             |
| team                | data [*required*]              | object    | Team resource identifier.                                                                                                                                                                                                                                                                                                                  |
| data                | id [*required*]                | uuid      | UUID of the team.                                                                                                                                                                                                                                                                                                                          |
| data                | type [*required*]              | enum      | Requested team resource type. Allowed enum values: `teams`. Default: `teams`.                                                                                                                                                                                                                                                              |
| relationships       | user [*required*]              | object    | Linkage to the user.                                                                                                                                                                                                                                                                                                                       |
| user                | data [*required*]              | object    | User resource identifier.                                                                                                                                                                                                                                                                                                                  |
| data                | id [*required*]                | uuid      | UUID of the user.                                                                                                                                                                                                                                                                                                                          |
| data                | type [*required*]              | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                                                                                                                                                                                                       |
| data                | type [*required*]              | enum      | Team hierarchy membership resource type. Allowed enum values: `user_team_relationship`. Default: `user_team_relationship`.                                                                                                                                                                                                                 |
|                     | included                       | [<oneOf>] | Requested users and the team. May be absent when the result is empty, even if requested.                                                                                                                                                                                                                                                   |
| included            | <type=users>                   | object    | A user included in the hierarchy members response.                                                                                                                                                                                                                                                                                         |
| <type=users>        | attributes [*required*]        | object    | Attributes of user object returned by the API.                                                                                                                                                                                                                                                                                             |
| attributes          | created_at                     | date-time | The ISO 8601 timestamp of when the user account was created.                                                                                                                                                                                                                                                                               |
| attributes          | disabled                       | boolean   | Whether the user account is deactivated. Disabled users cannot log in.                                                                                                                                                                                                                                                                     |
| attributes          | email                          | string    | The email address of the user, used for login and notifications.                                                                                                                                                                                                                                                                           |
| attributes          | handle                         | string    | The unique handle (username) of the user, typically matching their email prefix.                                                                                                                                                                                                                                                           |
| attributes          | icon                           | string    | URL of the user's profile icon, typically a Gravatar URL derived from the email address.                                                                                                                                                                                                                                                   |
| attributes          | last_login_time                | date-time | The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in. Read-only.                                                                                                                                                                                                                                |
| attributes          | mfa_enabled                    | boolean   | Whether multi-factor authentication (MFA) is enabled for the user's account. Read-only.                                                                                                                                                                                                                                                    |
| attributes          | modified_at                    | date-time | The ISO 8601 timestamp of when the user account was last modified.                                                                                                                                                                                                                                                                         |
| attributes          | name                           | string    | The full display name of the user as shown in the Datadog UI.                                                                                                                                                                                                                                                                              |
| attributes          | service_account                | boolean   | Whether this is a service account rather than a human user. Service accounts are used for programmatic API access.                                                                                                                                                                                                                         |
| attributes          | status                         | string    | The current status of the user account (for example, `Active`, `Pending`, or `Disabled`).                                                                                                                                                                                                                                                  |
| attributes          | title                          | string    | The job title of the user (for example, "Senior Engineer" or "Product Manager").                                                                                                                                                                                                                                                           |
| attributes          | uuid                           | string    | The globally unique identifier (UUID) of the user. Read-only.                                                                                                                                                                                                                                                                              |
| attributes          | verified                       | boolean   | Whether the user's email address has been verified.                                                                                                                                                                                                                                                                                        |
| <type=users>        | id [*required*]                | uuid      | UUID of the user.                                                                                                                                                                                                                                                                                                                          |
| <type=users>        | type [*required*]              | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                                                                                                                                                                                                       |
| included            | <type=teams>                   | object    | The requested team, included at most once. Descendant teams are not included.                                                                                                                                                                                                                                                              |
| <type=teams>        | attributes                     | object    | Available attributes of the requested team.                                                                                                                                                                                                                                                                                                |
| attributes          | handle                         | string    | Handle of the team.                                                                                                                                                                                                                                                                                                                        |
| attributes          | name                           | string    | Name of the team.                                                                                                                                                                                                                                                                                                                          |
| <type=teams>        | id [*required*]                | uuid      | UUID of the requested team.                                                                                                                                                                                                                                                                                                                |
| <type=teams>        | type [*required*]              | enum      | Requested team resource type. Allowed enum values: `teams`. Default: `teams`.                                                                                                                                                                                                                                                              |
|                     | links [*required*]             | object    | Page navigation links. Unavailable links are omitted.                                                                                                                                                                                                                                                                                      |
| links               | first                          | string    | First page URL.                                                                                                                                                                                                                                                                                                                            |
| links               | last                           | string    | Last page URL.                                                                                                                                                                                                                                                                                                                             |
| links               | next                           | string    | Next page URL.                                                                                                                                                                                                                                                                                                                             |
| links               | prev                           | string    | Previous page URL.                                                                                                                                                                                                                                                                                                                         |
| links               | self                           | string    | Current page URL.                                                                                                                                                                                                                                                                                                                          |
|                     | meta [*required*]              | object    | Pagination metadata for the filtered members.                                                                                                                                                                                                                                                                                              |
| meta                | page [*required*]              | <oneOf>   | Pagination metadata for the selected pagination mode.                                                                                                                                                                                                                                                                                      |
| page                | <type=offset_limit>            | object    | Pagination metadata using offset and limit.                                                                                                                                                                                                                                                                                                |
| <type=offset_limit> | first_offset [*required*]      | int64     | First offset.                                                                                                                                                                                                                                                                                                                              |
| <type=offset_limit> | last_offset [*required*]       | int64     | Last offset. Null when unavailable.                                                                                                                                                                                                                                                                                                        |
| <type=offset_limit> | limit [*required*]             | int64     | Maximum number of members per page.                                                                                                                                                                                                                                                                                                        |
| <type=offset_limit> | next_offset [*required*]       | int64     | Next offset. Null when unavailable.                                                                                                                                                                                                                                                                                                        |
| <type=offset_limit> | offset [*required*]            | int64     | Current offset.                                                                                                                                                                                                                                                                                                                            |
| <type=offset_limit> | prev_offset [*required*]       | int64     | Previous offset. Null when unavailable.                                                                                                                                                                                                                                                                                                    |
| <type=offset_limit> | total [*required*]             | int64     | Total number of members matching the filters.                                                                                                                                                                                                                                                                                              |
| <type=offset_limit> | type [*required*]              | enum      | Pagination mode. Allowed enum values: `offset_limit`. Default: `offset_limit`.                                                                                                                                                                                                                                                             |
| page                | <type=number_size>             | object    | Pagination metadata using number and size.                                                                                                                                                                                                                                                                                                 |
| <type=number_size>  | first_number [*required*]      | int64     | First page number.                                                                                                                                                                                                                                                                                                                         |
| <type=number_size>  | last_number [*required*]       | int64     | Last page number. Null when unavailable.                                                                                                                                                                                                                                                                                                   |
| <type=number_size>  | next_number [*required*]       | int64     | Next page number. Null when unavailable.                                                                                                                                                                                                                                                                                                   |
| <type=number_size>  | number [*required*]            | int64     | Current zero-based page number.                                                                                                                                                                                                                                                                                                            |
| <type=number_size>  | prev_number [*required*]       | int64     | Previous page number. Null when unavailable.                                                                                                                                                                                                                                                                                               |
| <type=number_size>  | size [*required*]              | int64     | Maximum number of members per page.                                                                                                                                                                                                                                                                                                        |
| <type=number_size>  | total [*required*]             | int64     | Total number of members matching the filters.                                                                                                                                                                                                                                                                                              |
| <type=number_size>  | type [*required*]              | enum      | Pagination mode. Allowed enum values: `number_size`. Default: `number_size`.                                                                                                                                                                                                                                                               |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "direct_role": "member",
        "is_direct": true,
        "provisioned_by": "manual",
        "provisioned_by_id": "00000000-0000-0000-0000-000000000003"
      },
      "id": "UserTeamRelationship:692e8073-12c4-4c71-8408-5090bd44c9c8:00000000-0000-0000-0000-000000000001",
      "relationships": {
        "team": {
          "data": {
            "id": "692e8073-12c4-4c71-8408-5090bd44c9c8",
            "type": "teams"
          }
        },
        "user": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000001",
            "type": "users"
          }
        }
      },
      "type": "user_team_relationship"
    }
  ],
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "last_login_time": "2019-09-19T10:00:00.000Z",
        "mfa_enabled": false,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "service_account": false,
        "status": "string",
        "title": "string",
        "uuid": "string",
        "verified": false
      },
      "id": "00000000-0000-0000-0000-000000000001",
      "type": "users"
    }
  ],
  "links": {
    "first": "https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100",
    "last": "https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100",
    "next": "https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100",
    "prev": "https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100",
    "self": "https://api.datadoghq.com/api/v2/team/692e8073-12c4-4c71-8408-5090bd44c9c8/members?page%5Bnumber%5D=0&page%5Bsize%5D=100"
  },
  "meta": {
    "page": {
      "first_offset": 0,
      "last_offset": 0,
      "limit": 100,
      "next_offset": null,
      "offset": 0,
      "prev_offset": null,
      "total": 2,
      "type": "offset_limit"
    }
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

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

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="401" %}
Unauthorized

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "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="404" %}
Not Found

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "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
# Path parameters
export team_id="692e8073-12c4-4c71-8408-5090bd44c9c8"

# 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/team/${team_id}/members" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}
{% /tabs %}
