---
title: "POST /companies/{companySlug}/timeEntries/createInvoiceDraft"
method: POST
path: "/companies/{companySlug}/timeEntries/createInvoiceDraft"
tags: ["time entries"]
---

# POST /companies/{companySlug}/timeEntries/createInvoiceDraft

`POST /companies/{companySlug}/timeEntries/createInvoiceDraft`

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.

## Request body

- TimeEntryInvoiceDraftRequest
  - `timeEntryIds` integer[], 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.
  - `customerId` integer, required — The customer (contact) to invoice. Must be a contact with customer=true.
  - `daysUntilDueDate` integer, 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
  - `includeTimeEntryDescriptions` boolean — If true, individual time entry descriptions are included in the invoice line description.
  - `issueDate` string, date — Issue date of the invoice draft. Defaults to today if not provided.
  - `projectId` integer — 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).
  - `invoiceText` string — Text to display above the invoice lines.
  - `yourReference` string — Customer's reference person.
  - `ourReference` string — Your reference person.
  - `orderReference` string — Order reference (used for EHF invoices).
  - `currency` string — ISO 4217 currency code. Defaults to NOK.
  - `bankAccountNumber` string — Bank account number for payment.

## Response `201`

Created

---

[API](https://skmtc.dev/fiken/apis/fiken-api.md) · [All operations](https://skmtc.dev/fiken/apis/fiken-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fiken/fiken-api/revisions/2473dacdb89c/schema)
