githubEdit

Tests

circle-info

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

Create a new test. (Early Access)

post

Create a new test.

Provide the items to be tested by Snyk as well as any configuration parameters for the test to be run.

Currently, scans using the Open Source (SCA) and Code Analysis (SAST) scanners can be run using the Test API.

Tests begun through the Test API yield lists of Findings when finished. These Findings can be retrieved using the ListFindings endpoint.

Successfully creating a new Test will yield a Job ID that can be used to poll for the Test's completion via the GetJob endpoint.

Required permissions

  • View Organization (org.read)

  • Test packages (org.package.test)

Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
org_idstring · uuidRequired

Snyk Org ID under which to run or query information about a Job or Test.

Query parameters
versionstringRequired

The API version requested.

Header parameters
snyk-request-idstring · uuidOptional

A unique ID assigned to each API request, for tracing and troubleshooting.

Snyk clients can optionally provide this ID.

snyk-interaction-idstring · min: 36 · max: 128Optional

Identifies the Snyk client interaction in which this API request occurs.

The identifier is an opaque string. though at the time of writing it may either be a uuid or a urn containing a uuid and some metadata.

Body

TestRequestBody represents the request body used when creating an Test.

Responses
post
/orgs/{org_id}/tests

Get a test. (Early Access)

get

Get a test.

A Test returned through this endpoint is intended to be a completed Test with results. The data returned through this endpoint does not contain the Findings for the Test, but a description of the Test that was run and its status.

Tests that completed successfully are marked with an appropriate outcome according to the configured Thresholds.

Facts about the Test (e.g. how many dependencies were present in a Tested SBOM) are attached to this response as well as a summary of the Findings uncovered during the Test.

Any Errors or Warnings that occurred during the Test will be present in the response from this endpoint.

The response will also contain a link to the first page of the Test's Findings.

Required permissions

  • View Organization (org.read)
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
org_idstring · uuidRequired

Snyk Org ID under which to run or query information about a Job or Test.

test_idstring · uuidRequired

Test ID returned from the Test API to query.

Query parameters
versionstringRequired

The API version requested.

Header parameters
snyk-request-idstring · uuidOptional

A unique ID assigned to each API request, for tracing and troubleshooting.

Snyk clients can optionally provide this ID.

snyk-interaction-idstring · min: 36 · max: 128Optional

Identifies the Snyk client interaction in which this API request occurs.

The identifier is an opaque string. though at the time of writing it may either be a uuid or a urn containing a uuid and some metadata.

Responses
chevron-right
200

Successful API response with a single resource

application/vnd.api+json
get
/orgs/{org_id}/tests/{test_id}

Get a test job. (Early Access)

get

Get a test job.

The Test API is Asynchronous, and Tests begun through the API are assigned a Job ID which references the in-progress Test. The Job ID is provided in a successful response from the CreateTest endpoint.

This endpoint is used to poll for the status of a Test using its associated Job ID.

When the Job is Finished and the Test is ready for consumption, the Related link will be populated in the response with a link to the finished Test entity.

Required permissions

  • View Organization (org.read)
Authorizations
AuthorizationstringRequired

API key value must be prefixed with "Token ".

Path parameters
org_idstring · uuidRequired

Snyk Org ID under which to run or query information about a Job or Test.

job_idstring · uuidRequired

Job ID returned from the Test API to query.

Query parameters
versionstringRequired

The API version requested.

Header parameters
snyk-request-idstring · uuidOptional

A unique ID assigned to each API request, for tracing and troubleshooting.

Snyk clients can optionally provide this ID.

snyk-interaction-idstring · min: 36 · max: 128Optional

Identifies the Snyk client interaction in which this API request occurs.

The identifier is an opaque string. though at the time of writing it may either be a uuid or a urn containing a uuid and some metadata.

Responses
chevron-right
200

Successful API response with a single resource

application/vnd.api+json
get
/orgs/{org_id}/test_jobs/{job_id}

Last updated

Was this helpful?