invoices

Update an invoice

Changed on

Update an existing invoice draft for the company.

This operation will update all fields of the invoice. It's recommended that you perform a GET request to the invoice first to get the current state of the invoice and then update the fields you want to change.

NOTE: It's only possible to update invoices that are in draft status.

Tax reduction: Only the integration that created the invoice can modify tax reduction data. If a different integration includes taxReduction changes in the request, the changes will be silently ignored and the existing tax reduction data will be preserved.

Scope: invoices:write

put/companies/{companyId}/invoices/{invoiceId}

Request

  • Base URL
    https://api.bokio.se/v1
  • URL
    https://api.bokio.se/v1/companies/{companyId}/invoices/{invoiceId}
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization code: /authorize
      Client credentials
      Token URL: /token scopes: invoices:write

Request body

idstring uuid
type'invoice' | 'cashInvoice'

The type of the invoice can be invoice or cashInvoice. Can only be set to invoice when creating a new invoice and will default to invoice if not set.

invoiceNumberstring nullable

The invoice number will be generated at the time of publishing the invoice.

paymentReferencestring nullable

The payment reference (OCR number) for the invoice. Populated when the invoice is published, null for drafts.

orderNumberReferencestring nullable

The order number associated with the invoice.

projectReferencestring nullable

The project reference associated with the invoice.

buyerReferencestring nullable

The buyer reference associated with the invoice.

contractReferencestring nullable

The contract reference associated with the invoice.

currencystring

ISO 4217 currency code

currencyRatenumber double
totalAmountnumber double

Total amount of the invoice including VAT.

totalTaxnumber double
paidAmountnumber double
status'draft' | 'published' | 'paid' | 'overPaid' | 'underPaid' | 'overdue' | 'credited' | 'credit'
invoiceDatestring date required
dueDatestring date

The due date for the invoice. Optional — when omitted, it is automatically calculated using the fallback chain: customer payment terms → company payment terms → 30 days from the invoice date.

publishedDateTimestring date-time nullable

The date when the credit note was published (null for draft)

totalRoundingEnabledboolean

Whether the invoice total is rounded to a whole number. When omitted, the company default is applied (on both create and update).

metadataobject

Metadata fields for the invoice as string key-value pairs. These fields can be used for filtering.All metadata keys must start with a letter or underscore and contain only alphanumeric characters and underscores.

Example request

{
  "customerRef": {
    "id": "d4e5f6a7-b8c9-0123-def1-234567890123",
    "name": "Acme AB",
    "customerNumber": "CUST-001"
  },
  "lineItems": [
    {
      "id": 1,
      "itemRef": {
        "id": "55c899c5-82b2-47fa-9c51-e35fc9b26443",
        "description": "Installation work"
      },
      "description": "Installation work",
      "itemType": "salesItem",
      "productType": "services",
      "unitType": "custom",
      "customUnitType": "session",
      "quantity": 10,
      "unitPrice": 500,
      "taxRate": 25,
      "bookkeepingAccountNumber": 3389,
      "discount": {
        "type": "percentage",
        "value": 10
      },
      "reverseChargeType": "construction",
      "projectRef": {
        "id": "4f8f6da6-4cbc-4bfc-8d23-67d5f6f2dd9b",
        "projectName": "Website Redesign",
        "projectNumber": "P-001"
      },
      "costCenterRef": {
        "tagId": "7e5ee25f-1f5d-4e47-a26f-5d2d20fbef90",
        "tagName": "Nord"
      }
    }
  ],
  "billingAddress": {
    "line1": "10 Downing Street",
    "line2": null,
    "city": "London",
    "postalCode": "SW1A 2AA",
    "country": "GB",
    "countrySubdivision": "ENG"
  },
  "deliveryAddress": {
    "line1": "Älvsborgsvägen 10",
    "line2": null,
    "city": "Göteborg",
    "postalCode": "123 45",
    "country": "SE"
  },
  "taxReduction": {
    "type": "rot",
    "description": "Bathroom renovation",
    "propertyType": "housingDesignation",
    "tenantOrgNumber": "7164009068",
    "apartmentNumber": "1001",
    "deductionAmount": 1500,
    "status": "draft",
    "deductionPeople": [
      {
        "personalNumber": "19850101-1234",
        "deductionAmount": 1500
      }
    ]
  },
  "metadata": {
    "project": "Website Redesign",
    "department": "IT",
    "externalId": "EXT-INV-2024-001"
  }
}

Response

The invoice.

idstring uuid
type'invoice' | 'cashInvoice'

The type of the invoice can be invoice or cashInvoice. Can only be set to invoice when creating a new invoice and will default to invoice if not set.

invoiceNumberstring nullable

The invoice number will be generated at the time of publishing the invoice.

paymentReferencestring nullable

The payment reference (OCR number) for the invoice. Populated when the invoice is published, null for drafts.

orderNumberReferencestring nullable

The order number associated with the invoice.

projectReferencestring nullable

The project reference associated with the invoice.

buyerReferencestring nullable

The buyer reference associated with the invoice.

contractReferencestring nullable

The contract reference associated with the invoice.

currencystring

ISO 4217 currency code

currencyRatenumber double
totalAmountnumber double

Total amount of the invoice including VAT.

totalTaxnumber double
paidAmountnumber double
status'draft' | 'published' | 'paid' | 'overPaid' | 'underPaid' | 'overdue' | 'credited' | 'credit'
invoiceDatestring date required
dueDatestring date

The due date for the invoice. Optional — when omitted, it is automatically calculated using the fallback chain: customer payment terms → company payment terms → 30 days from the invoice date.

publishedDateTimestring date-time nullable

The date when the credit note was published (null for draft)

totalRoundingEnabledboolean

Whether the invoice total is rounded to a whole number. When omitted, the company default is applied (on both create and update).

metadataobject

Metadata fields for the invoice as string key-value pairs. These fields can be used for filtering.All metadata keys must start with a letter or underscore and contain only alphanumeric characters and underscores.

Example response

{
  "customerRef": {
    "id": "d4e5f6a7-b8c9-0123-def1-234567890123",
    "name": "Acme AB",
    "customerNumber": "CUST-001"
  },
  "lineItems": [
    {
      "id": 1,
      "itemRef": {
        "id": "55c899c5-82b2-47fa-9c51-e35fc9b26443",
        "description": "Installation work"
      },
      "description": "Installation work",
      "itemType": "salesItem",
      "productType": "services",
      "unitType": "custom",
      "customUnitType": "session",
      "quantity": 10,
      "unitPrice": 500,
      "taxRate": 25,
      "bookkeepingAccountNumber": 3389,
      "discount": {
        "type": "percentage",
        "value": 10
      },
      "reverseChargeType": "construction",
      "projectRef": {
        "id": "4f8f6da6-4cbc-4bfc-8d23-67d5f6f2dd9b",
        "projectName": "Website Redesign",
        "projectNumber": "P-001"
      },
      "costCenterRef": {
        "tagId": "7e5ee25f-1f5d-4e47-a26f-5d2d20fbef90",
        "tagName": "Nord"
      }
    }
  ],
  "billingAddress": {
    "line1": "10 Downing Street",
    "line2": null,
    "city": "London",
    "postalCode": "SW1A 2AA",
    "country": "GB",
    "countrySubdivision": "ENG"
  },
  "deliveryAddress": {
    "line1": "Älvsborgsvägen 10",
    "line2": null,
    "city": "Göteborg",
    "postalCode": "123 45",
    "country": "SE"
  },
  "taxReduction": {
    "type": "rot",
    "description": "Bathroom renovation",
    "propertyType": "housingDesignation",
    "tenantOrgNumber": "7164009068",
    "apartmentNumber": "1001",
    "deductionAmount": 1500,
    "status": "draft",
    "deductionPeople": [
      {
        "personalNumber": "19850101-1234",
        "deductionAmount": 1500
      }
    ]
  },
  "metadata": {
    "project": "Website Redesign",
    "department": "IT",
    "externalId": "EXT-INV-2024-001"
  }
}

Changes

    • breaking

      added to the request property allOf list

    • warning

      removed the request property /

    • warning

      removed the optional property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • warning

      added the new custom enum value to the //// response property for the response status

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property

    • info

      added the new custom enum value to the request property ////

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added to the response property allOf list for the response status