Users

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

My User Details

get

Retrieves information about the the user making the request.

Authorizations
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))?))$
Responses
200

Current user is returned

application/vnd.api+json
get
GET /rest/self HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "avatar_url": "https://snyk.io/avatar.png",
      "default_org_context": "123e4567-e89b-12d3-a456-426614174000",
      "email": "[email protected]",
      "name": "user",
      "username": "username"
    },
    "id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
    "type": "user"
  },
  "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 user by ID (Early Access)

get

Get a summary of user.

Note that Service Accounts are not returned by this endpoint. Please use the Service Accounts endpoints.

Required permissions

  • View users (org.user.read)
Authorizations
Path parameters
org_idstring · uuidRequired

The id of the org

idstring · uuidRequired

The id of the user

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))?))$
Responses
200

User details

application/vnd.api+json
get
GET /rest/orgs/{org_id}/users/{id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "active": true,
      "email": "[email protected]",
      "membership": {
        "created_at": "2022-09-14T09:19:29.206Z",
        "strategy": "direct"
      },
      "name": "user",
      "username": "username"
    },
    "id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
    "type": "user"
  },
  "jsonapi": {
    "version": "1.0"
  }
}

Update a user's role in a group (Early Access)

patch

Update a user's membership of the group.

To remove a user's membership, provide 'null' as the membership parameter (see example).

At present, only removing memberships is supported by this endpoint. To update a user's group membership, please use the UI or legacy API.

Required permissions

  • View Groups (group.read)

  • View users (group.user.read)

  • Remove users (group.user.remove)

Authorizations
Path parameters
group_idstring · uuidRequired

The id of the group

idstring · uuidRequired

The id of the user

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
204

The operation completed successfully with no content

patch
PATCH /rest/groups/{group_id}/users/{id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 101

{
  "data": {
    "attributes": {
      "membership": null
    },
    "id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4122",
    "type": "user"
  }
}

No content

Last updated

Was this helpful?