Snyk

Snyk API

The Snyk API is available to customers on [Business and Enterprise plans](https://snyk.io/plans) and allows you to programatically integrate with Snyk. REST…

Developer tools#openapi#developer-tools

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The Snyk API is available to customers on Business and Enterprise plans and allows you to programatically integrate with Snyk.

REST API

We are in the process of building a new, improved API (https://api.snyk.io/rest) built using the OpenAPI and JSON API standards. We welcome you to try it out as we shape and release endpoints until it, ultimately, becomes a full replacement for our current API.

Looking for our REST API docs? Please head over to https://apidocs.snyk.io

API vs CLI vs Snyk integration

The API detailed below has the ability to test a package for issues, as they are defined by Snyk. It is important to note that for many package managers, using this API will be less accurate than running the Snyk CLI as part of your build pipe, or just using it locally on your package. The reason for this is that more than one package version fit the requirements given in manifest files. Running the CLI locally tests the actual deployed code, and has an accurate snapshot of the dependency versions in use, while the API can only infer it, with inferior accuracy. It should be noted that the Snyk CLI has the ability to output machine-readable JSON output (with the --json flag to snyk test).

A third option, is to allow Snyk access to your development flow via the existing Snyk integrations. The advantage to this approach is having Snyk monitor every new pull request, and suggest fixes by opening new pull requests. This can be achieved either by integrating Snyk directly to your source code management (SCM) tool, or via a broker to allow greater security and auditability.

If those are not viable options, this API is your best choice.

API url

The base URL for all API endpoints is https://api.snyk.io/api/v1/

Authorization

To use this API, you must get your token from Snyk. It can be seen on https://snyk.io/account/ after you register with Snyk and login.

The token should be supplied in an Authorization header with the token, preceded by token:

Authorization: token API_KEY

Otherwise, a 401 "Unauthorized" response will be returned.

HTTP/1.1 401 Unauthorized

        {
            "code": 401,
            "error": "Not authorised",
            "message": "Not authorised"
        }

Overview and entities

The API is a REST API. It has the following entities:

Test result

The test result is the object returned from the API giving the results of testing a package for issues. It has the following fields:

PropertyTypeDescriptionExample
okbooleanDoes this package have one or more issues?false
issuesobjectThe issues found. See below for details.See below
dependencyCountnumberThe number of dependencies the package has.9
orgobjectThe organization this test was carried out for.{"name": "anOrg", "id": "5d7013d9-2a57-4c89-993c-0304d960193c"}
licensesPolicyobjectThe organization's licenses policy used for this testSee in the examples
packageManagerstringThe package manager for this package"maven"

Issue

An issue is either a vulnerability or a license issue, according to the organization's policy. It has the following fields:

PropertyTypeDescriptionExample
idstringThe issue ID"SNYK-JS-BACKBONE-10054"
urlstringA link to the issue details on snyk.io"https://snyk.io/vuln/SNYK-JS-BACKBONE-10054
titlestringThe issue title …

Endpoints 103

Users

  • GETGet My Details/user/me
  • GETGet organization notification settings/user/me/notification-settings/org/:orgId
  • PUTModify organization notification settings/user/me/notification-settings/org/:orgId
  • GETGet project notification settings/user/me/notification-settings/org/:orgId/project/:projectId
  • PUTModify project notification settings/user/me/notification-settings/org/:orgId/project/:projectId
  • GETGet User Details/user/:userId

Groups

  • GETList all members in a group/group/:groupId/members
  • POSTAdd a member to an organization within a group/group/:groupId/org/:orgId/members
  • GETList all organizations in a group/group/:groupId/orgs?perPage=100&page=1&name=my
  • GETList all roles in a group/group/:groupId/roles
  • GETView group settings/group/:groupId/settings
  • PUTUpdate group settings/group/:groupId/settings
  • GETList all tags in a group/group/:groupId/tags?perPage=10&page=1
  • POSTDelete tag from group/group/:groupId/tags/delete

Organizations

  • POSTCreate a new organization/org
  • DELETERemove organization/org/:orgId
  • POSTInvite users/org/:orgId/invite
  • GETList Members/org/:orgId/members?includeGroupAdmins=true
  • PUTUpdate a member's role in the organization/org/:orgId/members/update/:userId
  • PUTUpdate a member in the organization/org/:orgId/members/:userId
  • DELETERemove a member from the organization/org/:orgId/members/:userId
  • GETGet organization notification settings/org/:orgId/notification-settings
  • PUTSet notification settings/org/:orgId/notification-settings
  • GETList pending user provisions/org/:orgId/provision
  • POSTProvision a user to the organization/org/:orgId/provision
  • DELETEDelete pending user provision/org/:orgId/provision
  • GETView organization settings/org/:orgId/settings
  • PUTUpdate organization settings/org/:orgId/settingsSettings that are not provided will not be modified.
  • GETList all the organizations a user belongs to/orgs

Integrations

  • GETList/org/:orgId/integrations
  • POSTAdd new integration/org/:orgId/integrationsAdd new integration for given organization.
  • PUTUpdate existing integration/org/:orgId/integrations/:integrationId+ Update integration's credentials for given organization. Integration must be not brokered + Enable or disable brokered integration for given organization.…
  • DELETEDelete credentials/org/:orgId/integrations/:integrationId/authenticationRemoves any credentials set for this integration. If this is a brokered connection the operation will have no effect.
  • POSTProvision new broker token/org/:orgId/integrations/:integrationId/authentication/provision-tokenIssue a new and unique provisional broker token for the brokered integration. Used for zero down-time token rotation with the Snyk Broker. Once provisioned,…
  • POSTSwitch between broker tokens/org/:orgId/integrations/:integrationId/authentication/switch-tokenSwitch the existing broker token with the provisioned token for this integration and any other in the same group. Only perform this action when you have a…
  • POSTClone an integration (with settings and credentials)/org/:orgId/integrations/:integrationId/cloneClone an integration, including all of its settings and credentials from one organization to another organization in the same group. This API supports both…
  • GETRetrieve/org/:orgId/integrations/:integrationId/settings
  • PUTUpdate/org/:orgId/integrations/:integrationId/settings
  • GETGet existing integration by type/org/:orgId/integrations/:type

Import Projects

  • POSTImport targets/org/:orgId/integrations/:integrationId/import
  • GETGet import job details/org/:orgId/integrations/:integrationId/import/:jobId

Projects

  • GETRetrieve a single project/org/:orgId/project/:projectId
  • PUTUpdate a project/org/:orgId/project/:projectId
  • DELETEDelete a project/org/:orgId/project/:projectId
  • POSTActivate/org/:orgId/project/:projectId/activateActivating a project will: Add a repository webhook for supported integrations. Enable pull request tests for new vulnerabilities. Open Fix pull request for…
  • POSTList all Aggregated issues/org/:orgId/project/:projectId/aggregated-issues
  • POSTApplying attributes/org/:orgId/project/:projectId/attributesApplies an attribute to the provided project. It is possible to assign multiple values to each attribute, but you can only assign values to one of the…
  • POSTDeactivate/org/:orgId/project/:projectId/deactivateDeactivating a project will: Disable pull request tests for new vulnerabilities. Disable Fix pull request from being opened for newly disclosed…
  • GETGet Project dependency graph/org/:orgId/project/:projectId/dep-graph
  • POSTList all project snapshots/org/:orgId/project/:projectId/history?perPage=10&page=1
  • POSTList all project snapshot aggregated issues/org/:orgId/project/:projectId/history/:snapshotId/aggregated-issues
  • GETList all project snapshot issue paths/org/:orgId/project/:projectId/history/:snapshotId/issue/:issueId/paths?perPage=3&page=2
  • GETRetrieve ignore/org/:orgId/project/:projectId/ignore/:issueId
  • PUTReplace ignores/org/:orgId/project/:projectId/ignore/:issueId
  • POSTAdd ignore/org/:orgId/project/:projectId/ignore/:issueId
  • DELETEDelete ignores/org/:orgId/project/:projectId/ignore/:issueId
  • GETList all ignores/org/:orgId/project/:projectId/ignoresTemporary ignores include an expires attribute, while permanent ignores do not.
  • POSTCreate jira issue/org/:orgId/project/:projectId/issue/:issueId/jira-issue
  • GETList all project issue paths/org/:orgId/project/:projectId/issue/:issueId/paths?snapshotId=6d5813be-7e6d-4ab8-80c2-1e3e2a454553&perPage=3&page=2
  • GETList all jira issues/org/:orgId/project/:projectId/jira-issues
  • PUTMove project to a different organization/org/:orgId/project/:projectId/moveNote: when moving a project to a new organization, the historical data used for reporting does not move with it.
  • GETList project settings/org/:orgId/project/:projectId/settings
  • PUTUpdate project settings/org/:orgId/project/:projectId/settings
  • DELETEDelete project settings/org/:orgId/project/:projectId/settingsDeleting project settings will set the project to inherit default settings from its integration.
  • POSTAdd a tag to a project/org/:orgId/project/:projectId/tags​
  • POSTRemove a tag from a project/org/:orgId/project/:projectId/tags/remove
  • POSTList all projects/org/:orgId/projects

Dependencies

  • POSTList all dependencies/org/:orgId/dependencies?sortBy=dependency&order=asc&page=1&perPage=20

Licenses

  • POSTList all licenses/org/:orgId/licenses?sortBy=license&order=asc

Entitlements

  • GETGet an organization's entitlement value/org/:orgId/entitlement/:entitlementKey
  • GETList all entitlements/org/:orgId/entitlements

Test

  • POSTTest composer.json & composer.lock file/test/composerYou can test your Composer packages for issues according to their manifest file & lockfile using this action. It takes a JSON object containing a "target"…
  • POSTTest Dep Graph/test/dep-graph?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7Use this endpoint to find issues in a DepGraph data object.
  • POSTTest Gopkg.toml & Gopkg.lock File/test/golangdep?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7You can test your Go dep packages for issues according to their manifest file & lockfile using this action. It takes a JSON object containing a "target"…
  • POSTTest vendor.json File/test/govendorYou can test your Go vendor packages for issues according to their manifest file using this action. It takes a JSON object containing a "target" vendor.json.
  • POSTTest gradle file/test/gradleYou can test your Gradle packages for issues according to their manifest file using this action. It takes a JSON object containing the "target" build.gradle.
  • GETTest for issues in a public package by group, name and version/test/gradle/:group/:name/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7&repository=https://repo1.maven.org/maven2You can test gradle packages for issues according to their group, name and version. This is done via the maven endpoint (for Java), since the packages are…
  • POSTTest maven file/test/maven?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7&repository=https://repo1.maven.org/maven2You can test your Maven packages for issues according to their manifest file using this action. It takes a JSON object containing a the "target" pom.xml.…
  • GETTest for issues in a public package by group id, artifact id and version/test/maven/:groupId/:artifactId/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7&repository=https://repo1.maven.org/maven2You can test maven packages for issues according to their coordinates: group ID, artifact ID and version. The repository hosting the package may also be…
  • POSTTest package.json & package-lock.json File/test/npmYou can test your npm packages for issues according to their manifest file & optional lockfile using this action. It takes a JSON object containing a "target"…
  • GETTest for issues in a public package by name and version/test/npm/:packageName/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7You can test npm packages for issues according to their name and version.
  • POSTTest requirements.txt file/test/pipYou can test your pip packages for issues according to their manifest file using this action. It takes a JSON object containing a the "target" requirements.txt.
  • GETTest for issues in a public package by name and version/test/pip/:packageName/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7You can test pip packages for issues according to their name and version.
  • POSTTest gemfile.lock file/test/rubygemsYou can test your rubygems applications for issues according to their lockfile using this action. It takes a JSON object containing a the "target" Gemfile.lock.
  • GETTest for issues in a public gem by name and version/test/rubygems/:gemName/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7You can test rubygems packages for issues according to their name and version.
  • POSTTest sbt file/test/sbtYou can test your sbt packages for issues according to their manifest file using this action. It takes a JSON object containing a the "target" build.sbt.
  • GETTest for issues in a public package by group id, artifact id and version/test/sbt/:groupId/:artifactId/:version?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7&repository=https://repo1.maven.org/maven2You can test sbt packages for issues according to their group ID, artifact ID and version. This is done via the maven endpoint (for Java), since the packages…
  • POSTTest package.json & yarn.lock File/test/yarnYou can test your yarn packages for issues according to their manifest file & lockfile using this action. It takes a JSON object containing a "target"…

Monitor

  • POSTMonitor Dep Graph/monitor/dep-graph?org=9695cbb1-3a87-4d6f-8ae1-61a1c37ee9f7Use this endpoint to monitor a DepGraph data object.

Reporting API

  • POSTGet issue counts/reporting/counts/issues?from=2017-07-01&to=2017-07-03&groupBy=severity
  • POSTGet latest issue counts/reporting/counts/issues/latest?groupBy=severity
  • POSTGet project counts/reporting/counts/projects?from=2017-07-01&to=2017-07-03
  • POSTGet latest project counts/reporting/counts/projects/latest
  • POSTGet test counts/reporting/counts/tests?from=2017-07-01&to=2017-07-03&groupBy=isPrivate
  • POSTGet list of issues/reporting/issues/?from=2017-07-01&to=2017-07-07&page=1&perPage=100&sortBy=issueTitle&order=asc&groupBy=issue
  • POSTGet list of latest issues/reporting/issues/latest?page=1&perPage=100&sortBy=issueTitle&order=asc&groupBy=issue

Audit logs

  • POSTGet group level audit logs/group/:groupId/audit?from=2019-07-01&to=2019-07-07&page=1&sortOrder=ASC
  • POSTGet organization level audit logs/org/:orgId/audit?from=2019-07-01&to=2019-07-07&page=1&sortOrder=ASC

Webhooks

  • GETList webhooks/org/:orgId/webhooks
  • POSTCreate a webhook/org/:orgId/webhooks
  • GETRetrieve a webhook/org/:orgId/webhooks/:webhookId
  • DELETEDelete a webhook/org/:orgId/webhooks/:webhookId
  • POSTPing a webhook/org/:orgId/webhooks/:webhookId/ping

API details

Base URL
https://api.snyk.io/api/v1
Authentication
None declared in the description
Operations
103 operations on 84 pathsPOST 46GET 36PUT 13DELETE 8
Main resources
Projects 26Test 17Organizations 15Integrations 10Groups 8Reporting API 7Users 6Webhooks 5Audit logs 2Entitlements 2
Response formats
application/json; charset=utf-8 */* application/json, charset=utf-8
Description format
OpenAPI 3.0.0, API version 1.0.0
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the Snyk API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Snyk API collection, without the publisher's secrets.
  3. Add your credentialsOpen the collection's variables or an environment and enter your API key or token, if the API needs one.
  4. Send a requestPick an endpoint, for example “Get My Details” (GET /user/me), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Snyk API?

The Snyk API is available to customers on [Business and Enterprise plans](https://snyk.io/plans) and allows you to programatically integrate with Snyk. REST… It is listed under Developer tools and has 103 endpoints.

Who publishes the Snyk API?

It is listed from Snyk's public API description (an OpenAPI document), not published by Snyk on Swastik Codes. Anyone who controls snyk.io can claim the profile by adding a DNS TXT record.

What is the base URL of the Snyk API?

Requests go to https://api.snyk.io/api/v1. Endpoint paths are added to this base URL.

How do I authenticate with the Snyk API?

Its OpenAPI description does not declare an authentication scheme. Some endpoints may be open; check the provider's documentation before relying on that.

How many endpoints does the Snyk API have?

103 operations on 84 paths (46 POST, 36 GET, 13 PUT, 8 DELETE). The largest groups are Projects, Test, Organizations, Integrations.

Is forking the Snyk API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.