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
or
or
or
or
or
or
or
or
or
or
or
anyOptional

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

Example: {"target":{"owner":"org-security","name":"goof","branch":"main"},"files":[{"path":"example/package.json"}]}
Responses
201Success
post
POST /v1/org/{orgId}/integrations/{integrationId}/import HTTP/1.1
Host: api.snyk.io
Content-Type: application/json; charset=utf-8
Accept: */*
Content-Length: 107

{
  "target": {
    "owner": "org-security",
    "name": "goof",
    "branch": "main"
  },
  "files": [
    {
      "path": "example/package.json"
    }
  ]
}
201Success

No content

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 · enumRequiredExample: application/json; charset=utf-8Possible values:
Responses
200Success
application/json; charset=utf-8
Responseall of
and
anyOptionalExample: {"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"}]}]}
get
GET /v1/org/{orgId}/integrations/{integrationId}/import/{jobId} HTTP/1.1
Host: api.snyk.io
Content-Type: application/json; charset=utf-8
Accept: */*
200Success
{
  "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