Binarly File API

The File API from Binarly — 4 operation(s) for file.

OpenAPI Specification

binarly-file-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Binarly Assistant File API
  version: 4.275.2
security:
- auth: []
tags:
- name: File
paths:
  /api/v4/products/{productId}/images/{imageId}/files/{fileId}:
    get:
      summary: Get File by ID
      operationId: GetFile
      x-permission: products.view
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      - name: fileId
        in: path
        description: File ID
        required: true
        schema:
          $ref: '#/components/schemas/ULID'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '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}/files:
    get:
      summary: List Files
      operationId: ListFiles
      x-permission: products.view
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Files'
        '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 File (Attachment)
      operationId: CreateFile
      x-permission: files.create
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FileUpload'
      responses:
        '201':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
  /api/v4/products/{productId}/images/{imageId}/files:bulkDownload:
    post:
      summary: Bulk Download Files
      operationId: BulkDownloadFiles
      x-permission: files.download
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkIds'
      responses:
        '200':
          description: archived files
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
          headers:
            Content-Disposition:
              schema:
                type: string
            Content-Transfer-Encoding:
              schema:
                type: string
        '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}/files:bulkDelete:
    post:
      summary: Bulk Delete Files
      operationId: BulkDeleteFiles
      x-permission: files.delete
      tags:
      - File
      parameters:
      - $ref: '#/components/parameters/PathProductId'
      - $ref: '#/components/parameters/PathImageId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkIds'
      responses:
        '201':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkIds'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
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'
    WithOptionalMetadata:
      type: object
      properties:
        metadata:
          type: object
          additionalProperties:
            type: string
    File:
      allOf:
      - $ref: '#/components/schemas/WithId'
      - $ref: '#/components/schemas/WithCreateTime'
      - $ref: '#/components/schemas/WithOptionalParent'
      - $ref: '#/components/schemas/WithAuthor'
      - $ref: '#/components/schemas/WithFilename'
      - $ref: '#/components/schemas/WithIsAttachment'
      - $ref: '#/components/schemas/WithDownloadUrl'
      - $ref: '#/components/schemas/WithOptionalMetadata'
    WithOptionalParent:
      type: object
      properties:
        parent:
          $ref: '#/components/schemas/Parent'
    Files:
      $ref: '#/components/schemas/WithFiles'
    WithIsAttachment:
      type: object
      required:
      - isAttachment
      properties:
        isAttachment:
          type: boolean
          default: false
          readOnly: true
    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'
    WithAuthor:
      type: object
      required:
      - author
      properties:
        author:
          $ref: '#/components/schemas/User'
    WithIds:
      type: object
      required:
      - ids
      properties:
        ids:
          type: array
          items:
            $ref: '#/components/schemas/ULID'
    WithDownloadUrl:
      type: object
      required:
      - downloadUrl
      properties:
        downloadUrl:
          type: string
          readOnly: true
    WithOptionalId:
      type: object
      properties:
        id:
          readOnly: true
          allOf:
          - $ref: '#/components/schemas/ULID'
    WithOptionalEmail:
      type: object
      properties:
        email:
          type: string
          example: user@binarly.io
    WithOptionalUserStatus:
      type: object
      properties:
        status:
          type: string
          x-go-type: string
          enum:
          - active
          - archived
    FileUpload:
      type: object
      required:
      - file
      properties:
        file:
          type: string
          format: binary
    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
    BulkIds:
      $ref: '#/components/schemas/WithIds'
    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'
    WithFilename:
      type: object
      required:
      - filename
      properties:
        filename:
          type: string
    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
    WithFiles:
      type: object
      properties:
        files:
          type: array
          items:
            $ref: '#/components/schemas/File'
    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
    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'
  securitySchemes:
    auth:
      type: http
      scheme: bearer
      bearerFormat: JWT