Groups

This document uses the REST API. For more details, see the Authentication for API page.

Get list of org memberships of a group user

get

Get list of org memberships of a group user

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the group

Query parameters
user_idstring · uuidrequired

The ID of the User

org_namestringoptional

Organization name

Example: Org name
role_namestringoptional

Filter the response for results only with the specified role.

starting_afterstringoptional

Return the page of results immediately after this cursor

Example: v1.eyJpZCI6IjEwMDAifQo=
ending_beforestringoptional

Return the page of results immediately before this cursor

Example: v1.eyJpZCI6IjExMDAifQo=
limitinteger · int32 · min: 10 · max: 100 · default: 10optional

Number of results to return per page

Example: 10
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Responses
curl -L \
  --url 'https://api.snyk.io/rest/groups/{group_id}/org_memberships?user_id=123e4567-e89b-12d3-a456-426614174000&version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "created_at": "2021-05-29T09:50:54.014Z"
      },
      "id": "331ede0a-de94-456f-b788-166caeca58bf",
      "org_membership_count": 1,
      "relationships": {
        "org": {
          "data": {
            "attributes": {
              "name": "Example org"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "org"
          }
        },
        "role": {
          "data": {
            "attributes": {
              "name": "Admin role"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "org_role"
          }
        },
        "user": {
          "data": {
            "attributes": {
              "email": "[email protected]",
              "name": "User2",
              "username": "User name 2"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "user"
          }
        }
      },
      "type": "org_membership"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource",
    "last": "https://example.com/api/resource",
    "next": "https://example.com/api/resource",
    "prev": "https://example.com/api/resource",
    "related": "https://example.com/api/resource",
    "self": "https://example.com/api/resource"
  },
  "meta": {
    "org_membership_count": 1
  }
}

Create a group membership for a user with role

post

Create a group membership for a user with role

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the group

Query parameters
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Body
dataobjectoptional

Responses
curl -L \
  --request POST \
  --url 'https://api.snyk.io/rest/groups/{group_id}/memberships?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "relationships": {
        "group": {
          "data": {
            "id": "8aab168e-fb3b-47c0-9d87-442715788b31",
            "type": "group"
          }
        },
        "role": {
          "data": {
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "group_role"
          }
        },
        "user": {
          "data": {
            "id": "677d5f47-a8bf-4090-ba52-680903e7c8b5",
            "type": "user"
          }
        }
      },
      "type": "group_membership"
    }
  }'
{
  "data": {
    "attributes": {
      "created_at": "2021-05-29T09:50:54.014Z"
    },
    "id": "331ede0a-de94-456f-b788-166caeca58bf",
    "relationships": {
      "group": {
        "data": {
          "attributes": {
            "name": "Example group"
          },
          "id": "331ede0a-de94-456f-b788-166caeca58bf",
          "type": "group"
        }
      },
      "role": {
        "data": {
          "attributes": {
            "name": "Admin role"
          },
          "id": "331ede0a-de94-456f-b788-166caeca58bf",
          "type": "group_role"
        }
      },
      "user": {
        "data": {
          "attributes": {
            "email": "[email protected]",
            "login_method": "text",
            "name": "User2",
            "username": "User name 2"
          },
          "id": "331ede0a-de94-456f-b788-166caeca58bf",
          "type": "user"
        }
      }
    },
    "type": "group_membership"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource",
    "last": "https://example.com/api/resource",
    "next": "https://example.com/api/resource",
    "prev": "https://example.com/api/resource",
    "related": "https://example.com/api/resource",
    "self": "https://example.com/api/resource"
  }
}

Get all memberships of the group

get

Returns all memberships of the group

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the group

Query parameters
starting_afterstringoptional

Return the page of results immediately after this cursor

Example: v1.eyJpZCI6IjEwMDAifQo=
ending_beforestringoptional

Return the page of results immediately before this cursor

Example: v1.eyJpZCI6IjExMDAifQo=
limitinteger · int32 · min: 10 · max: 100 · default: 10optional

Number of results to return per page

Example: 10
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
sort_bystring · enumoptional

Which column to sort by.

Options: username, user_display_name, email, login_method, role_name
sort_orderstring · enum · default: "DESC"optional

Order in which results are returned.

Example: ASC
Options: ASC, DESC
emailstringoptional

Filter the response by Users that match the provided email

user_idstringoptional

Filter the response by Users that match the provided user ID

usernamestringoptional

Filter the response by Users that match the provided username

role_namestringoptional

Filter the response for results only with the specified role.

include_group_membership_countbooleanoptional

indicates whether the count of group memberships is included

Responses
curl -L \
  --url 'https://api.snyk.io/rest/groups/{group_id}/memberships?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "created_at": "2022-03-16T00:00:00Z"
      },
      "id": "331ede0a-de94-456f-b788-166caeca58bf",
      "meta": {
        "group_membership_count": 1
      },
      "relationships": {
        "group": {
          "data": {
            "attributes": {
              "name": "Example group"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "group"
          }
        },
        "role": {
          "data": {
            "attributes": {
              "name": "Admin role"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "group_role"
          }
        },
        "user": {
          "data": {
            "attributes": {
              "email": "[email protected]",
              "login_method": "text",
              "name": "User2",
              "username": "User name 2"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "user"
          }
        }
      },
      "type": "group_membership"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource",
    "last": "https://example.com/api/resource",
    "next": "https://example.com/api/resource",
    "prev": "https://example.com/api/resource",
    "related": "https://example.com/api/resource",
    "self": "https://example.com/api/resource"
  }
}

Update a role from a group membership

patch

Update a role from a group membership

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the group

membership_idstring · uuidrequired

The ID of the Group Membership

Query parameters
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Body
dataobjectoptional

Responses
curl -L \
  --request PATCH \
  --url 'https://api.snyk.io/rest/groups/{group_id}/memberships/{membership_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {},
      "id": "331ede0a-de94-456f-b788-166caeca58bf",
      "relationships": {
        "role": {
          "data": {
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "Always \"group_role\""
          }
        }
      },
      "type": "group_membership"
    }
  }'

No body

Delete a membership from a group

delete

Deletes a membership from a group

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the group

membership_idstring · uuidrequired

The ID of the Group Membership

Query parameters
cascadebooleanoptional

indicates whether to delete the child org memberships of the group membership.

versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Responses
curl -L \
  --request DELETE \
  --url 'https://api.snyk.io/rest/groups/{group_id}/memberships/{membership_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

Last updated

Was this helpful?

Revision created

Add comment to emphasize required filters hidden in GitBook collapsed field