Targets

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

Get targets by org ID

get

Get a list of an organization's targets.

Authorizations
Path parameters
org_idstring · uuidrequired

The id of the org to return a list of targets

Query parameters
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
starting_afterstringoptional

Return the page of results immediately after this cursor

Example: v1.eyJpZCI6IjEwMDAifQo=
ending_beforestringoptional

Return the page of results immediately before this cursor

Example: v1.eyJpZCI6IjExMDAifQo=
countbooleanoptional

Calculate total amount of filtered results

limitinteger · int32 · min: 1 · max: 100 · default: 10optional

Number of results to return per page

Example: 10
is_privatebooleanoptional

Return targets that match the provided value of is_private

exclude_emptyboolean · default: trueoptional

Return only the targets that has projects

urlstringoptional

Return targets that match the provided remote_url.

source_typesstring · enum[]optional

Return targets that match the provided source_types

display_namestringoptional

Return targets with display names starting with the provided string

created_gtestring · date-timeoptional

Return only targets which have been created at or after the specified date.

Example: 2022-01-01T16:00:00Z
Responses
curl -L \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/targets?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "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

Get a specified target for an organization.

Authorizations
Path parameters
org_idstring · uuidrequired

The id of the org to return the target from

target_idstring · uuidrequired

The id of the target to return

Query parameters
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Responses
curl -L \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/targets/{target_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "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"
  }
}

Delete target by target ID

delete

Delete the specified target.

Authorizations
Path parameters
org_idstring · uuidrequired

The id of the org to delete

target_idstring · uuidrequired

The id of the target to delete

Query parameters
versionstringrequired

Requested API version

Example: 2021-06-04
Pattern: ^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$
Responses
curl -L \
  --request DELETE \
  --url 'https://api.snyk.io/rest/orgs/{org_id}/targets/{target_id}?version=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'

No body

Last updated

Was this helpful?

Revision created

Add comment to emphasize required filters hidden in GitBook collapsed field