Binarly Scan API

The Scan API from Binarly — 5 operation(s) for scan.

OpenAPI Specification

binarly-scan-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Binarly Assistant Scan API
  version: 4.275.2
security:
- auth: []
tags:
- name: Scan
paths:
  /api/v4/products/{productId}/images/{imageId}/scans:
    get:
      summary: List Scans
      operationId: ListScans
      x-permission: products.view
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithScans'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
    post:
      summary: Create Scan
      operationId: CreateScan
      x-permission: images.create
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      responses:
        '201':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scan'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
  /api/v4/products/{productId}/images/{imageId}/scans/{scanId}:
    get:
      summary: Get Scan by ID
      operationId: GetScan
      x-permission: products.view
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      - $ref: '#/components/parameters/PathScanId'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scan'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
  /api/v4/products/{productId}/images/{imageId}/scans/{scanId}/states:
    post:
      summary: Create Scan State
      operationId: CreateScanState
      x-permission: images.create
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      - $ref: '#/components/parameters/PathScanId'
      requestBody:
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/WithScanStateType'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Scan'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /api/v4/products/{productId}/images/{imageId}/scans/{scanId}/components/{componentId}:
    get:
      summary: Get Component by ID
      operationId: GetComponent
      x-permission: products.view
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      - $ref: '#/components/parameters/PathScanId'
      - name: componentId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Component'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
  /api/v4/products/{productId}/images/{imageId}/scans/{scanId}/components:
    get:
      summary: List Components
      operationId: ListComponents
      x-permission: products.view
      tags:
      - Scan
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      - $ref: '#/components/parameters/PathScanId'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecursiveComponents'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
components:
  responses:
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadGateway:
      description: Bad Gateway
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    WithOptionalResourceType:
      type: object
      properties:
        resourceType:
          $ref: '#/components/schemas/ResourceType'
    WithPath:
      type: object
      required:
      - path
      properties:
        path:
          type: string
    WithOptionalParent:
      type: object
      properties:
        parent:
          $ref: '#/components/schemas/Parent'
    Scan:
      allOf:
      - $ref: '#/components/schemas/WithId'
      - $ref: '#/components/schemas/WithCreateTime'
      - $ref: '#/components/schemas/WithOptionalParent'
      - $ref: '#/components/schemas/WithAuthor'
      - $ref: '#/components/schemas/WithOptionalLatestScanState'
    ErrorDetail:
      type: object
      required:
      - error
      properties:
        reason:
          type: string
          x-go-type-skip-optional-pointer: true
        field:
          type: string
          x-go-type-skip-optional-pointer: true
        service:
          type: string
          x-go-type-skip-optional-pointer: true
    User:
      readOnly: true
      allOf:
      - $ref: '#/components/schemas/WithUserId'
      - $ref: '#/components/schemas/WithOptionalId'
      - $ref: '#/components/schemas/WithOptionalCreateTime'
      - $ref: '#/components/schemas/WithOptionalEmail'
      - $ref: '#/components/schemas/WithOptionalUserStatus'
      - $ref: '#/components/schemas/WithOptionalResourceType'
    ScanState:
      allOf:
      - $ref: '#/components/schemas/WithId'
      - $ref: '#/components/schemas/WithScanStateType'
      - $ref: '#/components/schemas/WithOptionalParent'
      - $ref: '#/components/schemas/WithCreateTime'
      - $ref: '#/components/schemas/WithOptionalAuthor'
      - $ref: '#/components/schemas/WithOptionalSource'
    WithAuthor:
      type: object
      required:
      - author
      properties:
        author:
          $ref: '#/components/schemas/User'
    WithOptionalLatestScanState:
      type: object
      properties:
        latestScanState:
          $ref: '#/components/schemas/ScanState'
    WithPlatformId:
      type: object
      required:
      - id
      properties:
        id:
          type: string
    RecursiveComponent:
      allOf:
      - $ref: '#/components/schemas/WithPlatformId'
      - $ref: '#/components/schemas/WithName'
      - $ref: '#/components/schemas/WithPath'
      - $ref: '#/components/schemas/WithOptionalContainerPath'
      - $ref: '#/components/schemas/WithOptionalAttributes'
      - $ref: '#/components/schemas/WithOptionalKind'
      - $ref: '#/components/schemas/WithOptionalMd5'
      - $ref: '#/components/schemas/WithOptionalSha1'
      - $ref: '#/components/schemas/WithOptionalSha256'
      - $ref: '#/components/schemas/WithOptionalComponents'
    WithOptionalComponents:
      type: object
      properties:
        components:
          type: array
          items:
            $ref: '#/components/schemas/RecursiveComponent'
    WithOptionalId:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
          - $ref: '#/components/schemas/ULID'
    WithScans:
      type: object
      required:
      - scans
      properties:
        scans:
          type: array
          items:
            $ref: '#/components/schemas/Scan'
    WithOptionalKind:
      type: object
      properties:
        kind:
          type: string
    WithOptionalEmail:
      type: object
      properties:
        email:
          type: string
          example: user@binarly.io
    WithOptionalSource:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/ULID'
    WithOptionalSha256:
      type: object
      properties:
        sha256:
          type: string
    WithOptionalUserStatus:
      type: object
      properties:
        status:
          type: string
          x-go-type: string
          enum:
          - active
          - archived
    WithOptionalContainerPath:
      type: object
      properties:
        containerPath:
          type: string
    WithName:
      type: object
      required:
      - name
      properties:
        name:
          type: string
    WithScanStateType:
      type: object
      required:
      - type
      properties:
        type:
          type: string
          enum:
          - new
          - running
          - failed
          - done
          - cancelled
    WithOptionalMd5:
      type: object
      properties:
        md5:
          type: string
    ForbiddenErrorResponse:
      type: object
      required:
      - message
      - permission
      - resourceName
      properties:
        message:
          type: string
        permission:
          type: string
        resourceName:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    ResourceType:
      type: string
      enum:
      - Org
      - Group
      - Product
      - User
      - Image
      - Finding
      - Occurrence
    WithRecursiveComponents:
      type: object
      required:
      - components
      properties:
        components:
          type: array
          items:
            $ref: '#/components/schemas/RecursiveComponent'
    Component:
      allOf:
      - $ref: '#/components/schemas/WithPlatformId'
      - $ref: '#/components/schemas/WithName'
      - $ref: '#/components/schemas/WithPath'
      - $ref: '#/components/schemas/WithOptionalContainerPath'
      - $ref: '#/components/schemas/WithOptionalAttributes'
      - $ref: '#/components/schemas/WithOptionalKind'
      - $ref: '#/components/schemas/WithOptionalMd5'
      - $ref: '#/components/schemas/WithOptionalSha1'
      - $ref: '#/components/schemas/WithOptionalSha256'
    ErrorResponse:
      required:
      - message
      type: object
      properties:
        message:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    RecursiveComponents:
      $ref: '#/components/schemas/WithRecursiveComponents'
    WithOptionalAttributes:
      type: object
      properties:
        attributes: {}
    ULID:
      type: string
      format: ulid
      minLength: 26
      maxLength: 26
      example: 01ARZ3NDEKTSV4RRFFQ69G5FAV
      x-go-type: ulid.ULID
      x-go-type-import:
        path: github.com/oklog/ulid/v2
    WithOptionalSha1:
      type: object
      properties:
        sha1:
          type: string
    WithId:
      type: object
      required:
      - id
      properties:
        id:
          readOnly: true
          allOf:
          - $ref: '#/components/schemas/ULID'
    Parent:
      type: string
      format: path
      description: URI path (path-noscheme) without the leading /
      readOnly: true
      x-go-type: string
      x-go-type-skip-optional-pointer: true
    WithOptionalAuthor:
      type: object
      properties:
        author:
          $ref: '#/components/schemas/User'
    WithCreateTime:
      type: object
      required:
      - createTime
      properties:
        createTime:
          type: string
          readOnly: true
          example: '2024-01-01T01:00:00Z'
    WithOptionalCreateTime:
      type: object
      properties:
        createTime:
          type: string
          readOnly: true
          example: '2024-01-01T01:00:00Z'
    WithUserId:
      type: object
      required:
      - userId
      properties:
        userId:
          type: string
          readOnly: true
          x-go-type-skip-optional-pointer: true
  parameters:
    PathProductId:
      name: productId
      in: path
      description: Product ID
      required: true
      schema:
        $ref: '#/components/schemas/ULID'
    PathImageId:
      name: imageId
      in: path
      description: Image ID
      required: true
      schema:
        $ref: '#/components/schemas/ULID'
    PathScanId:
      name: scanId
      in: path
      description: Scan ID
      required: true
      schema:
        $ref: '#/components/schemas/ULID'
  securitySchemes:
    auth:
      type: http
      scheme: bearer
      bearerFormat: JWT