---
title: Create org group memberships
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Org Groups
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Create org group memberships{% #create-org-group-memberships %}

{% tab title="v2" %}
**Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                    |
| ----------------- | --------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/org_group_memberships |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/org_group_memberships |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/org_group_memberships      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/org_group_memberships      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/org_group_memberships  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/org_group_memberships |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/org_group_memberships     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/org_group_memberships |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/org_group_memberships |

### Overview

Add a batch of organizations to an existing organization group. This operation is not supported for organization groups with `group_type` set to `config_management`. This is an atomic operation: either all organizations are added or none are. Each request must include between 1 and 100 organizations. Each organization must be identified by a unique `org_uuid` and `org_site` pair, and must be in the same site as the requesting organization. The requesting organization must own the organization group. This endpoint requires the `org_group_write` permission.

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field  | Field                           | Type     | Description                                                                                                                                  |
| ------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|               | data [*required*]          | object   | Data for adding organizations to an org group.                                                                                               |
| data          | attributes [*required*]    | object   | Attributes for adding organizations to an org group.                                                                                         |
| attributes    | orgs [*required*]          | [object] | List of organizations to add. Each request must include between 1 and 100 organizations. Each `org_uuid` and `org_site` pair must be unique. |
| orgs          | org_site [*required*]      | string   | The site of the organization.                                                                                                                |
| orgs          | org_uuid [*required*]      | uuid     | The UUID of the organization.                                                                                                                |
| data          | relationships [*required*] | object   | Relationships for adding organizations to an org group.                                                                                      |
| relationships | org_group [*required*]     | object   | Relationship to a single org group.                                                                                                          |
| org_group     | data [*required*]          | object   | A reference to an org group.                                                                                                                 |
| data          | id [*required*]            | uuid     | The ID of the org group.                                                                                                                     |
| data          | type [*required*]          | enum     | Org groups resource type. Allowed enum values: `org_groups`                                                                                  |
| data          | type [*required*]          | enum     | Org group memberships resource type. Allowed enum values: `org_group_memberships`                                                            |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "orgs": [
        {
          "org_site": "us1",
          "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"
        }
      ]
    },
    "relationships": {
      "org_group": {
        "data": {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789",
          "type": "org_groups"
        }
      }
    },
    "type": "org_group_memberships"
  }
}
```

{% /tab %}

### Response

{% tab title="201" %}
Created
{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="401" %}
Unauthorized
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="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 title="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 %}

{% /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

##### 
                  \## default
# 
 \# Use a Personal Access Token or Service Access Token export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"  \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/org_group_memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "orgs": [
        {
          "org_site": "us1",
          "org_uuid": "c3d4e5f6-a7b8-9012-cdef-012345678901"
        }
      ]
    },
    "relationships": {
      "org_group": {
        "data": {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef0123456789",
          "type": "org_groups"
        }
      }
    },
    "type": "org_group_memberships"
  }
}
EOF 
                
{% /tab %}
