Targets

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

Get targets by org ID

Get a list of an organization's targets.

GEThttps://api.snyk.io/rest/orgs/{org_id}/targets
Path parameters
org_id*string (uuid)

The id of the org to return a list of targets

Query parameters
Response

A list of targets is returned for the targeted org

Headers
Body
data*array of PublicTarget (object)
jsonapi*JsonApi (object)
links*Links (object)
metaobject
Request
const response = await fetch('https://api.snyk.io/rest/orgs/{org_id}/targets', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": [
    {
      "attributes": {
        "created_at": "2022-09-01T00:00:00Z",
        "display_name": "snyk-fixtures/goof",
        "is_private": false,
        "url": "http://github.com/snyk/local-goof"
      },
      "id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
      "relationships": {
        "integration": {
          "data": {
            "attributes": {
              "integration_type": "gitlab"
            },
            "id": "7667dae6-602c-45d9-baa9-79e1a640f199",
            "type": "integration"
          }
        },
        "organization": {
          "data": {
            "id": "e661d4ef-5ad5-4cef-ad16-5157cefa83f5",
            "type": "organization"
          }
        }
      },
      "type": "target"
    }
  ],
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "first": "https://example.com/api/resource",
    "last": "https://example.com/api/resource",
    "next": "https://example.com/api/resource",
    "prev": "https://example.com/api/resource",
    "related": "https://example.com/api/resource",
    "self": "https://example.com/api/resource"
  },
  "meta": {
    "count": 3
  }
}

Get target by target ID

Get a specified target for an organization.

GEThttps://api.snyk.io/rest/orgs/{org_id}/targets/{target_id}
Path parameters
org_id*string (uuid)

The id of the org to return the target from

target_id*string (uuid)

The id of the target to return

Query parameters
Response

A single target is returned if it is found in the specified org

Headers
Body
data*PublicTarget (object)
jsonapi*JsonApi (object)
linksLinks (object)
Request
const response = await fetch('https://api.snyk.io/rest/orgs/{org_id}/targets/{target_id}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "attributes": {
      "created_at": "2022-09-01T00:00:00Z",
      "display_name": "snyk-fixtures/goof",
      "is_private": false,
      "url": "http://github.com/snyk/local-goof"
    },
    "id": "55a348e2-c3ad-4bbc-b40e-9b232d1f4121",
    "relationships": {
      "integration": {
        "data": {
          "attributes": {
            "integration_type": "gitlab"
          },
          "id": "7667dae6-602c-45d9-baa9-79e1a640f199",
          "type": "integration"
        }
      },
      "organization": {
        "data": {
          "id": "e661d4ef-5ad5-4cef-ad16-5157cefa83f5",
          "type": "organization"