Bokio supplier-invoices API

Operations for managing supplier invoices

OpenAPI Specification

bokio-supplier-invoices-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: '1.0'
  title: Company authorization supplier-invoices 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: supplier-invoices
  description: Operations for managing supplier invoices
paths:
  /companies/{companyId}/supplier-invoices:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: a9d8f1c2-6f34-4e4f-9d8a-2a4d3d5f7b91
    post:
      tags:
      - supplier-invoices
      summary: '[Preview] Create a supplier invoice'
      description: 'Creates a new supplier invoice for the company.


        **Scope:** `supplier-invoices:write`

        '
      operationId: post-supplier-invoice
      requestBody:
        description: Post the necessary fields for the API to create a new supplier invoice.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/supplierInvoiceCreate'
            examples:
              New supplier invoice:
                value:
                  supplierRef:
                    id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                  invoiceNumber: INV-001
                  invoiceDate: 2023-10-01
                  dueDate: 2023-10-15
                  totalAmount: 1000
                  uploadRef:
                    id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
      responses:
        '200':
          description: Supplier invoice created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/supplierInvoiceGet'
              examples:
                Supplier invoice created:
                  value:
                    id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                    supplierRef:
                      id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                      name: Supplier AB
                    invoiceNumber: INV-001
                    invoiceDate: 2023-10-01
                    dueDate: 2023-10-15
                    totalAmount: 1000
                    remainingAmount: 1000
                    currency: SEK
                    currencyRate: 1
                    journalEntryRef:
                      id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
        '400':
          description: Validation or operation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: validation-error
                    message: Validation failed with 4 errors
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/supplierRef/id'
                      message: The supplier id field is required
                    - field: '#/invoiceDate'
                      message: The invoice date field is required
                    - field: '#/dueDate'
                      message: The due date field is required
                    - field: '#/totalAmount'
                      message: The totalAmount field is required
                Upload already connected:
                  value:
                    code: validation-error
                    message: Validation failed with 1 error
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/uploadRef/id'
                      message: Upload with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90 is already connected
                Upload deleted:
                  value:
                    code: validation-error
                    message: Validation failed with 1 error
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/uploadRef/id'
                      message: Upload with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90 has been deleted
        '404':
          description: Supplier invoice or upload not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Upload not found:
                  value:
                    code: not-found
                    message: No upload found with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
    get:
      tags:
      - supplier-invoices
      summary: '[Preview] Get supplier invoices'
      description: 'Get all supplier invoices for the company. Use the query parameters to filter and navigate through the results.


        **Scope:** `supplier-invoices:read`

        '
      operationId: get-supplier-invoices
      parameters:
      - name: page
        in: query
        description: Page number
        required: false
        schema:
          type: integer
          format: int32
          default: 1
      - name: pageSize
        in: query
        description: Number of items per page
        required: false
        schema:
          type: integer
          format: int32
          default: 25
          maximum: 100
      - 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   |

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

          | supplierRef.id    | string |

          | invoiceNumber     | string |

          | totalAmount       | number |

          | currency          | string |

          | invoiceDate       | date   |

          | dueDate           | date   |

          '
        schema:
          type: string
        example: dueDate==2023-10-15&&currency==SEK
      responses:
        '200':
          description: Supplier invoices found
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/pagedResponse'
                - type: object
                  properties:
                    items:
                      type: array
                      items:
                        $ref: '#/components/schemas/supplierInvoiceGet'
              examples:
                Supplier invoices:
                  value:
                    totalItems: 2
                    totalPages: 1
                    currentPage: 1
                    items:
                    - id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                      supplierRef:
                        id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                        name: Supplier AB
                      invoiceNumber: INV-001
                      invoiceDate: 2023-10-01
                      dueDate: 2023-10-15
                      totalAmount: 1000
                      remainingAmount: 1000
                      currency: SEK
                      currencyRate: 1
                      journalEntryRef:
                        id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
                      uploadRefs:
                      - id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
                    - id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
                      supplierRef:
                        id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
                        name: Consulting Nordic AB
                      invoiceNumber: INV-002
                      invoiceDate: 2023-10-05
                      dueDate: 2023-10-20
                      totalAmount: 2500
                      remainingAmount: 500
                      currency: SEK
                      currencyRate: 1
                      journalEntryRef:
                        id: 3c1a5e7b-9d2f-4b86-ae31-7f4c2d8b6a55
                      uploadRefs:
                      - id: 34e1c9a5-7b2d-4f86-8a31-6d2c5f9b7e40
      security:
      - tokenAuth: []
  /companies/{companyId}/supplier-invoices/{supplierInvoiceId}:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: a9d8f1c2-6f34-4e4f-9d8a-2a4d3d5f7b91
    - name: supplierInvoiceId
      in: path
      required: true
      description: Unique identifier of the supplier invoice
      schema:
        type: string
        format: uuid
      example: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
    get:
      tags:
      - supplier-invoices
      summary: '[Preview] Get a supplier invoice'
      description: 'Retrieve the information of the supplier invoice with the matching supplierInvoiceId.


        **Scope:** `supplier-invoices:read`

        '
      operationId: get-supplier-invoice-by-id
      responses:
        '200':
          description: Supplier invoice found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/supplierInvoiceGet'
              examples:
                Supplier invoice example:
                  value:
                    id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                    supplierRef:
                      id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                      name: Supplier AB
                    invoiceNumber: INV-001
                    invoiceDate: 2023-10-01
                    dueDate: 2023-10-15
                    totalAmount: 1000
                    remainingAmount: 1000
                    currency: SEK
                    currencyRate: 1
                    journalEntryRef:
                      id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
                    uploadRefs:
                    - id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
        '404':
          description: Supplier invoice not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Supplier invoice not found:
                  value:
                    code: not-found
                    message: Supplier invoice not found
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
    put:
      tags:
      - supplier-invoices
      summary: '[Preview] Update a supplier invoice'
      description: 'Update an existing supplier invoice for the company.


        **Scope:** `supplier-invoices:write`

        '
      operationId: put-supplier-invoice
      requestBody:
        description: Post the necessary fields for the API to update a supplier invoice.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/supplierInvoiceUpdate'
            examples:
              Updated supplier invoice:
                value:
                  supplierRef:
                    id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                  invoiceNumber: INV-001
                  invoiceDate: 2023-10-01
                  dueDate: 2023-10-15
                  totalAmount: 1000
      responses:
        '200':
          description: Supplier invoice updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/supplierInvoiceGet'
              examples:
                Supplier invoice updated:
                  value:
                    id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                    supplierRef:
                      id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
                      name: Supplier AB
                    invoiceNumber: INV-001
                    invoiceDate: 2023-10-01
                    dueDate: 2023-10-15
                    totalAmount: 1000
                    remainingAmount: 1000
                    currency: SEK
                    currencyRate: 1
                    journalEntryRef:
                      id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
        '400':
          description: Missing required information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: validation-error
                    message: Validation failed with 4 errors
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/supplierRef/id'
                      message: The supplier id field is required
                    - field: '#/invoiceDate'
                      message: The invoice date field is required
                    - field: '#/dueDate'
                      message: The due date field is required
                    - field: '#/totalAmount'
                      message: The totalAmount field is required
                Not created by integration:
                  value:
                    code: operation-not-allowed
                    message: Bokio API only supports updating supplier invoices that have been added through the API by the same integration.
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
        '404':
          description: Supplier invoice not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: not-found
                    message: Supplier invoice not found
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
    delete:
      tags:
      - supplier-invoices
      summary: '[Preview] Delete a supplier invoice'
      description: 'Delete an existing supplier invoice for the company.


        **Scope:** `supplier-invoices:write`

        '
      operationId: delete-supplier-invoice
      responses:
        '204':
          description: Supplier invoice deleted
        '400':
          description: Operation not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Error:
                  value:
                    code: operation-not-allowed
                    message: Bokio API only supports deleting supplier invoices that have been added through the API by the same integration.
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
      security:
      - tokenAuth: []
  /companies/{companyId}/supplier-invoices/{supplierInvoiceId}/uploads:
    parameters:
    - name: companyId
      in: path
      required: true
      description: Unique identifier of the company
      schema:
        type: string
        format: uuid
      example: a9d8f1c2-6f34-4e4f-9d8a-2a4d3d5f7b91
    - name: supplierInvoiceId
      in: path
      required: true
      description: Unique identifier of the supplier invoice
      schema:
        type: string
        format: uuid
      example: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
    post:
      tags:
      - supplier-invoices
      summary: '[Preview] Add an upload to a supplier invoice'
      description: 'Add an upload to the supplier invoice.


        **Scope:** `supplier-invoices:write`

        '
      operationId: post-supplier-invoice-upload
      requestBody:
        description: Post the necessary fields for the API to add an upload to the supplier invoice.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/uploadRef'
            examples:
              Existing upload:
                value:
                  id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
      responses:
        '200':
          description: Upload added to supplier invoice
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/uploadRef'
              examples:
                Upload:
                  value:
                    id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
                Upload not found:
                  value:
                    code: not-found
                    message: No upload found with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
        '400':
          description: Validation or operation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiError'
              examples:
                Validation error:
                  value:
                    code: validation-error
                    message: Missing required information
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/id'
                      message: The upload id field is required
                Upload already connected:
                  value:
                    code: validation-error
                    message: Upload is already connected
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/id'
                      message: Upload with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90 is already connected
                Upload deleted:
                  value:
                    code: validation-error
                    message: Upload has been deleted
                    bokioErrorId: 9b408943-7a1e-47ac-85a7-ac52b2c210d3
                    errors:
                    - field: '#/id'
                      message: Upload with id 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90 has been deleted
                Not created by integration:
                  value:
                    code: operation-not-allowed
                    message: Bokio API only supports adding uploads to supplier invoices that have been added through the API by the same integration.
                    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
    supplierInvoiceGet:
      type: object
      title: SupplierInvoice
      required:
      - invoiceDate
      - dueDate
      - totalAmount
      - supplierRef
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        supplierRef:
          type: object
          required:
          - id
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
              readOnly: true
        invoiceNumber:
          type: string
        invoiceDate:
          type: string
          format: date
        dueDate:
          type: string
          format: date
        totalAmount:
          type: number
          format: double
        remainingAmount:
          type: number
          format: double
          readOnly: true
        currency:
          type: string
          readOnly: true
        currencyRate:
          type: number
          format: double
          readOnly: true
        journalEntryRef:
          type: object
          readOnly: true
          nullable: true
          properties:
            id:
              type: string
              format: uuid
              readOnly: true
        uploadRefs:
          type: array
          items:
            $ref: '#/components/schemas/uploadRef'
      example:
        id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
        supplierRef:
          id: 6f6b2f17-3c4a-4a69-9f2d-3f5d7e1b8c90
          name: Supplier AB
        invoiceNumber: INV-001
        invoiceDate: 2023-10-01
        dueDate: 2023-10-15
        totalAmount: 1000
        remainingAmount: 1000
        currency: SEK
        currencyRate: 1
        journalEntryRef:
          id: 2d8ce6b4-1f3a-46a5-8a9d-5b7f2c4e9d10
        uploadRefs:
        - id: 24f3b7c1-8d6a-4e2f-9b31-5d7c2a8e4f90
        - id: 34e1c9a5-7b2d-4f86-8a31-6d2c5f9b7e40
    supplierInvoiceUpdate:
      type: object
      title: SupplierInvoiceUpdate
      required:
      - invoiceDate
      - dueDate
      - totalAmount
      - supplierRef
      properties:
        supplierRef:
          type: object
          required:
          - id
          properties:
            id:
              type: string
              format: uuid
        invoiceNumber:
          type: string
        invoiceDate:
          type: string
          format: date
        dueDate:
          type: string
          format: date
        totalAmount:
          type: number
          format: double
    uploadRef:
      type: object
      title: UploadRef
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of an existing upload
      example:
        id: 240a4af0-edfd-47b1-b4ab-f30450eaac19
    supplierInvoiceCreate:
      type: object
      title: SupplierInvoiceCreate
      required:
      - invoiceDate
      - dueDate
      - totalAmount
      - supplierRef
      properties:
        supplierRef:
          type: object
          required:
          - id
          properties:
            id:
              type: string
              format: uuid
        invoiceNumber:
          type: string
        invoiceDate:
          type: string
          format: date
        dueDate:
          type: string
          format: date
        totalAmount:
          type: number
          format: double
        uploadRef:
          $ref: '#/components/schemas/uploadRef'
  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