time entries

Creates an invoice draft from one or more time entries.

The time entries will be converted to invoice lines based on the specified grouping. After successful creation, the included time entries will be marked as "in draft" and cannot be modified until the draft is deleted or converted to an invoice.

Grouping options:

  • activity: One invoice line per activity, summing hours across all selected time entries for that activity
  • activityAndPerson: One invoice line per unique activity+person combination
  • none: Each time entry becomes its own invoice line

Line description: By default, the invoice line description is generated from the activity name and total hours. If includeTimeEntryDescriptions is true, individual time entry descriptions are appended.

post/companies/{companySlug}/timeEntries/createInvoiceDraft

Request body

timeEntryIdsinteger[] required

Array of time entry IDs to include in the invoice draft. All time entries must belong to the same company and must not already be invoiced or in another draft.

customerIdinteger required

The customer (contact) to invoice. Must be a contact with customer=true.

daysUntilDueDateinteger required

Number of days until the invoice is due.

groupBy'activity' | 'activityAndPerson' | 'none'

How to group time entries into invoice lines:

  • activity: One line per activity (default)
  • activityAndPerson: One line per activity+person combination
  • none: Each time entry becomes a separate line
includeTimeEntryDescriptionsboolean

If true, individual time entry descriptions are included in the invoice line description.

issueDatestring date

Issue date of the invoice draft. Defaults to today if not provided.

projectIdinteger

Project ID to associate with the invoice draft. If not provided, uses the project from the time entries (if they all belong to the same project).

invoiceTextstring

Text to display above the invoice lines.

yourReferencestring

Customer's reference person.

ourReferencestring

Your reference person.

orderReferencestring

Order reference (used for EHF invoices).

currencystring

ISO 4217 currency code. Defaults to NOK.

bankAccountNumberstring

Bank account number for payment.

Example request

{
  "timeEntryIds": [
    123,
    456,
    789
  ],
  "customerId": 7340852,
  "daysUntilDueDate": 14,
  "groupBy": "activity",
  "includeTimeEntryDescriptions": true,
  "issueDate": "2024-03-15",
  "projectId": 75408386,
  "invoiceText": "Faktura for utført arbeid i mars 2024",
  "yourReference": "Ola Nordmann",
  "ourReference": "Kari Hansen",
  "currency": "NOK",
  "bankAccountNumber": "11112233334"
}

Response

Created

Changes

No recorded changes to this endpoint across all 1 revision of this API.