Tenants

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

Get a list of all accessible Tenants

get

Get a list of all Tenants which the calling user is a member of

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))?))$
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 a list of tenants.

application/vnd.api+json
get
GET /rest/tenants HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "attributes": {
        "created_at": "2022-03-16T00:00:00Z",
        "name": "My Tenant",
        "slug": "my-tenant",
        "updated_at": "2022-03-16T00:00:00Z"
      },
      "id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
      "relationships": {
        "owner": {
          "data": {
            "id": "b667f176-df52-4b0a-9954-117af6b05ab7",
            "type": "user"
          }
        }
      },
      "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 tenant

patch

Update the details of a tenant

Required permissions

  • Edit Tenant Details (tenant.edit)
Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier for tenant

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

Instance of tenant is updated

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

{
  "data": {
    "attributes": {
      "name": "My Tenant"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "type": "resource"
  }
}
{
  "data": {
    "attributes": {
      "created_at": "2022-03-16T00:00:00Z",
      "name": "My Tenant",
      "slug": "my-tenant",
      "updated_at": "2022-03-16T00:00:00Z"
    },
    "id": "d5b640e5-d88c-4c17-9bf0-93597b7a1ce2",
    "type": "resource"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Get a single Tenant by ID

get

Get the full details of a Tenant.

Required permissions

  • View Tenant Details (tenant.read)
Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier for tenant

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

Returns an instance of a tenant.

application/vnd.api+json
get
GET /rest/tenants/{tenant_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "created_at": "2022-03-16T00:00:00Z",
      "name": "My Tenant",
      "slug": "my-tenant",
      "updated_at": "2022-03-16T00:00:00Z"
    },
    "id": "59d6d97e-3106-4ebb-b608-352fad9c5b34",
    "relationships": {
      "owner": {
        "data": {
          "id": "b667f176-df52-4b0a-9954-117af6b05ab7",
          "type": "user"
        }
      }
    },
    "type": "resource"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://example.com/api/this_resource"
  }
}

Get all memberships of the tenant (Early Access)

get

Returns all memberships of the tenant

Required permissions

  • View Tenant Memberships (tenant.membership.read)
Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier for a 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))?))$
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
sort_bystring · enumOptional

Which column to sort by.

Possible values:
sort_orderstring · enumOptional

Order in which results are returned.

Default: ASCExample: ASCPossible values:
emailstringOptional

Filter the response by Users that match the provided email

user_idstring · uuidOptional

Unique identifier for a user.

Example: 00000000-0000-0000-0000-000000000000
namestringOptional

Filter the response by Users that match the provided name

usernamestringOptional

Filter the response by Users that match the provided username

connection_typestringOptional

Filter the response by Users that match the provided connection type

role_namestringOptional

Filter the response for results only with the specified role.

Responses
200

List of tenant memberships is returned

application/vnd.api+json
get
GET /rest/tenants/{tenant_id}/memberships HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": [
    {
      "attributes": {
        "created_at": "2022-03-16T00:00:00Z"
      },
      "id": "00000000-0000-0000-0000-000000000000",
      "relationships": {
        "role": {
          "data": {
            "attributes": {
              "name": "Role name"
            },
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "tenant_role"
          }
        },
        "tenant": {
          "data": {
            "attributes": {
              "name": "My Tenant"
            },
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "tenant"
          }
        },
        "user": {
          "data": {
            "attributes": {
              "account_type": "user",
              "active": true,
              "email": "[email protected]",
              "login_method": "saml",
              "name": "Firstname Lastname",
              "username": "username"
            },
            "id": "00000000-0000-0000-0000-000000000000",
            "meta": {
              "tenant_owner": true
            },
            "type": "user"
          }
        }
      },
      "type": "tenant_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 tenant membership (Early Access)

patch

Update the tenant membership with the new role

Required permissions

  • View Tenant Details (tenant.read)

  • View Tenant Memberships (tenant.membership.read)

  • Edit Tenant Memberships (tenant.membership.edit)

Authorizations
Path parameters
tenant_idstring · uuidRequired

Unique identifier for a tenant.

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

Unique identifier for a tenant membership.

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
204

successfully updated the tenant membership

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

{
  "data": {
    "attributes": {},
    "id": "00000000-0000-0000-0000-000000000000",
    "relationships": {
      "role": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "tenant_role"
        }
      }
    },
    "type": "tenant_membership"
  }
}

No content

Delete an individual tenant membership for a single user. (Early Access)

delete

Delete an individual tenant membership for a single user.

Required permissions

  • View Tenant Memberships (tenant.membership.read)

  • tenant.membership.delete

Authorizations
Path parameters
membership_idstring · uuidRequired

Unique identifier for a tenant membership.

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

Unique identifier for a 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))?))$
Responses
204

successfully deleting an individual membership for a single user

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

No content

Last updated

Was this helpful?