Bokio uploads API

Operations for managing file uploads

OpenAPI Specification

bokio-uploads-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: '1.0'
  title: Company authorization uploads API
  description: The Bokio Company API containing all resources for company tenant.
  termsOfService: https://docs.bokio.se/page/terms/
  contact:
    name: Bokio
    url: https://docs.bokio.se
    email: support@bokio.se
servers:
- url: https://api.bokio.se/v1
  description: Bokio API
  x-bokio-api: true
security:
- tokenAuth: []
tags:
- name: uploads
  description: Operations for managing file uploads
paths:
  /companies/{companyId}/uploads:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: ea9ee4dd-fae3-4aec-a7db-6fc9cc1f8135
    post:
      tags:
      - uploads
      summary: Add an upload
      description: 'Add an upload to bokio in the form of an image or pdf. One file can be uploaded per request. The request must be **multi-part MIME**.


        #### Sample request for uploading a file using multipart MIME

        ```

        POST http://api.bokio.se/companies/{companyId}/uploads

        Content-Type: multipart/form-data; boundary=----FormBoundary7MA4YWxkTrZu0gW

        Authorization: Bearer <token>


        ------FormBoundary7MA4YWxkTrZu0gW

        Content-Disposition: form-data; name="File"; filename="receipt.png"

        Content-Type: image/png


        < ./receipt.png


        ------WebKitFormBoundary7MA4YWxkTrZu0gW

        Content-Disposition: form-data; name="journalEntryId"


        835ba700-b306-4bd9-8447-59207b6b0002


        ------WebKitFormBoundary7MA4YWxkTrZu0gW

        Content-Disposition: form-data; name="description"


        Description for the upload


        ------FormBoundary7MA4YWxkTrZu0gW--

        ```


        **Scope:** `uploads:write`

        '
      operationId: add-upload
      parameters:
      - name: Content-Type
        in: header
        required: true
        description: Content type of the request
        schema:
          type: string
        example: multipart/form-data;boundary=JLQPFBPUP0
      requestBody:
        description: File and information for upload
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: The file to upload
                description:
                  type: string
                  description: Description of the upload. If left empty, the file name will be used.
                  example: Receipt for invoice 1234
                journalEntryId:
                  type: string
                  format: uuid
                  description: The journal entry id to attach the upload to
                  example: 835ba700-b306-4bd9-8447-59207b6b0002
              required:
              - file
      responses:
        '200':
          description: Successfully added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/upload'
              examples:
                upload added:
                  value:
                    id: a419cf69-db6f-4de9-992c-b1a60942a443
                    description: example.png
                    contentType: img/png
                    journalEntryId: 835ba700-b306-4bd9-8447-59207b6b0002
        '400':
          description: Invalid file data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    message: Validation failed with 1 error
                    code: validation-error
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/file'
                      message: Invalid file type. Only application/pdf, image/jpeg and image/png files are allowed.
      security:
      - tokenAuth: []
    get:
      tags:
      - uploads
      summary: Get uploads
      description: 'Get all uploads for the company. Use the query parameters to filter and navigate through the results.

        **Scope:** `uploads:read`'
      operationId: get-uploads
      parameters:
      - name: page
        in: query
        required: false
        description: Page number
        schema:
          type: integer
          format: int32
          default: 1
      - name: pageSize
        in: query
        required: false
        description: Number of items per page
        schema:
          type: integer
          format: int32
          default: 25
      - name: query
        in: query
        required: false
        description: 'Optional query to filter the data set with supported fields listed below and [available operations](filtering).


          | Field                     | Type        |

          | ------------------------- | ----------- |

          | description               | string      |

          | journalEntryId            | string      |

          '
        schema:
          type: string
        example: description~Receipt for invoice 1234
      responses:
        '200':
          description: uploads found
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/pagedResponse'
                - type: object
                  properties:
                    items:
                      type: array
                      items:
                        $ref: '#/components/schemas/upload'
      security:
      - tokenAuth: []
  /companies/{companyId}/uploads/{uploadId}:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: ea9ee4dd-fae3-4aec-a7db-6fc9cc1f8135
    - name: uploadId
      in: path
      required: true
      description: Unique identifier of the upload
      schema:
        type: string
        format: uuid
      example: a419cf69-db6f-4de9-992c-b1a60942a443
    get:
      tags:
      - uploads
      summary: Get an upload
      description: 'Retrieve the information of the upload with the matching uploadId.


        **Scope:** `uploads:read`

        '
      operationId: get-upload
      responses:
        '200':
          description: upload found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/upload'
              examples:
                upload found:
                  value:
                    id: a419cf69-db6f-4de9-992c-b1a60942a443
                    description: example.png
                    contentType: img/png
                    journalEntryId: 835ba700-b306-4bd9-8447-59207b6b0002
        '404':
          description: upload not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: not-found
                    message: upload not found
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
  /companies/{companyId}/uploads/{uploadId}/download:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: ea9ee4dd-fae3-4aec-a7db-6fc9cc1f8135
    - name: uploadId
      in: path
      required: true
      description: Unique identifier of the upload
      schema:
        type: string
        format: uuid
      example: a419cf69-db6f-4de9-992c-b1a60942a443
    get:
      tags:
      - uploads
      summary: Download file data for an upload
      description: 'Retrieve the file data of the upload with the matching uploadId.


        **Scope:** `uploads:read`

        '
      operationId: download-upload
      responses:
        '200':
          description: Upload file found
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '404':
          description: Upload not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: not-found
                    message: upload not found
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
components:
  schemas:
    apiError:
      type: object
      title: apiError
      properties:
        code:
          type: string
        message:
          type: string
        bokioErrorId:
          type: string
          format: uuid
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
    pagedResponse:
      type: object
      title: pagedResponse
      properties:
        totalItems:
          type: integer
          format: int32
          example: 1
        totalPages:
          type: integer
          format: int32
          example: 1
        currentPage:
          type: integer
          format: int32
          example: 1
    upload:
      type: object
      title: upload
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        description:
          type: string
        contentType:
          type: string
        journalEntryId:
          type: string
          format: uuid
          nullable: true
      example:
        id: a419cf69-db6f-4de9-992c-b1a60942a443
        description: example.png
        contentType: img/png
        journalEntryId: 835ba700-b306-4bd9-8447-59207b6b0002
  securitySchemes:
    tokenAuth:
      type: http
      scheme: bearer
    access_token:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /token
          scopes: {}
        authorizationCode:
          authorizationUrl: /authorize
          tokenUrl: /token
          scopes:
            bank-payments:read-limited: Read access to bank payments created by the integration
            bank-payments:write: Write access to bank payments
            chart-of-accounts:read: Read access to chart of accounts
            company-information:read: Read access to company information
            credit-notes:read: Read access to credit notes
            credit-notes:write: Write access to credit notes
            customers:read: Read access to customers
            customers:write: Write access to customers
            fiscal-years:read: Read access to fiscal years
            invoices:read: Read access to invoices
            invoices:write: Write access to invoices
            items:read: Read access to items
            items:write: Write access to items
            journal-entries:read: Read access to journal entries
            journal-entries:write: Write access to journal entries
            sie:read: Read access to SIE files
            supplier-invoices:read: Read access to supplier invoices
            supplier-invoices:write: Write access to supplier invoices
            suppliers:read: Read access to suppliers
            suppliers:write: Write access to suppliers
            tags:read: Read access to tag groups and tags
            tags:write: Write access to tag groups and tags
            uploads:read: Read access to uploads
            uploads:write: Write access to uploads
    client_auth:
      type: http
      scheme: basic
externalDocs:
  url: https://docs.bokio.se
  description: Read the API Documentation
x-readme:
  explorer-enabled: true
  proxy-enabled: false
  samples-languages:
  - shell
  - http
  - node
  - csharp
  - java