Skip to main content
POST
Create a draft invoice

Auktoriseringar

X-API-KEY
string
header
obligatorisk
OW-KEY
string
header
obligatorisk

OpenWrench shared secret. Required on every request alongside X-API-KEY; issued together with your API key.

Kropp

application/json

Invoice create payload (verified against the shared invoice constructor). status is always forced to "draft", supplierFacilityId to the API key's facility and isBuyerUploaded to false; caller values for them are ignored. Monetary values are strings validated as parseable numbers. Unknown fields are ignored.

workOrderId
integer<int64>
obligatorisk

REQUIRED. Work order the invoice bills; must exist. locationId, buyerFacilityId, buyerCompanyId, spendCategoryId and problemTypeId are derived from it.

id
integer<int64>

Existing invoice id (update semantics)

scope
string
externalWorkOrderId
string
buyerInvoiceTypeId
integer
buyerInvoiceTypeDetail
object[]

InvoiceFieldTypeDetails objects

supplierInvoiceTypeId
integer
supplierInvoiceTypeDetail
object[]

InvoiceFieldTypeDetails objects

buyerCustomFieldValues
object[]

CustomFieldValue objects

supplierCustomFieldValues
object[]

CustomFieldValue objects

paymentTerms
string
poNumber
string

Defaults to the work order's poNumber

glCode
string
dueDate
string<date-time>

ISO 8601 date-time

isApproved
boolean
duePaymentAt
string<date-time>

ISO 8601 date-time

dateOfInvoice
string<date-time>

ISO 8601 date-time

invoiceNumber
string
invoiceNotes
object[]
invoiceTaxRate
string

Must parse as a number if present (all monetary strings below likewise)

invoiceTax
string
invoiceTotalBeforeTax
string
invoiceTotalAfterTax
string
laborTaxRate
string
laborTax
string
laborTotalBeforeTax
string
laborLineItems
object[]
materialTaxRate
string
materialTax
string
materialTotalBeforeTax
string
materialLineItems
object[]
travelTaxRate
string
travelTax
string
travelTotalBeforeTax
string
travelLineItems
object[]
freightTaxRate
string
freightTax
string
freightTotalBeforeTax
string

Defaults to "0"

freightLineItems
object[]
miscTaxRate
string
miscTax
string
miscTotalBeforeTax
string
miscLineItems
object[]

Each amount must parse as a number

taxLineItems
object[]

Validated against the invoice currency's allowed tax types (currently only CAD: GST/HST/PST); rejected otherwise

disputeNotes
object[]
attachments
object[]

Must be a valid URL; becomes the single invoicePDFs entry

Must be a valid URL; becomes the single invoicePDFsWatermarked entry

owGeneratedPDF
boolean

Default false

serviceCallIds
integer<int64>[]

Defaults to all service calls associated with the work order when omitted/empty

autoPublishOnApproval
boolean

Default false

createdBy
string
createdAt
string<date-time>

ISO 8601 date-time

publishedBy
string
publishedAt
string<date-time>

ISO 8601 date-time

isAiParsed
boolean

Client-asserted AI-parse provenance; default false

isAiParsedEdited
boolean

Default false

aiParseMismatchSignedByEmail
string

Svar

Successful response

type
string
obligatorisk

Entity type label, e.g. "Invoice". Endpoints that derive it via Scala reflection (most generic list/get endpoints) may return the fully qualified server class name instead (e.g. "models.workorder.WorkOrder"); treat this field as informational.

data
object
obligatorisk

Invoice in its external-API projection (InvoiceExternalAPI = full Invoice fields with buyerSupplierRelationship replaced by an external projection). Abridged - the full model carries approval-hierarchy, dispute and hydrated relation fields. For third-party suppliers responses are masked.

status
enum<string>
obligatorisk

"ok" on success

Tillgängliga alternativ:
ok