Orgs

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

List accessible organizations

get

Get a paginated list of organizations you have access to.

Authorizations
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))?))$
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
group_idstring · uuidoptional

If set, only return organizations within the specified group

is_personalbooleanoptional

If true, only return organizations that are not part of a group.

slugstring · max: 100optional

Only return orgs whose slug exactly matches this value.

Pattern: ^[\w.-]+$
namestring · max: 100optional

Only return orgs whose name contains this value.

expandstring · enum[]optional

Expand the specified related resources in the response to include their attributes.

Responses
curl -L \
  --url 'https://api.snyk.io/rest/orgs?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "access_requests_enabled": false,
        "created_at": "2022-03-16T00:00:00Z",
        "group_id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
        "is_personal": true,
        "name": "My Org",
        "slug": "my-org",
        "updated_at": "2022-03-16T00:00:00Z"
      },
      "id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
      "relationships": {
        "member_role": {
          "data": {
            "attributes": {
              "name": "Collaborator"
            },
            "id": "f60ff965-6889-4db2-8c86-0285d62f35ab",
            "type": "resource"
          }
        }
      },
      "type": "resource"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource?ending_before=v1.eyJpZCI6IjExIn0K",
    "last": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjMwIn0K",
    "next": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjEwIn0K"
  }
}

Update organization

patch

Update the details of an organization

Authorizations
Path parameters
org_idstring · uuidrequired

Unique identifier for org

Example: b667f176-df52-4b0a-9954-117af6b05ab7
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
dataobjectrequired

Responses
curl -L \
  --request PATCH \
  --url 'https://api.snyk.io/rest/orgs/{org_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "name": "My Org"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "type": "org"
    }
  }'
{
  "data": {
    "attributes": {
      "access_requests_enabled": false,
      "created_at": "2022-03-16T00:00:00Z",
      "group_id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
      "is_personal": true,
      "name": "My Org",
      "slug": "my-org",
      "updated_at": "2022-03-16T00:00:00Z"
    },
    "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
    "relationships": {
      "member_role": {
        "data": {
          "attributes": {
            "name": "Collaborator"
          },
          "id": "f60ff965-6889-4db2-8c86-0285d62f35ab",
          "type": "resource"
        }
      }
    },
    "type": "org"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Create a org membership for a user with role

post

Create a org membership for a user with role

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the org

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/orgs/{org_id}/memberships?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "relationships": {
        "org": {
          "data": {
            "id": "8aab168e-fb3b-47c0-9d87-442715788b31",
            "type": "org"
          }
        },
        "role": {
          "data": {
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "org_role"
          }
        },
        "user": {
          "data": {
            "id": "677d5f47-a8bf-4090-ba52-680903e7c8b5",
            "type": "user"
          }
        }
      },
      "type": "org_membership"
    }
  }'
{
  "data": {
    "attributes": {
      "created_at": "2021-05-29T09:50:54.014Z"
    },
    "id": "331ede0a-de94-456f-b788-166caeca58bf",
    "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]",
            "login_method": "text",
            "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"
  }
}

Get all memberships of the org

get

Returns all memberships of the org

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the org

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
sort_orderstring · enum · default: "ASC"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.

Responses
curl -L \
  --url 'https://api.snyk.io/rest/orgs/{org_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",
      "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]",
              "login_method": "text",
              "name": "User2",
              "username": "User name 2"
            },
            "id": "331ede0a-de94-456f-b788-166caeca58bf",
            "type": "user"
          }
        }
      },
      "type": "org_memberships"
    }
  ],
  "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 org membership for a user with role

patch

Update a org membership for a user with role

Authorizations
Path parameters
org_idstring · uuidrequired

The id of the org

membership_idstring · uuidrequired

The id of the org 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/orgs/{org_id}/memberships/{membership_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {},
      "id": "f60ff965-6889-4db2-8c86-0285d62f35ab",
      "relationships": {
        "role": {
          "data": {
            "id": "f60ff965-6889-4db2-8c86-0285d62f35ab",
            "type": "org_role"
          }
        }
      },
      "type": "org_membership"
    }
  }'

No body

Remove user's org membership

delete

Remove a user's membership of the group.

Authorizations
Path parameters
org_idstring · uuidrequired

The id of the org

membership_idstring · uuidrequired

The id of the org 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))?))$
Responses
curl -L \
  --request DELETE \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/memberships/{membership_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

List all organizations in group

get

Get a paginated list of all the organizations belonging to the group. By default, this endpoint returns the organizations in alphabetical order of their name.

Authorizations
Path parameters
group_idstring · uuidrequired

Unique identifier for group

Example: b667f176-df52-4b0a-9954-117af6b05ab7
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))?))$
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
namestringoptional

Only return organizations whose name contains this value. Case insensitive.

slugstringoptional

Only return organizations whose slug exactly matches this value. Case sensitive.

Responses
curl -L \
  --url 'https://api.snyk.io/rest/groups/{group_id}/orgs?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "access_requests_enabled": false,
        "created_at": "2022-03-16T00:00:00Z",
        "group_id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
        "is_personal": true,
        "name": "My Org",
        "slug": "my-org",
        "updated_at": "2022-03-16T00:00:00Z"
      },
      "id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
      "type": "resource"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource?ending_before=v1.eyJpZCI6IjExIn0K",
    "last": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjMwIn0K",
    "next": "https://example.com/api/resource?starting_after=v1.eyJpZCI6IjEwIn0K"
  }
}

Last updated

Was this helpful?

Revision created

Add comment to emphasize required filters hidden in GitBook collapsed field