ServiceAccounts

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

Create a service account for an organization.

post

Create a service account for an organization. The service account can be used to access the Snyk API.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the Snyk Organization that is creating and will own the service account.

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 POST \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/service_accounts?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "access_token_ttl_seconds": 1,
        "auth_type": "api_key",
        "jwks_url": "text",
        "name": "text",
        "role_id": "123e4567-e89b-12d3-a456-426614174000"
      },
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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 a list of organization service accounts.

get

Get all service accounts for an organization.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the Snyk Organization that owns the service accounts.

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))?))$
Responses
curl -L \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/service_accounts?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "access_token_ttl_seconds": 1,
        "api_key": "text",
        "auth_type": "api_key",
        "client_id": "text",
        "client_secret": "text",
        "jwks_url": "text",
        "level": "Group",
        "name": "text",
        "role_id": "123e4567-e89b-12d3-a456-426614174000"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "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"
      },
      "type": "text"
    }
  ],
  "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 an organization service account.

patch

Update the name of an organization-level service account by its ID.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the Snyk Organization that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "name": "text"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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 an organization service account.

get

Get an organization-level service account by its ID.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the Snyk Organization that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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 \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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"
  }
}

Delete a service account in an organization.

delete

Delete a service account in an organization.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of org to which the service account belongs.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

Manage an organization service account's client secret.

post

Manage the client secret of an organization service account by the service account ID.

Authorizations
Path parameters
org_idstring · uuidrequired

The ID of the Snyk Organization that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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 POST \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/service_accounts/{serviceaccount_id}/secrets?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "mode": "replace",
        "secret": "text"
      },
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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"
  }
}

Create a service account for a group.

post

Create a service account for a group. The service account can be used to access the Snyk API.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that is creating and owns the service account

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 POST \
  --url 'https://api.snyk.io/rest/groups/{group_id}/service_accounts?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "access_token_ttl_seconds": 1,
        "auth_type": "api_key",
        "jwks_url": "text",
        "name": "text",
        "role_id": "123e4567-e89b-12d3-a456-426614174000"
      },
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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 a list of group service accounts.

get

Get all service accounts for a group.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that owns the service accounts.

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))?))$
Responses
curl -L \
  --url 'https://api.snyk.io/rest/groups/{group_id}/service_accounts?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": [
    {
      "attributes": {
        "access_token_ttl_seconds": 1,
        "api_key": "text",
        "auth_type": "api_key",
        "client_id": "text",
        "client_secret": "text",
        "jwks_url": "text",
        "level": "Group",
        "name": "text",
        "role_id": "123e4567-e89b-12d3-a456-426614174000"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "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"
      },
      "type": "text"
    }
  ],
  "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 group service account.

patch

Update the name of a group's service account by its ID.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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/groups/{group_id}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "name": "text"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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 a group service account.

get

Get a group-level service account by its ID.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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 \
  --url 'https://api.snyk.io/rest/groups/{group_id}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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"
  }
}

Delete a group service account.

delete

Permanently delete a group-level service account by its ID.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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/groups/{group_id}/service_accounts/{serviceaccount_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

Manage a group service account's client secret.

post

Manage the client secret of a group service account by the service account ID.

Authorizations
Path parameters
group_idstring · uuidrequired

The ID of the Snyk Group that owns the service account.

serviceaccount_idstring · uuidrequired

The ID of the service account.

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 POST \
  --url 'https://api.snyk.io/rest/groups/{group_id}/service_accounts/{serviceaccount_id}/secrets?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '{
    "data": {
      "attributes": {
        "mode": "replace",
        "secret": "text"
      },
      "type": "service_account"
    }
  }'
{
  "data": {
    "attributes": {
      "access_token_ttl_seconds": 1,
      "api_key": "text",
      "auth_type": "api_key",
      "client_id": "text",
      "client_secret": "text",
      "jwks_url": "text",
      "level": "Group",
      "name": "text",
      "role_id": "123e4567-e89b-12d3-a456-426614174000"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "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"
    },
    "type": "text"
  },
  "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"
  }
}

Last updated

Was this helpful?

Revision created

Add comment to emphasize required filters hidden in GitBook collapsed field