Snyk Targets API

The Targets API from Snyk — 2 operation(s) for targets.

OpenAPI Specification

snyk-targets-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Snyk AccessRequests Targets API
  version: REST
servers:
- description: Snyk REST API
  url: https://api.snyk.io/rest
security:
- APIToken: []
- BearerAuth: []
tags:
- name: Targets
paths:
  /orgs/{org_id}/targets:
    get:
      description: 'Get a list of an organization''s targets.


        #### Required permissions


        - `View Projects (org.project.read)`'
      operationId: getOrgsTargets
      parameters:
      - $ref: '#/components/parameters/Version'
      - $ref: '#/components/parameters/StartingAfter'
      - $ref: '#/components/parameters/EndingBefore'
      - description: Calculate total amount of filtered results
        in: query
        name: count
        schema:
          type: boolean
      - description: Number of results to return per page
        example: 10
        in: query
        name: limit
        schema:
          default: 10
          format: int32
          maximum: 100
          minimum: 1
          type: integer
      - description: The id of the org to return a list of targets
        in: path
        name: org_id
        required: true
        schema:
          format: uuid
          type: string
      - description: Return targets that match the provided value of is_private
        in: query
        name: is_private
        schema:
          type: boolean
      - description: Return only the targets that has projects
        in: query
        name: exclude_empty
        schema:
          default: true
          type: boolean
      - description: Return targets that match the provided remote_url.
        in: query
        name: url
        schema:
          type: string
      - description: Return targets that match the provided source_types
        explode: false
        in: query
        name: source_types
        schema:
          items:
            enum:
            - bitbucket-server
            - gitlab
            - github-enterprise
            - bitbucket-cloud
            - bitbucket-connect-app
            - azure-repos
            - github
            - github-cloud-app
            - github-server-app
            - cli
            - docker-hub
            - in-memory-fs
            - acr
            - ecr
            - gcr
            - artifactory-cr
            - harbor-cr
            - quay-cr
            - github-cr
            - nexus-cr
            - nexus-private-repo
            - digitalocean-cr
            - gitlab-cr
            - google-artifact-cr
            - heroku
            - kubernetes
            - api
            - aws-lambda
            - azure-functions
            - cloud-foundry
            - pivotal
            - ibm-cloud
            - terraform-cloud
            type: string
          type: array
        style: form
      - description: Return targets with display names starting with the provided string
        in: query
        name: display_name
        schema:
          type: string
      - description: 'Return only targets which have been created at or after the specified date.

          '
        example: '2022-01-01T16:00:00Z'
        in: query
        name: created_gte
        schema:
          format: date-time
          type: string
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    items:
                      $ref: '#/components/schemas/PublicTarget'
                    type: array
                  jsonapi:
                    $ref: '#/components/schemas/JsonApi'
                  links:
                    $ref: '#/components/schemas/Links'
                  meta:
                    additionalProperties: false
                    example:
                      count: 3
                    properties:
                      count:
                        type: number
                    type: object
                required:
                - jsonapi
                - data
                - links
                type: object
          description: A list of targets is returned for the targeted org
          headers:
            deprecation:
              $ref: '#/components/headers/DeprecationHeader'
            snyk-request-id:
              $ref: '#/components/headers/RequestIdResponseHeader'
            snyk-version-lifecycle-stage:
              $ref: '#/components/headers/VersionStageResponseHeader'
            snyk-version-requested:
              $ref: '#/components/headers/VersionRequestedResponseHeader'
            snyk-version-served:
              $ref: '#/components/headers/VersionServedResponseHeader'
            sunset:
              $ref: '#/components/headers/SunsetHeader'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
      summary: Get targets by org ID
      tags:
      - Targets
      x-snyk-api-lifecycle: released
      x-snyk-api-releases:
      - 2021-08-20~beta
      - '2024-02-21'
      x-snyk-api-resource: targets
      x-snyk-api-stability: ga
      x-snyk-api-version: '2024-02-21'
      x-stability-level: stable
  /orgs/{org_id}/targets/{target_id}:
    delete:
      description: 'Delete the specified target.


        #### Required permissions


        - `Remove Projects (org.project.delete)`'
      operationId: deleteOrgsTarget
      parameters:
      - $ref: '#/components/parameters/Version'
      - description: The id of the org to delete
        in: path
        name: org_id
        required: true
        schema:
          format: uuid
          type: string
      - description: The id of the target to delete
        in: path
        name: target_id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '204':
          description: The target is deleted with all projects, if it is found in the specified org.
          headers:
            deprecation:
              $ref: '#/components/headers/DeprecationHeader'
            snyk-request-id:
              $ref: '#/components/headers/RequestIdResponseHeader'
            snyk-version-lifecycle-stage:
              $ref: '#/components/headers/VersionStageResponseHeader'
            snyk-version-requested:
              $ref: '#/components/headers/VersionRequestedResponseHeader'
            snyk-version-served:
              $ref: '#/components/headers/VersionServedResponseHeader'
            sunset:
              $ref: '#/components/headers/SunsetHeader'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
      summary: Delete target by target ID
      tags:
      - Targets
      x-snyk-api-lifecycle: released
      x-snyk-api-releases:
      - 2021-09-29~beta
      - 2023-06-23~beta
      - '2024-02-21'
      x-snyk-api-resource: targets
      x-snyk-api-stability: ga
      x-snyk-api-version: '2024-02-21'
      x-stability-level: stable
    get:
      description: 'Get a specified target for an organization.


        #### Required permissions


        - `View Projects (org.project.read)`'
      operationId: getOrgsTarget
      parameters:
      - $ref: '#/components/parameters/Version'
      - description: The id of the org to return the target from
        in: path
        name: org_id
        required: true
        schema:
          format: uuid
          type: string
      - description: The id of the target to return
        in: path
        name: target_id
        required: true
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                additionalProperties: false
                properties:
                  data:
                    $ref: '#/components/schemas/PublicTarget'
                  jsonapi:
                    $ref: '#/components/schemas/JsonApi'
                  links:
                    $ref: '#/components/schemas/Links'
                required:
                - jsonapi
                - data
                type: object
          description: A single target is returned if it is found in the specified org
          headers:
            deprecation:
              $ref: '#/components/headers/DeprecationHeader'
            snyk-request-id:
              $ref: '#/components/headers/RequestIdResponseHeader'
            snyk-version-lifecycle-stage:
              $ref: '#/components/headers/VersionStageResponseHeader'
            snyk-version-requested:
              $ref: '#/components/headers/VersionRequestedResponseHeader'
            snyk-version-served:
              $ref: '#/components/headers/VersionServedResponseHeader'
            sunset:
              $ref: '#/components/headers/SunsetHeader'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
      summary: Get target by target ID
      tags:
      - Targets
      x-snyk-api-lifecycle: released
      x-snyk-api-releases:
      - 2021-08-20~beta
      - '2024-02-21'
      x-snyk-api-resource: targets
      x-snyk-api-stability: ga
      x-snyk-api-version: '2024-02-21'
      x-stability-level: stable
components:
  parameters:
    EndingBefore:
      description: Return the page of results immediately before this cursor
      example: v1.eyJpZCI6IjExMDAifQo=
      in: query
      name: ending_before
      schema:
        type: string
    StartingAfter:
      description: Return the page of results immediately after this cursor
      example: v1.eyJpZCI6IjEwMDAifQo=
      in: query
      name: starting_after
      schema:
        type: string
    Version:
      description: The requested version of the endpoint to process the request
      example: '2026-03-25'
      in: query
      name: version
      required: true
      schema:
        $ref: '#/components/schemas/QueryVersion'
  headers:
    SunsetHeader:
      description: 'A header containing the date of when the underlying endpoint will be removed. This header is only present if the endpoint has been deprecated. For information purposes only. Returned as a date in the format: YYYY-MM-DD'
      example: '2021-08-02'
      schema:
        format: date
        type: string
    VersionRequestedResponseHeader:
      description: A header containing the version of the endpoint requested by the caller.
      example: '2026-03-25'
      schema:
        $ref: '#/components/schemas/QueryVersion'
    VersionServedResponseHeader:
      description: A header containing the version of the endpoint that was served by the API.
      example: '2026-03-25'
      schema:
        $ref: '#/components/schemas/ActualVersion'
    VersionStageResponseHeader:
      description: 'A header containing the version stage of the endpoint. This stage describes the guarantees snyk provides surrounding stability of the endpoint.

        '
      schema:
        enum:
        - wip
        - experimental
        - beta
        - ga
        - deprecated
        - sunset
        example: ga
        type: string
    RequestIdResponseHeader:
      description: 'A header containing a unique id used for tracking this request. If you are reporting an issue to Snyk it''s very helpful to provide this ID.

        '
      example: 4b58e274-ec62-4fab-917b-1d2c48d6bdef
      schema:
        format: uuid
        type: string
    DeprecationHeader:
      description: 'A header containing the deprecation date of the underlying endpoint. For more information, please refer to the deprecation header RFC:

        https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html

        '
      example: '2021-07-01T00:00:00Z'
      schema:
        format: date-time
        type: string
  schemas:
    ActualVersion:
      description: Resolved API version
      example: '2026-03-25'
      pattern: ^((([0-9]{4})-([0-1][0-9]))-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?)$
      type: string
    JsonApi:
      additionalProperties: false
      example:
        version: '1.0'
      properties:
        version:
          description: Version of the JSON API specification this server supports.
          example: '1.0'
          pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)$
          type: string
      required:
      - version
      type: object
    QueryVersion:
      description: Requested API version
      example: '2026-03-25'
      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))?))$
      type: string
    ErrorDocument:
      additionalProperties: false
      example:
        errors:
        - detail: Permission denied for this resource
          status: '403'
        jsonapi:
          version: '1.0'
      properties:
        errors:
          example:
          - detail: Permission denied for this resource
            status: '403'
          items:
            additionalProperties: false
            example:
              detail: Not Found
              status: '404'
            properties:
              code:
                description: An application-specific error code, expressed as a string value.
                example: entity-not-found
                type: string
              detail:
                description: A human-readable explanation specific to this occurrence of the problem.
                example: 'The request was missing these required fields: ...'
                type: string
              id:
                description: A unique identifier for this particular occurrence of the problem.
                example: f16c31b5-6129-4571-add8-d589da9be524
                format: uuid
                type: string
              links:
                additionalProperties: false
                description: A link that leads to further details about this particular occurrance of the problem.
                example:
                  about: https://example.com/about_this_error
                properties:
                  about:
                    example: https://example.com/api/resource
                    oneOf:
                    - description: A string containing the link’s URL.
                      example: https://example.com/api/resource
                      type: string
                    - additionalProperties: false
                      example:
                        href: https://example.com/api/resource
                      properties:
                        href:
                          description: A string containing the link’s URL.
                          example: https://example.com/api/resource
                          type: string
                        meta:
                          additionalProperties: true
                          description: Free-form object that may contain non-standard information.
                          example:
                            key1: value1
                            key2:
                              sub_key: sub_value
                            key3:
                            - array_value1
                            - array_value2
                          type: object
                      required:
                      - href
                      type: object
                type: object
              meta:
                additionalProperties: true
                example:
                  key: value
                type: object
              source:
                additionalProperties: false
                example:
                  pointer: /data/attributes
                properties:
                  parameter:
                    description: A string indicating which URI query parameter caused the error.
                    example: param1
                    type: string
                  pointer:
                    description: A JSON Pointer [RFC6901] to the associated entity in the request document.
                    example: /data/attributes
                    type: string
                type: object
              status:
                description: The HTTP status code applicable to this problem, expressed as a string value.
                example: '400'
                pattern: ^[45]\d\d$
                type: string
              title:
                description: A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
                example: Bad request
                type: string
            required:
            - status
            - detail
            type: object
          minItems: 1
          type: array
        jsonapi:
          additionalProperties: false
          example:
            version: '1.0'
          properties:
            version:
              description: Version of the JSON API specification this server supports.
              example: '1.0'
              pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)$
              type: string
          required:
          - version
          type: object
      required:
      - jsonapi
      - errors
      type: object
    Links:
      additionalProperties: false
      properties:
        first:
          $ref: '#/components/schemas/LinkProperty'
        last:
          $ref: '#/components/schemas/LinkProperty'
        next:
          $ref: '#/components/schemas/LinkProperty'
        prev:
          $ref: '#/components/schemas/LinkProperty'
        related:
          $ref: '#/components/schemas/LinkProperty'
        self:
          $ref: '#/components/schemas/LinkProperty'
      type: object
    PublicTarget:
      additionalProperties: false
      properties:
        attributes:
          additionalProperties: false
          properties:
            created_at:
              description: The creation date of the target
              example: '2022-09-01T00:00:00Z'
              format: date-time
              type: string
            display_name:
              description: 'The human readable name that represents this target. These are generated based on the provided properties, and the source.

                '
              example: snyk-fixtures/goof
              type: string
            is_private:
              description: If the target is private, or publicly accessible
              example: false
              type: boolean
            url:
              description: The URL for the resource.
              example: http://github.com/snyk/local-goof
              nullable: true
              type: string
          required:
          - display_name
          - url
          - is_private
          type: object
        id:
          description: The id of this target
          example: 55a348e2-c3ad-4bbc-b40e-9b232d1f4121
          format: uuid
          type: string
        relationships:
          additionalProperties: false
          properties:
            integration:
              additionalProperties: false
              description: The configured integration which this target relates to
              properties:
                data:
                  additionalProperties: false
                  properties:
                    attributes:
                      additionalProperties: false
                      properties:
                        integration_type:
                          description: The human readable name for this type of integration
                          example: gitlab
                          type: string
                      required:
                      - integration_type
                      type: object
                    id:
                      example: 7667dae6-602c-45d9-baa9-79e1a640f199
                      format: uuid
                      nullable: true
                      type: string
                    type:
                      description: Content type.
                      example: integration
                      type: string
                  required:
                  - id
                  - type
                  - attributes
                  type: object
              required:
              - data
              type: object
            organization:
              additionalProperties: false
              description: The organization which owns this target
              properties:
                data:
                  additionalProperties: false
                  properties:
                    id:
                      example: e661d4ef-5ad5-4cef-ad16-5157cefa83f5
                      format: uuid
                      type: string
                    type:
                      description: Content type.
                      example: organization
                      type: string
                  required:
                  - type
                  - id
                  type: object
              required:
              - data
              type: object
          required:
          - organization
          - integration
          type: object
        type:
          description: Content type.
          example: target
          type: string
      required:
      - type
      - id
      - attributes
      type: object
    LinkProperty:
      example: https://example.com/api/resource
      oneOf:
      - description: A string containing the link’s URL.
        example: https://example.com/api/resource
        type: string
      - additionalProperties: false
        example:
          href: https://example.com/api/resource
        properties:
          href:
            description: A string containing the link’s URL.
            example: https://example.com/api/resource
            type: string
          meta:
            additionalProperties: true
            description: Free-form object that may contain non-standard information.
            example:
              key1: value1
              key2:
                sub_key: sub_value
              key3:
              - array_value1
              - array_value2
            type: object
        required:
        - href
        type: object
  responses:
    '400':
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/ErrorDocument'
      description: 'Bad Request: A parameter provided as a part of the request was invalid.'
      headers:
        deprecation:
          $ref: '#/components/headers/DeprecationHeader'
        snyk-request-id:
          $ref: '#/components/headers/RequestIdResponseHeader'
        snyk-version-lifecycle-stage:
          $ref: '#/components/headers/VersionStageResponseHeader'
        snyk-version-requested:
          $ref: '#/components/headers/VersionRequestedResponseHeader'
        snyk-version-served:
          $ref: '#/components/headers/VersionServedResponseHeader'
        sunset:
          $ref: '#/components/headers/SunsetHeader'
    '500':
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/ErrorDocument'
      description: 'Internal Server Error: An error was encountered while attempting to process the request.'
      headers:
        deprecation:
          $ref: '#/components/headers/DeprecationHeader'
        snyk-request-id:
          $ref: '#/components/headers/RequestIdResponseHeader'
        snyk-version-lifecycle-stage:
          $ref: '#/components/headers/VersionStageResponseHeader'
        snyk-version-requested:
          $ref: '#/components/headers/VersionRequestedResponseHeader'
        snyk-version-served:
          $ref: '#/components/headers/VersionServedResponseHeader'
        sunset:
          $ref: '#/components/headers/SunsetHeader'
    '403':
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/ErrorDocument'
      description: 'Forbidden: the request requires an authentication token with more or different permissions.'
      headers:
        deprecation:
          $ref: '#/components/headers/DeprecationHeader'
        snyk-request-id:
          $ref: '#/components/headers/RequestIdResponseHeader'
        snyk-version-lifecycle-stage:
          $ref: '#/components/headers/VersionStageResponseHeader'
        snyk-version-requested:
          $ref: '#/components/headers/VersionRequestedResponseHeader'
        snyk-version-served:
          $ref: '#/components/headers/VersionServedResponseHeader'
        sunset:
          $ref: '#/components/headers/SunsetHeader'
    '404':
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/ErrorDocument'
      description: 'Not Found: The resource being operated on could not be found.'
      headers:
        deprecation:
          $ref: '#/components/headers/DeprecationHeader'
        snyk-request-id:
          $ref: '#/components/headers/RequestIdResponseHeader'
        snyk-version-lifecycle-stage:
          $ref: '#/components/headers/VersionStageResponseHeader'
        snyk-version-requested:
          $ref: '#/components/headers/VersionRequestedResponseHeader'
        snyk-version-served:
          $ref: '#/components/headers/VersionServedResponseHeader'
        sunset:
          $ref: '#/components/headers/SunsetHeader'
    '401':
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/ErrorDocument'
      description: 'Unauthorized: the request requires an authentication token.'
      headers:
        deprecation:
          $ref: '#/components/headers/DeprecationHeader'
        snyk-request-id:
          $ref: '#/components/headers/RequestIdResponseHeader'
        snyk-version-lifecycle-stage:
          $ref: '#/components/headers/VersionStageResponseHeader'
        snyk-version-requested:
          $ref: '#/components/headers/VersionRequestedResponseHeader'
        snyk-version-served:
          $ref: '#/components/headers/VersionServedResponseHeader'
        sunset:
          $ref: '#/components/headers/SunsetHeader'
  securitySchemes:
    APIToken:
      description: API key value must be prefixed with \"Token \".
      in: header
      name: Authorization
      type: apiKey
    BearerAuth:
      scheme: bearer
      type: http
x-snyk-api-version: '2024-10-15'