Skip to content

Create a draft invoice

POST
/invoices
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "clientId": "example", "commissionDurationMonths": 1, "commissionDurationRule": "ALWAYS", "contactId": "example", "currency": "USD", "discount": 1, "dueDate": "example", "issueDate": "example", "lineItems": [ { "description": "example", "discountPercent": 1, "exception": true, "kindId": "example", "note": "example", "orderId": "example", "periodEnd": "2026-04-15", "periodStart": "2026-04-15", "pricingOptionId": "example", "quantity": 1, "rate": 1, "revenueAccountId": "example", "serviceId": "example", "teamId": "example" } ], "notes": "example", "order": { "kind": "pending" }, "poNumber": "example", "subject": "example", "taxRate": 1 }'

Creates a DRAFT invoice for a client, addressed to contactId or, left out, to the company’s primary user. taxRate and discount are percentages (0-100). Optional lineItems (at most 100) are created with the invoice in one transaction: a line may name a serviceId (and a pricingOptionId package) to take its description, quantity and rate from the service, and may set a discountPercent, note, a periodStart/periodEnd service period, a revenueAccountId and a teamId. An invoice takes line discounts or an invoice-wide discount, never both: sending both refuses the request with 409 DISCOUNT_CONFLICT. A line naming a service, package, order, line kind, revenue account or team outside the workspace refuses the whole request and nothing is created. order is required while the Orders module is on: kind: pending leaves it To be confirmed and notifies the members who can settle it, none says it has no order, new opens a new order that starts on the invoice date, takes the invoice as its source and gets a generated code, and existing adds the invoice to an active Hour block or Sprint (an extra block of hours; a Sprint also takes 0 hours, as an installment that adds none) or to the current period of an active Subscription, in the same transaction. The order must be of the invoice’s company, and lineItems may be left out. A refused order leaves no invoice behind and answers with a reason. Requires the invoices.create permission, plus orders.create for kind: new or orders.edit and reach to the order for kind: existing. The company must be one the caller reaches: one they are assigned to, or any with clients.view_all or invoices.view_all.

Media typeapplication/json
object
clientId
required
string
>= 1 characters
commissionDurationMonths
integer
> 0 <= 9007199254740991
commissionDurationRule
string
Allowed values: ALWAYS NEVER FIRST_N_MONTHS
contactId

The user of the invoice’s company it is addressed to (a contact id from GET /clients/{id}/contacts); it prints above the company’s name. Null addresses nobody. Left out, the company’s primary user, or nobody when it has none.

Any of:
string
>= 1 characters
currency
string
default: USD >= 3 characters <= 3 characters
discount

Discount on the whole invoice as a percentage (0-100). Refused with 409 DISCOUNT_CONFLICT while any line carries a discountPercent: an invoice takes one kind of discount or the other. Sending it with lines that carry a discountPercent refuses the whole request.

number
<= 100
dueDate

Due date (YYYY-MM-DD), resolved at workspace-local midnight. Left out, it is counted from the issue day in the workspace calendar: the invoice settings’ firstInvoiceDueDays for the company’s first invoice (none of its invoices sent, viewed, paid or overdue, and no other invoice but a cancelled one, drafts included, issued that day or before), else the company’s own payment terms, else the workspace’s paymentTermsDays. A date sent that departs from that rule is kept as sent, and the answer carries dueDateNotice.

string
>= 1 characters
issueDate
required

Issue date (YYYY-MM-DD), resolved at workspace-local midnight.

string
>= 1 characters
lineItems

Lines to create with the invoice, in one transaction: the invoice and every line are saved, or none, up to 100 lines. A line naming an unknown service, package, revenue account or team refuses the whole request.

Array<object>
<= 100 items
object
description

Line description. Required for a Custom line; with serviceId it is ignored while the workspace locks the description, unless exception is true.

string
>= 1 characters
discountPercent

Percentage taken off quantity times rate on this line, above 0 and below 100 (two decimals); amount is net of it. Null removes it. A line discount and the invoice-wide discount never combine: sending one while the other is set is refused with 409 DISCOUNT_CONFLICT.

Any of:
number
> 0 < 100
exception

Send true to change a field the workspace locks on a service line (see lockedLineFields in the invoice settings): the change is then applied, the field is recorded as edited by hand and the audit entry carries it. Without it, changing a locked field is refused with 409 FIELD_LOCKED. A locked description is left as the service set it. Custom lines are never locked.

boolean
kindId
string
>= 1 characters
note

A note the client sees under the line description.

string | null
orderId
string
periodEnd

Last day of the service period the line bills (YYYY-MM-DD). The client sees it.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
periodStart

First day of the service period the line bills (YYYY-MM-DD). The client sees it.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
pricingOptionId

A package of serviceId. Fills the quantity from the package hours and adds its label to the description.

Any of:
string
>= 1 characters
quantity

Quantity. Required for a Custom line; with serviceId it defaults from the service.

number
> 0
rate

Unit rate. Required for a Custom line; with serviceId it defaults to the company rate in force on the issue date, else the service base hourly rate.

number
revenueAccountId

Revenue account of the line. Staff only: never shown to the client. Defaults from the service. Ignored while the workspace has no active revenue account.

Any of:
string
>= 1 characters
serviceId

The service this line is built from. The description is then set from the service name (plus the package label); a description sent is ignored while the workspace locks the description, unless exception is true. Null or omitted makes a Custom line, whose every field is yours.

Any of:
string
>= 1 characters
teamId

The team whose accounting class the line carries. Staff only: never shown to the client. Sent here, the class is MANUAL; left out, it resolves from the service rule and the company’s team on the issue date. Ignored while the workspace has no active revenue account.

Any of:
string
>= 1 characters
notes
string
order

The order of the invoice, required while the Orders module is on and refused while it is off. kind is pending (To be confirmed: accounting assigns the order later, and the members holding invoices.manage and orders.edit are notified), none (no order), new (open a new order this invoice sells: it starts on the invoice date, takes the invoice as its source and gets a generated code; needs orders.create) or existing (add the invoice to an open order of the company, the payment of its current period for a Subscription; needs orders.edit and reach to the order). A new or existing order runs in the same transaction as the invoice and its lines, so a refused order leaves no invoice behind, and lineItems may be left out.

One of:
object
kind
required
string
Allowed value: pending
poNumber
string
<= 100 characters
subject
string
<= 255 characters
taxRate
number
<= 100

The created invoice, with its lines when the request sent lineItems, and dueDateNotice when the dueDate sent departs from the company’s terms.

Media typeapplication/json
object
data
required

The created DRAFT invoice. When the request carried lineItems, the totals include them and lineItems lists them.

object
amountPaid
required
number
clientId
required
string
commissionDurationMonths
required
Any of:
integer
>= -9007199254740991 <= 9007199254740991
commissionDurationRule
required

Commission duration rule: ALWAYS, NEVER or FIRST_N_MONTHS.

string
contactId
required

The user of the invoice’s company it is addressed to (a contact id from GET /clients/{id}/contacts); it prints above the company’s name. Null addresses nobody.

string | null
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
currency
required

ISO 4217 currency code.

string
discount
required

Discount percentage (0-100); null when no discount applies.

number | null
discountAmount
required
number
documentUrl
required

Link to the document the originating system produced.

string | null
dueDate
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
dueDateNotice

Present only when the request sent a dueDate that is not the day the company’s terms give for the issue day: the date was kept as sent, and this says what the terms give.

string
estimateId
required

Source estimate when the invoice was converted from one.

string | null
externalNumber
required

The number the originating system gave it. For an EXTERNAL invoice this is also its number; null for SYSTEM.

string | null
externalSource
required

Which system issued an EXTERNAL invoice, e.g. SPP or QuickBooks. Null for SYSTEM.

string | null
id
required
string
importedFrom
required

The import source (e.g. SPP) that wrote this invoice as one of the workspace’s own. Null for an invoice issued in Chelsea. An imported invoice keeps the notes it was sent with: the workspace’s note on every invoice is not printed on it.

string | null
isRecurring
required

True when the invoice bills a cycle of a client subscription (it has a subscriptionId).

boolean
issueDate
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
lineItems

The lines created with the invoice. Present only when the request sent lineItems.

Array<object>

A single line on an invoice. serviceId, service, revenueAccountId, revenueAccount, teamId, team, classSource and editedFields are staff-only: Customer MCP tokens, the portal, the public link and the PDF never carry them. Those surfaces carry listRate only when it is above rate.

object
amount
required

Quantity times rate less discountPercent, rounded to the cent. The invoice subtotal is the sum of these net amounts.

number
classSource
required

How the class was set: RESOLVED from the service rule and the company’s team, or MANUAL when a person picked it. Null while the class is unset. Staff only.

Any of:
string
Allowed values: RESOLVED MANUAL
description
required
string
discountPercent
required

Percentage taken off quantity times rate on this line; null for none. Never set on an invoice with an invoice-wide discount.

number | null
editedFields
required

The locked fields of a service line (account, class, period, description) that were changed by hand with exception: true. Empty for a line nobody changed and for a Custom line. Staff only.

Array<string>
id
required
string
invoiceId
required
string
kindId
required

Invoice line item kind; null for free-form items.

string | null
listRate
required

The service’s standard hourly rate when the line was created. A client document shows it struck through only when it is above rate; null for a line with no standard rate.

number | null
note
required

A note the client sees under the description.

string | null
orderId
required
string | null
periodEnd
required

Last day of the service period the line bills (YYYY-MM-DD); null when none.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
periodStart
required

First day of the service period the line bills (YYYY-MM-DD); null when none.

Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
position
required

Zero-based sort position on the invoice.

integer
>= -9007199254740991 <= 9007199254740991
quantity
required
number
rate
required
number
revenueAccount
required

The line’s revenue account. Staff only; null while unset.

Any of:
object
code
required
string
id
required
string
name
required
string
revenueAccountId
required

Revenue account of the line. Staff only; null while unset.

string | null
service
required

The service the line was built from; null for a Custom line.

Any of:
object
id
required
string
name
required
string
serviceId
required

The service the line was built from; null for a Custom line.

string | null
team
required

The line’s class team. Staff only; null while unset.

Any of:
object
accountingClassName
required

The class name accounting reads; null when the team has none.

string | null
id
required
string
name
required
string
teamId
required

The team whose accounting class the line carries. Staff only; null while unset.

string | null
notes
required
string | null
number
required
string
orderId
required

The order this invoice sells or renews, when it has one.

string | null
orderPendingAt
required

When the invoice was created with its order To be confirmed; null once someone added it to an order, opened one from it or marked it No order, and for every invoice that never waited.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
origin
required

SYSTEM for an invoice this workspace issued, EXTERNAL for one issued elsewhere and recorded here. An EXTERNAL invoice is never emailed, rendered to PDF, charged, published or made recurring.

string
paidAt
required
Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
paymentRemindersPaused
required

Whether payment reminders are paused for this invoice alone. A paused company pauses all of its invoices regardless of this flag.

boolean
paymentRemindersPausedAt
required

When this invoice’s payment reminders were paused; null while they are not.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
periodEnd
required

End of the service period, inside its last day; an end exactly at a workspace midnight means the period ended the day before. See periodStart.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
periodStart
required

Start of the invoice’s own service period, the one accounting books: the subscription cycle or what a member set for a SYSTEM invoice, the order’s billing period orderId paid for on an EXTERNAL one. Workspace midnight of its first day.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
poNumber
required
string | null
sentAt
required
Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
status
required

Invoice status: DRAFT, SENT, VIEWED, OVERDUE, PAID or CANCELLED.

string
subject
required
string | null
subtotal
required
number
taxAmount
required
number
taxRate
required

Tax rate as a percentage (0-100); null when the invoice has no tax rate.

number | null
total
required
number
updatedAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/

Example

{
"data": {
"lineItems": [
{
"classSource": "RESOLVED"
}
]
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The caller lacks invoices.create, or lacks orders.create / orders.edit for the order sent (reason ORDER_CREATE_FORBIDDEN or ORDER_EDIT_FORBIDDEN), or lacks clients.edit for a clientPrefix (CLIENT_PREFIX_FORBIDDEN).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

A line names a service, package, order, line kind, revenue account or team that does not exist, or kind: existing names an order the caller does not reach (ORDER_NOT_FOUND) or the order type does not exist (ORDER_TYPE_NOT_FOUND), or the request sends an order while the Orders module is off for the workspace (MODULE_DISABLED).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The clientPrefix is already taken by another company (code ALREADY_EXISTS), or discount was sent with lines that carry a discountPercent (DISCOUNT_CONFLICT).

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The client does not belong to the active workspace or is out of the caller’s reach, issueDate or dueDate is not a YYYY-MM-DD date (VALIDATION_ERROR), contactId is not a user of that company, order is missing while the Orders module is on (VALIDATION_ERROR), or the order breaks a rule. reason is one of ORDER_CLIENT_MISMATCH, ORDER_NOT_ATTACHABLE, ORDER_TYPE_NOT_ALLOWED, ORDER_TYPE_REQUIRED, HOURS_REQUIRED, or an order-opening reason (INVALID_ORDER_TYPE, INVALID_ORDER_FIELDS, RATE_REQUIRED, PRICE_REQUIRED, CLIENT_PREFIX_REQUIRED, PROJECT_NOT_FOUND); fieldErrors names the fields at fault. When the workspace numbers invoices per company (invoiceNumberingMode COMPANY in the invoice settings), a company with no prefix cannot be numbered: the request is refused with reason COMPANY_PREFIX_REQUIRED, the message names the company and nothing is created.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.