1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
---
stage: Data Stores
group: Tenant Scale
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
# LDAP group links
DETAILS:
**Tier:** Premium, Ultimate
**Offering:** Self-managed
List, add, and delete [LDAP group links](../user/group/access_and_permissions.md#manage-group-memberships-with-ldap).
## List LDAP group links
Lists LDAP group links.
```plaintext
GET /groups/:id/ldap_group_links
```
Supported attributes:
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-paths). |
Example request:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/4/ldap_group_links"
```
Example response:
```json
[
{
"cn": "group1",
"group_access": 40,
"provider": "ldapmain",
"filter": null,
"member_role_id": null
},
{
"cn": "group2",
"group_access": 10,
"provider": "ldapmain",
"filter": null,
"member_role_id": null
}
]
```
## Add an LDAP group link with CN or filter
Adds an LDAP group link using a CN or filter.
```plaintext
POST /groups/:id/ldap_group_links
```
Supported attributes:
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-paths). |
| `group_access` | integer | yes | [Role (`access_level`)](members.md#roles) for members of the LDAP group. |
| `provider` | string | yes | LDAP provider ID for the LDAP group link. |
| `cn` | string | yes/no | The CN of an LDAP group. Provide either a `cn` or a `filter`, but not both. |
| `filter` | string | yes/no | The LDAP filter for the group. Provide either a `cn` or a `filter`, but not both. |
| `member_role_id` | integer | no | The ID of the [member role](member_roles.md). Ultimate only. |
Example request:
```shell
curl --request POST \
--header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{"group_access": 40, "provider": "ldapmain", "cn": "group2"}' \
--url "https://gitlab.example.com/api/v4/groups/4/ldap_group_links"
```
Example response:
```json
{
"cn": "group2",
"group_access": 40,
"provider": "main",
"filter": null,
"member_role_id": null
}
```
## Delete an LDAP group link with CN or filter
Deletes an LDAP group link using a CN or filter.
```plaintext
DELETE /groups/:id/ldap_group_links
```
Supported attributes:
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-paths) |
| `provider` | string | yes | LDAP provider ID for the LDAP group link. |
| `cn` | string | yes/no | The CN of an LDAP group. Provide either a `cn` or a `filter`, but not both. |
| `filter` | string | yes/no | The LDAP filter for the group. Provide either a `cn` or a `filter`, but not both. |
Example request:
```shell
curl --request DELETE \
--header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{"provider": "ldapmain", "cn": "group2"}' \
--url "https://gitlab.example.com/api/v4/groups/4/ldap_group_links"
```
If successful, no response is returned.
## Delete an LDAP group link (deprecated)
Deletes an LDAP group link. Deprecated. Scheduled for removal in a future release.
Use [Delete an LDAP group link with CN or filter](#delete-an-ldap-group-link-with-cn-or-filter) instead.
Delete an LDAP group link with a CN:
```plaintext
DELETE /groups/:id/ldap_group_links/:cn
```
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-paths) |
| `cn` | string | yes | The CN of an LDAP group |
Delete an LDAP group link for a specific LDAP provider:
```plaintext
DELETE /groups/:id/ldap_group_links/:provider/:cn
```
| Attribute | Type | Required | Description |
| --------- | -------------- | -------- | ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-paths) |
| `cn` | string | yes | The CN of an LDAP group |
| `provider` | string | yes | LDAP provider for the LDAP group link |
|