Create Invoice

Create a new invoice. Required fields: - `recordId`: Project or account ID (the record must exist first) - `calculationMethod`: Must be "LINE_ITEMS" or "PERCENTAGE" Conditionally required: - `lineItems`: Required when `calculationMethod` is "LINE_ITEMS" (at least one item) - `percentage`: Required when `calculationMethod` is "PERCENTAGE" Optional fields: - `issueDate`: ISO 8601 datetime string - `dueDate`: ISO 8601 datetime string - `status`: Initial invoice status (defaults to DRAFT) - `description`: Invoice description

Authentication

x-api-keystring
API Key authentication via header

Request

This endpoint expects an object.
recordIdintegerRequired>=1
Project or account ID
calculationMethodenumRequired
Calculation method
lineItemslist of objectsOptional

Required when calculationMethod is LINE_ITEMS and sections is not provided. Flat array of line items (auto-grouped into one unnamed section).

sectionslist of objectsOptional

Required when calculationMethod is LINE_ITEMS and lineItems is not provided. Grouped line items with named sections. May be combined with lineItems (ungrouped items).

percentagedoubleOptional>=0

Required when calculationMethod is PERCENTAGE.

statusenumOptional

Optional; defaults to DRAFT when omitted. To finalize the invoice, set SENT, PARTIALLY_PAID, or PAIDissueDate is then required. Lifecycle statuses (DECLINED, OVERDUE) cannot be set at creation.

issueDatestringOptionalformat: "date-time"

Issue date (ISO 8601). Optional. Applied only when status is SENT/PARTIALLY_PAID/PAID (required for those); ignored for DRAFT invoices.

dueDatestringOptionalformat: "date-time"

Due date (ISO 8601 datetime string)

descriptionstring or nullOptional
Invoice description

Response

Invoice created successfully
idinteger
Invoice identifier
uidinteger
Unique invoice number
statusenum
Invoice status
amountdouble
Total invoice amount
amountPaiddouble
Amount paid
calculationMethodstring

Calculation method (e.g., LINE_ITEMS)

createdAtstringformat: "date-time"
Creation timestamp
updatedAtstringformat: "date-time"
Last update timestamp
descriptionstring or null
Invoice description
typeenum or null
Invoice type
basedOnIdinteger or null
ID of the record this invoice is based on
basedOnUidinteger or null
UID of the record this invoice is based on
dueDatestringformat: "date-time"
Due date
isArchivedboolean
Whether the invoice is archived
sharedWithPortalboolean
Whether the invoice is shared with portal
percentagedouble or null
Percentage if applicable
baseAmountdouble or null
Base amount if applicable
accountobject or null
recordobject or null
lineItemslist of objects

Errors

400
Bad Request Error
401
Unauthorized Error