Overview
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 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](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](https://snyk.io/docs/using-snyk) 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](https://snyk.io/docs/). 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`: ```http Authorization: token API_KEY ``` Otherwise, a 401 "Unauthorized" response will be returned. ```http 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: | Property | Type | Description | Example | |----------------:|---------|-------------------------------------------------------|-----------------------------------------------------------------| | ok | boolean | Does this package have one or more issues? | false | | issues | object | The issues found. See below for details. | See below | | dependencyCount | number | The number of dependencies the package has. | 9 | | org | object | The organization this test was carried out for. | {"name": "anOrg", "id": "5d7013d9-2a57-4c89-993c-0304d960193c"} | | licensesPolicy | object | The organization's licenses policy used for this test | See in the examples | | packageManager | string | The 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: | Property | Type | Description | Example | |---------------:|---------------|----------------------------------------------------------------------------------------------------------------------------|----------------------------------------| | id | string | The issue ID | "SNYK-JS-BACKBONE-10054" | | url | string | A link to the issue details on snyk.io | "https://snyk.io/vuln/SNYK-JS-BACKBONE-10054 | | title | string | The issue title | "Cross Site Scripting" | | type | string | The issue type: "license" or "vulnerability". | "license" | | paths | array | The paths to the
Snyk API is a development API from snyk.io. It needs no API key. It is served over HTTPS. Its OpenAPI description documents 103 endpoints.
At a glance
- Authentication
- No auth
- HTTPS
- Yes
- CORS
- Unknown
- Category
- Development
- Base URL
https://api.snyk.io/api/v1- Version
- 1.0.0
- Endpoints
- 103
- OpenAPI
- Specification ↗
- Spec updated
- 2023-03-06
Make a first request
Replace the placeholders; the documentation says exactly where credentials go.
curl -X GET "https://api.snyk.io/api/v1/orgs" \
-H "Accept: application/json"const response = await fetch("https://api.snyk.io/api/v1/orgs", {
method: "GET",
headers: {
"Accept": "application/json",
},
});
const data = await response.json();
console.log(data);import requests
response = requests.request(
"GET",
"https://api.snyk.io/api/v1/orgs",
headers={
"Accept": "application/json",
},
timeout=30,
)
print(response.json())Endpoints
| Method | Path | What it does |
|---|---|---|
| POST | /group/{groupId}/audit | Get group level audit logs |
| GET | /group/{groupId}/members | List all members in a group |
| POST | /group/{groupId}/org/{orgId}/members | Add a member to an organization within a group |
| GET | /group/{groupId}/orgs | List all organizations in a group |
| GET | /group/{groupId}/roles | List all roles in a group |
| GET | /group/{groupId}/settings | View group settings |
| PUT | /group/{groupId}/settings | Update group settings |
| GET | /group/{groupId}/tags | List all tags in a group |
| POST | /group/{groupId}/tags/delete | Delete tag from group |
| POST | /monitor/dep-graph | Monitor Dep Graph |
| POST | /org | Create a new organization |
| DELETE | /org/{orgId} | Remove organization |
| POST | /org/{orgId}/audit | Get organization level audit logs |
| POST | /org/{orgId}/dependencies | List all dependencies |
| GET | /org/{orgId}/entitlement/{entitlementKey} | Get an organization's entitlement value |
| GET | /org/{orgId}/entitlements | List all entitlements |
| GET | /org/{orgId}/integrations | List |
| POST | /org/{orgId}/integrations | Add new integration |
| PUT | /org/{orgId}/integrations/{integrationId} | Update existing integration |
| DELETE | /org/{orgId}/integrations/{integrationId}/authentication | Delete credentials |
| POST | /org/{orgId}/integrations/{integrationId}/authentication/provision-token | Provision new broker token |
| POST | /org/{orgId}/integrations/{integrationId}/authentication/switch-token | Switch between broker tokens |
| POST | /org/{orgId}/integrations/{integrationId}/clone | Clone an integration (with settings and credentials) |
| POST | /org/{orgId}/integrations/{integrationId}/import | Import targets |
| GET | /org/{orgId}/integrations/{integrationId}/import/{jobId} | Get import job details |
| GET | /org/{orgId}/integrations/{integrationId}/settings | Retrieve |
| PUT | /org/{orgId}/integrations/{integrationId}/settings | Update |
| GET | /org/{orgId}/integrations/{type} | Get existing integration by type |
| POST | /org/{orgId}/invite | Invite users |
| POST | /org/{orgId}/licenses | List all licenses |
| GET | /org/{orgId}/members | List Members |
| PUT | /org/{orgId}/members/update/{userId} | Update a member's role in the organization |
| PUT | /org/{orgId}/members/{userId} | Update a member in the organization |
| DELETE | /org/{orgId}/members/{userId} | Remove a member from the organization |
| GET | /org/{orgId}/notification-settings | Get organization notification settings |
| PUT | /org/{orgId}/notification-settings | Set notification settings |
| GET | /org/{orgId}/project/{projectId} | Retrieve a single project |
| PUT | /org/{orgId}/project/{projectId} | Update a project |
| DELETE | /org/{orgId}/project/{projectId} | Delete a project |
| POST | /org/{orgId}/project/{projectId}/activate | Activate |
| POST | /org/{orgId}/project/{projectId}/aggregated-issues | List all Aggregated issues |
| POST | /org/{orgId}/project/{projectId}/attributes | Applying attributes |
| POST | /org/{orgId}/project/{projectId}/deactivate | Deactivate |
| GET | /org/{orgId}/project/{projectId}/dep-graph | Get Project dependency graph |
| POST | /org/{orgId}/project/{projectId}/history | List all project snapshots |
| POST | /org/{orgId}/project/{projectId}/history/{snapshotId}/aggregated-issues | List all project snapshot aggregated issues |
| GET | /org/{orgId}/project/{projectId}/history/{snapshotId}/issue/{issueId}/paths | List all project snapshot issue paths |
| GET | /org/{orgId}/project/{projectId}/ignore/{issueId} | Retrieve ignore |
| POST | /org/{orgId}/project/{projectId}/ignore/{issueId} | Add ignore |
| PUT | /org/{orgId}/project/{projectId}/ignore/{issueId} | Replace ignores |
| DELETE | /org/{orgId}/project/{projectId}/ignore/{issueId} | Delete ignores |
| GET | /org/{orgId}/project/{projectId}/ignores | List all ignores |
| POST | /org/{orgId}/project/{projectId}/issue/{issueId}/jira-issue | Create jira issue |
| GET | /org/{orgId}/project/{projectId}/issue/{issueId}/paths | List all project issue paths |
| GET | /org/{orgId}/project/{projectId}/jira-issues | List all jira issues |
| PUT | /org/{orgId}/project/{projectId}/move | Move project to a different organization |
| GET | /org/{orgId}/project/{projectId}/settings | List project settings |
| PUT | /org/{orgId}/project/{projectId}/settings | Update project settings |
| DELETE | /org/{orgId}/project/{projectId}/settings | Delete project settings |
| POST | /org/{orgId}/project/{projectId}/tags | Add a tag to a project |
| POST | /org/{orgId}/project/{projectId}/tags/remove | Remove a tag from a project |
| POST | /org/{orgId}/projects | List all projects |
| GET | /org/{orgId}/provision | List pending user provisions |
| POST | /org/{orgId}/provision | Provision a user to the organization |
| DELETE | /org/{orgId}/provision | Delete pending user provision |
| GET | /org/{orgId}/settings | View organization settings |
| PUT | /org/{orgId}/settings | Update organization settings |
| GET | /org/{orgId}/webhooks | List webhooks |
| POST | /org/{orgId}/webhooks | Create a webhook |
| GET | /org/{orgId}/webhooks/{webhookId} | Retrieve a webhook |
| DELETE | /org/{orgId}/webhooks/{webhookId} | Delete a webhook |
| POST | /org/{orgId}/webhooks/{webhookId}/ping | Ping a webhook |
| GET | /orgs | List all the organizations a user belongs to |
| POST | /reporting/counts/issues | Get issue counts |
| POST | /reporting/counts/issues/latest | Get latest issue counts |
| POST | /reporting/counts/projects | Get project counts |
| POST | /reporting/counts/projects/latest | Get latest project counts |
| POST | /reporting/counts/tests | Get test counts |
| POST | /reporting/issues/ | Get list of issues |
| POST | /reporting/issues/latest | Get list of latest issues |
| POST | /test/composer | Test composer.json & composer.lock file |
| POST | /test/dep-graph | Test Dep Graph |
| POST | /test/golangdep | Test Gopkg.toml & Gopkg.lock File |
| POST | /test/govendor | Test vendor.json File |
| POST | /test/gradle | Test gradle file |
| GET | /test/gradle/{group}/{name}/{version} | Test for issues in a public package by group, name and version |
| POST | /test/maven | Test maven file |
| GET | /test/maven/{groupId}/{artifactId}/{version} | Test for issues in a public package by group id, artifact id and version |
| POST | /test/npm | Test package.json & package-lock.json File |
| GET | /test/npm/{packageName}/{version} | Test for issues in a public package by name and version |
| POST | /test/pip | Test requirements.txt file |
| GET | /test/pip/{packageName}/{version} | Test for issues in a public package by name and version |
| POST | /test/rubygems | Test gemfile.lock file |
| GET | /test/rubygems/{gemName}/{version} | Test for issues in a public gem by name and version |
| POST | /test/sbt | Test sbt file |
| GET | /test/sbt/{groupId}/{artifactId}/{version} | Test for issues in a public package by group id, artifact id and version |
| POST | /test/yarn | Test package.json & yarn.lock File |
| GET | /user/me | Get My Details |
| GET | /user/me/notification-settings/org/{orgId} | Get organization notification settings |
| PUT | /user/me/notification-settings/org/{orgId} | Modify organization notification settings |
Showing the first 100 of 103 endpoints; the full list is in the documentation.
Questions
Does the Snyk API API need an API key?
No. The Snyk API API can be called without an API key or sign-up, which makes it handy for prototypes and front-end demos.
Does the Snyk API API support HTTPS?
Yes, the Snyk API API is served over HTTPS.
How many endpoints does the Snyk API API have?
Its OpenAPI description lists 103 endpoints in version 1.0.0. The first 100 are shown on this page.
What are alternatives to the Snyk API API?
Other Development APIs include Cloudflare, Azure DevOps, IPify, App Store Connect API, StackExchange.
Similar development APIs
Compare alternatives →Cloudflare
DevelopmentManage DNS, CDN, Workers and other services; documented with an official OpenAPI 3.0 spec
Azure DevOps
DevelopmentThe Azure DevOps basic components of a REST API request/response pair
IPify
DevelopmentA simple IP Address API
App Store Connect API
DevelopmentThe data structure that represents an app store connect api resource.
StackExchange
DevelopmentQ&A forum for developers
IPinfo
DevelopmentAnother simple IP Address API
Listed from APIs.guru (CC0).