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

Required permissions

  • View Group Memberships (group.membership.read)

  • View Organizations (group.org.list)

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: 100Optional

Number of results to return per page

Default: 10Example: 10
versionstringRequired

Requested API version

Example: 2021-06-04Pattern: ^(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
get
GET /rest/groups/{group_id}/org_memberships HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "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

Required permissions

  • Add Group Memberships (group.membership.add)
Authorizations
Path parameters
group_idstring · uuidRequired

The ID of the group

Query parameters
versionstringRequired

Requested API version

Example: 2021-06-04Pattern: ^(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
Responses
post
POST /rest/groups/{group_id}/memberships HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 290

{
  "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

Required permissions

  • View Group Memberships (group.membership.read)
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: 100Optional

Number of results to return per page

Default: 10Example: 10
versionstringRequired

Requested API version

Example: 2021-06-04Pattern: ^(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.

Possible values:
sort_orderstring · enumOptional

Order in which results are returned.

Default: DESCExample: ASCPossible values:
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
get
GET /rest/groups/{group_id}/memberships HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "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

Required permissions

  • Edit Group Memberships (group.membership.edit)
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-04Pattern: ^(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
Responses
patch
PATCH /rest/groups/{group_id}/memberships/{membership_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 207

{
  "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 content

Delete a membership from a group

delete

Deletes a membership from a group

Required permissions

  • Delete Group Memberships (group.membership.delete)
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-04Pattern: ^(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
delete
DELETE /rest/groups/{group_id}/memberships/{membership_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*

No content

Last updated

Was this helpful?