TenantRole

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

Create a custom tenant role for a given tenant (Early Access)

post

Create a custom tenant role for a given tenant.

Required permissions

  • tenant.roles.read

  • tenant.roles.create

Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier of the tenant.

Example: 00000000-0000-0000-0000-000000000000
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
201

Tenant role successfully created.

application/vnd.api+json
post
POST /rest/tenants/{tenant_id}/roles HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 104

{
  "data": {
    "attributes": {
      "description": "text",
      "name": "text",
      "permissions": [
        "text"
      ]
    },
    "type": "tenant_role"
  }
}
{
  "data": {
    "attributes": {
      "custom": false,
      "description": "text",
      "name": "text",
      "normalized_name": "text",
      "permissions": [
        "text"
      ]
    },
    "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
    "meta": {
      "app_count": 1,
      "service_account_count": 1,
      "user_count": 1
    },
    "relationships": {
      "tenant": {
        "data": {
          "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
          "type": "tenant"
        }
      }
    },
    "type": "tenant_role"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

List all available roles for a given tenant (Early Access)

get

List all available roles for a given tenant.

Required permissions

  • tenant.roles.read
Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier of the tenant.

Example: 00000000-0000-0000-0000-000000000000
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))?))$
namestringOptional

Role name filter.

Example: examplename
custombooleanOptional

Whether role is custom or not.

Example: false
assignable_by_mebooleanOptional

When true, only return roles that the current user can assign to others in the tenant.

Example: false
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
Responses
200

Returns an array of roles that are the roles on a Tenant.

application/vnd.api+json
get
GET /rest/tenants/{tenant_id}/roles HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "attributes": {
        "custom": false,
        "description": "text",
        "name": "text",
        "normalized_name": "text",
        "permissions": [
          "text"
        ]
      },
      "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
      "meta": {
        "app_count": 1,
        "service_account_count": 1,
        "user_count": 1
      },
      "relationships": {
        "tenant": {
          "data": {
            "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
            "type": "tenant"
          }
        }
      },
      "type": "tenant_role"
    }
  ],
  "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 a specific tenant role by its id and its tenant id. (Early Access)

patch

Update attributes of a custom tenant role in a given tenant

Required permissions

  • tenant.roles.read

  • tenant.roles.edit

Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier of the tenant.

Example: 00000000-0000-0000-0000-000000000000
role_idstring · uuidRequired

Unique identifier of the role.

Example: 00000000-0000-0000-0000-000000000000
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))?))$
forcebooleanOptional

flag to force the update of a role, required if users are assigned to the role

Example: false
Body
Responses
200

Returns the updated role.

application/vnd.api+json
patch
PATCH /rest/tenants/{tenant_id}/roles/{role_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 148

{
  "data": {
    "attributes": {
      "description": "text",
      "name": "text",
      "permissions": [
        "text"
      ]
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "type": "tenant_role"
  }
}
{
  "data": {
    "attributes": {
      "custom": false,
      "description": "text",
      "name": "text",
      "normalized_name": "text",
      "permissions": [
        "text"
      ]
    },
    "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
    "meta": {
      "app_count": 1,
      "service_account_count": 1,
      "user_count": 1
    },
    "relationships": {
      "tenant": {
        "data": {
          "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
          "type": "tenant"
        }
      }
    },
    "type": "tenant_role"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Return a specific role by its id and its tenant id. (Early Access)

get

Return a role from a tenant by the tenant and role id with its details and permissions.

Required permissions

  • tenant.roles.read
Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier of the tenant.

Example: 00000000-0000-0000-0000-000000000000
role_idstring · uuidRequired

Unique identifier of the role.

Example: 00000000-0000-0000-0000-000000000000
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))?))$
has_users_assignedbooleanOptional

returns current memberships of the role in the meta relationships section

Default: false
Responses
200

Returns the requested role.

application/vnd.api+json
get
GET /rest/tenants/{tenant_id}/roles/{role_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "custom": false,
      "description": "text",
      "name": "text",
      "normalized_name": "text",
      "permissions": [
        "text"
      ]
    },
    "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
    "meta": {
      "app_count": 1,
      "service_account_count": 1,
      "user_count": 1
    },
    "relationships": {
      "tenant": {
        "data": {
          "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
          "type": "tenant"
        }
      }
    },
    "type": "tenant_role"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Delete a specific tenant role by its id and its tenant id. (Early Access)

delete

Delete a custom tenant role in a given tenant

Required permissions

  • tenant.roles.read

  • tenant.roles.delete

Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier of the tenant.

Example: 00000000-0000-0000-0000-000000000000
role_idstring · uuidRequired

Unique identifier of the role.

Example: 00000000-0000-0000-0000-000000000000
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
204

Tenant role successfully deleted.

delete
DELETE /rest/tenants/{tenant_id}/roles/{role_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*

No content

Last updated

Was this helpful?