Tests

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.

Required permissions

  • View Organization (org.read)

  • Test packages (org.package.test)

Authorizations
Path parameters
org_idstring · uuidRequired

The org id

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. to be safe, the

Body

TestRequestBody represents the request body used when creating an Test.

Responses
202

The request has been accepted for processing, but processing has not yet completed.

application/vnd.api+json
post
POST /rest/orgs/{org_id}/tests HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 421

{
  "data": {
    "attributes": {
      "config": {
        "local_policy": {
          "fail_on_upgradable": false,
          "risk_score_threshold": 1,
          "severity_threshold": "critical",
          "suppress_pending_ignores": false
        },
        "publish_report": true,
        "timeout": {
          "outcome": "pass",
          "seconds": 1
        }
      },
      "subject": {
        "bundle_id": "text",
        "locator": {
          "paths": [
            "text"
          ],
          "type": "local_path"
        },
        "type": "deepcode_bundle"
      },
      "subject_locators": [
        {
          "paths": [
            "package.json"
          ],
          "type": "local_path"
        }
      ]
    },
    "type": "tests"
  }
}
{
  "data": {
    "attributes": {
      "created_at": "2025-09-09T22:02:13.940Z",
      "status": "pending"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "type": "test_jobs"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "related": "https://example.com",
    "self": "https://example.com",
    "ANY_ADDITIONAL_PROPERTY": "https://example.com"
  },
  "meta": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}

Get a test. (Early Access)

get

Get a test.

Required permissions

  • View Organization (org.read)
Authorizations
Path parameters
org_idstring · uuidRequired

The org id

test_idstring · uuidRequired

The test id

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. to be safe, the

Responses
200

Successful API response with a single resource

application/vnd.api+json
get
GET /rest/orgs/{org_id}/tests/{test_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "config": {
        "local_policy": {
          "fail_on_upgradable": false,
          "risk_score_threshold": 1,
          "severity_threshold": "critical",
          "suppress_pending_ignores": false
        },
        "publish_report": true,
        "timeout": {
          "outcome": "pass",
          "seconds": 1
        }
      },
      "created_at": "2025-09-09T22:02:13.940Z",
      "effective_summary": {
        "count": 30,
        "count_by": {
          "result_type": {
            "sast": 12,
            "sca": 18
          },
          "severity": {
            "critical": 2,
            "high": 3,
            "low": 15,
            "medium": 10
          }
        }
      },
      "outcome": {
        "breached_policies": {
          "ids": [
            "123e4567-e89b-12d3-a456-426614174000"
          ],
          "local_policy": true
        },
        "reason": "policy_breach",
        "result": "pass"
      },
      "raw_summary": {
        "count": 30,
        "count_by": {
          "result_type": {
            "sast": 12,
            "sca": 18
          },
          "severity": {
            "critical": 2,
            "high": 3,
            "low": 15,
            "medium": 10
          }
        }
      },
      "state": {
        "errors": [
          {
            "code": "text",
            "detail": "text",
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "links": {
              "about": "https://example.com",
              "ANY_ADDITIONAL_PROPERTY": "https://example.com"
            },
            "meta": {},
            "source": {
              "parameter": "text",
              "pointer": "text"
            },
            "status": "text",
            "title": "text"
          }
        ],
        "execution": "pending",
        "warnings": [
          {
            "code": "text",
            "detail": "text",
            "id": "123e4567-e89b-12d3-a456-426614174000",
            "links": {
              "about": "https://example.com",
              "ANY_ADDITIONAL_PROPERTY": "https://example.com"
            },
            "meta": {},
            "source": {
              "parameter": "text",
              "pointer": "text"
            },
            "status": "text",
            "title": "text"
          }
        ]
      },
      "subject": {
        "bundle_id": "text",
        "locator": {
          "paths": [
            "text"
          ],
          "type": "local_path"
        },
        "type": "deepcode_bundle"
      },
      "subject_locators": [
        {
          "paths": [
            "package.json"
          ],
          "type": "local_path"
        }
      ]
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "links": {
      "findings": "https://example.com"
    },
    "type": "tests"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "related": "https://example.com",
    "self": "https://example.com",
    "ANY_ADDITIONAL_PROPERTY": "https://example.com"
  },
  "meta": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}

Get a test job. (Early Access)

get

Get a test job.

Required permissions

  • View Organization (org.read)
Authorizations
Path parameters
org_idstring · uuidRequired

The org id

job_idstring · uuidRequired

The job id

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. to be safe, the

Responses
200

Successful API response with a single resource

application/vnd.api+json
get
GET /rest/orgs/{org_id}/test_jobs/{job_id} HTTP/1.1
Host: api.snyk.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "attributes": {
      "created_at": "2025-09-09T22:02:13.940Z",
      "status": "pending"
    },
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "relationships": {
      "test": {
        "data": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "type": "tests"
        }
      }
    },
    "type": "test_jobs"
  },
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "related": "https://example.com",
    "self": "https://example.com",
    "ANY_ADDITIONAL_PROPERTY": "https://example.com"
  },
  "meta": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}

Last updated

Was this helpful?