Import Projects (v1)

This document uses the v1 API. For more details, see the v1 API.

Import targets

post

Request a target to be analyzed for supported Snyk projects via a configured integration. See the Integrations API to configure a new integration.

Path parameters
orgIdstringrequired

The organization ID. The API_KEY must have admin access to this organization.

Example: 4a18d42f-0706-4ad0-b127-24078731fbed
integrationIdstringrequired

The unique identifier for the configured integration. This can be found on the Integration page in the Settings area for all integrations that have been configured.

Example: 9a3e5d90-b782-468a-a042-9a2073736f0b
Body
one ofoptional

Note: Importing targets through a Github (Cloud) integration requires the use of a Snyk personal access/api token.

Responses
curl -L \
  --request POST \
  --url 'https://api.snyk.io/v1/org/{orgId}/integrations/{integrationId}/import' \
  --header 'Content-Type: application/json; charset=utf-8' \
  --data '{
    "target": {
      "owner": "org-security",
      "name": "goof",
      "branch": "main"
    },
    "files": [
      {
        "path": "example/package.json"
      }
    ]
  }'

No body

Get import job details

get
Path parameters
orgIdstringrequired

The organization ID. The API_KEY must have admin access to this organization.

Example: 4a18d42f-0706-4ad0-b127-24078731fbed
integrationIdstringrequired

The unique identifier for the configured integration. This can be found on the Integration page in the Settings area for all integrations that have been configured.

Example: 9a3e5d90-b782-468a-a042-9a2073736f0b
jobIdstringrequired

The ID of the job. This can be found in the Location response header from the corresponding POST request that triggered the import job.

Example: 1a325d9d-b782-468a-a242-9a2073734f0b
Header parameters
Content-Typestring · enumrequired
Example: application/json; charset=utf-8
Options: application/json; charset=utf-8
Responses
curl -L \
  --url 'https://api.snyk.io/v1/org/{orgId}/integrations/{integrationId}/import/{jobId}' \
  --header 'Content-Type: application/json; charset=utf-8'
{
  "id": "dce061f7-ce0f-4ccf-b49b-4335d1205bd9",
  "status": "pending",
  "created": "2018-07-23T15:21:10.611Z",
  "logs": [
    {
      "name": "org1/repo1",
      "created": "2018-07-23T15:21:10.643Z",
      "status": "failed",
      "projects": []
    },
    {
      "name": "org2/repo2",
      "created": "2018-07-23T15:21:10.644Z",
      "status": "complete",
      "projects": [
        {
          "targetFile": "package.json",
          "success": true,
          "projectUrl": "https://api.snyk.io/v1/org/org-name/project/7eeaee25-5f9b-4d05-8818-4cca2c9d9adc"
        }
      ]
    },
    {
      "name": "org3/repo3",
      "created": "2018-07-23T15:21:10.643Z",
      "status": "pending",
      "projects": [
        {
          "targetFile": "package.json",
          "success": true,
          "projectUrl": "https://api.snyk.io/v1/org/org-name/project/0382897c-0617-4429-86df-51187dfd42f6"
        }
      ]
    }
  ]
}

Last updated

Was this helpful?

Revision created

Add comment to emphasize required filters hidden in GitBook collapsed field