Skip to main content

Project expenses

A project expense records that the cost of an expense transaction, or part of it, is billed to a client under a project. The transaction stays an ordinary expense in the ledger and in every report: the link only adds what an invoice will later bill for. A project expense exists only in business workspaces: every operation below returns 409 WORKSPACE_NOT_BUSINESS in a personal workspace, and changing one needs a plan that includes business tools (402 otherwise; reads stay open after a downgrade).

All paths are under /v1/workspaces/{workspaceID}. Project expense IDs start with pexp_.

OperationMethod and pathScope
list-project-expensesGET /project-expensesprojects:read
get-project-expenseGET /project-expenses/{expenseID}projects:read
get-project-expense-summaryGET /project-expenses/summaryprojects:read
create-project-expensePOST /project-expensesprojects:write
update-project-expensePATCH /project-expenses/{expenseID}projects:write
delete-project-expenseDELETE /project-expenses/{expenseID}projects:write
preview-expense-billPOST /project-expenses/bill/previewinvoices:write
bill-expensesPOST /project-expenses/billinvoices:write

The projects:write scope is not offered to connected apps (OAuth or MCP clients); projects:read is. See Scopes. Linking an expense needs the role editor, admin or owner; viewers can read.

The last two operations bill expenses onto a draft invoice; see Billing expenses onto an invoice. Until an expense is billed it reads as unbilled (or non_billable).

The project expense object​

{
"id": "pexp_...",
"kind": "expense",
"projectId": "prj_...",
"transactionId": "txn_...",
"userId": "usr_...",
"date": "2026-11-03",
"description": "Paper Planet - Printer paper",
"amount": { "minor": 12345, "display": "$123.45" },
"markupBps": 1250,
"billableAmount": { "minor": 13888, "display": "$138.88" },
"billable": true,
"metadata": { "receipt": "r-1" },
"status": "unbilled",
"createdAt": "2026-11-03T10:00:00Z",
"updatedAt": "2026-11-03T10:00:00Z"
}
  • transactionId and projectId are required when creating. The transaction must be an expense in the workspace: income, transfers and opening balances are refused with 422 projectExpenseTransactionNotExpense, and an unknown transaction is a plain 404. The project must not be archived (409 PROJECT_ARCHIVED).
  • One transaction has at most one link. A second one is 409 PROJECT_EXPENSE_ALREADY_LINKED; details.projectExpenseId names the existing link. A receipt can't be split across two clients: bill part of it through amountMinor and add the rest to an invoice by hand.
  • amountMinor (request) and amount (response) are the cost to bill. It defaults to the transaction amount, can be lower (part of a receipt) and is never higher or zero (422 invalidProjectExpenseAmount).
  • markupBps is a markup in basis points, 0 to 10,000 (100 is 1%; 422 invalidProjectExpenseMarkup outside that). billableAmount is amount plus the markup, rounded half-up once to the smallest stored unit, which is what an invoice line bills. An invoice line sums its expenses exactly and rounds half-up once to the currency precision (see Billing expenses onto an invoice), so a line can differ from the sum of billableAmount by the rounding of a sub-cent amount.
  • date defaults to the transaction date. description is a single line of at most 500 characters (422 invalidProjectExpenseDescription for a line break or more) and defaults to the payee name and the memo; it becomes the invoice line description.
  • billable defaults to true. false keeps the expense on the project for cost tracking without billing it.
  • status is derived: billed when an invoice line bills it, written_off when an invoice's billing wrote it off, non_billable when it is not billable and neither of those, otherwise unbilled. invoiceLineId, invoiceId and writtenOffInvoiceId are present when they apply.
  • userId is the member who linked it. The transaction a link points at never changes: delete the link and add another.
  • metadata carries your own key/value pairs, like every other business record. See Metadata.

On update-project-expense fields left out are unchanged. A billed expense can't be edited or deleted (409 PROJECT_EXPENSE_BILLED; details.invoiceId names the invoice, and voiding it releases the expense). A request that carries only metadata still works on a billed expense.

An expense that billing wrote off (status written_off) keeps its cost fields until the write-off is restored: changing projectId, amountMinor, markupBps or billable is refused with 409 PROJECT_EXPENSE_WRITTEN_OFF (details.invoiceId names the invoice). date, description and metadata stay editable, and deleting or voiding that invoice frees the other fields.

Listing and summary​

list-project-expenses takes projectId, transactionId, userId, from and to (inclusive YYYY-MM-DD), status (unbilled, billed, written_off or non_billable), metadata[key]=value, page and pageSize (default 100, max 1000). It returns { expenses, total, page, pageSize, totalAmount }, newest day first. totalAmount is the cost, before markup, of every expense that matches the filter, not just the page.

get-project-expense-summary returns one row for each project that has expenses (optionally one projectId), in project ID order: unbilledCount, unbilledAmount (cost), unbilledBillableAmount (the same with markup, what billing it would add to an invoice), billedCount, billedAmount (with markup, as billed), nonBillableCount and nonBillableAmount.

What it does to the transaction​

The transactions API guards a linked transaction so the link can never describe money that isn't there:

Change to the transactionUnbilled linkBilled link
Amount raised, or lowered to the cost or moreNothing changesNothing changes
Amount lowered below the costThe cost drops to the new amount, and project_expense.updated records it with clamped_to_transaction409 TRANSACTION_BILLED_ON_INVOICE
Deleted (delete-transaction, bulk-delete-transactions)The link is deleted with it and project_expense.deleted is published409 TRANSACTION_BILLED_ON_INVOICE; a bulk delete changes nothing
Converted to a transfer409 TRANSACTION_HAS_PROJECT_EXPENSE409 TRANSACTION_HAS_PROJECT_EXPENSE

TRANSACTION_BILLED_ON_INVOICE names the transaction, the project expense and the invoice in details. A project with expenses can't be deleted (409 PROJECT_IN_USE); delete the links or archive the project.

A refund is a separate income transaction and never adjusts a billed expense by itself. A project expense is billed at the amount entered, as is. Its invoice line takes the workspace's default tax rate like any other new line (and the invoice's tax is computed from the lines as usual), and Budget Thing gives no tax advice on it.

Billing expenses onto an invoice​

preview-expense-bill and bill-expenses bill the cost of expenses of one project to a draft invoice of that project, or to a new draft created in it, the way Bill time with a preview bills time. Both take the same body, need the invoices:write scope and the write role, and need a plan that includes business tools to bill (402 otherwise); the preview changes and locks nothing.

{
"invoiceId": "inv_...",
"expenses": [
{ "id": "pexp_..." },
{ "id": "pexp_...", "writeOff": true }
],
"lineMode": "detailed",
"descriptionOverrides": { "expense:pexp_...": "Printer paper" }
}

Give invoiceId or "newInvoice": true, not both. Every expense in one call must belong to one project (422 PROJECT_EXPENSES_MULTIPLE_PROJECTS, the project IDs in details.projectIds), and the draft must be in that project (422 PROJECT_EXPENSE_NOT_BILLABLE, details.reason other_project); a non-draft is 409 INVOICE_NOT_DRAFT. An invoice with no project (a client-only invoice) is 422 INVOICE_HAS_NO_PROJECT.

  • expenses (1 to 1000, each at most once). An expense that is already billed is 409 PROJECT_EXPENSE_BILLED (details.invoiceId names the invoice), one written off by another invoice is 409 PROJECT_EXPENSE_WRITTEN_OFF, and one with billable false is 422 PROJECT_EXPENSE_NOT_BILLABLE (details.reason not_billable).
  • writeOff true doesn't bill the expense: the invoice writes its whole cost off (status written_off, writtenOffInvoiceId) and no line is created for it. Deleting or voiding the invoice restores it. A call that only writes off needs invoiceId; newInvoice would leave an empty draft, so it is 422 invalidBillExpenses.
  • lineMode: summary is one line and needs summaryDescription; grouped is one line per project (groupBy project, the only grouping, so one line, named for the project); detailed is one line per expense.
  • Line totals. An expense line has source expense, unit item, quantity 1 and a unit price equal to its total. The total is Σ amount × (10000 + markupBps) ÷ 10000 over the line's expenses, summed exactly and rounded half-up once to the currency precision, so a summary line of two 0.05 expenses with 10% markup is 0.11, not 0.06 + 0.06. The invoice total is checked against the largest storable amount (422 VALIDATION_FAILED, amountOutOfRange) and the line limit applies.
  • Descriptions are data only. The default is the expense's description, or its YYYY-MM-DD date when empty (detailed), or the project name (grouped). Send summaryDescription for the summary line; descriptionOverrides replaces any line's text by its key, and keys that match no line are ignored.
  • Line keys: summary, project:<id> (grouped) and expense:<id> (detailed).

The preview returns lines (each with key, kind expense, description, projectExpenseIds and total), billedCount, writtenOffCount, linesTotal (what the new lines add) and invoiceTotal (the invoice's own lines plus the new ones, with tax; no invoiceId when a new draft would be created). bill-expenses does the same atomically and answers 201 with invoice (all lines), lines (the ones just added), created, billedCount and writtenOffCount. Nothing is created when any check fails. A billed expense gets invoiceLineId and invoiceId; the change is recorded in the security log as invoice.expenses_billed (amounts and counts, no text), and invoice.updated webhooks fire as for any draft change.

Release. Deleting the invoice line, deleting the draft, or voiding the issued invoice releases the expenses exactly like billed time: invoiceLineId clears, write-offs restore, and the expense can be edited and billed again. An expense an invoice bills can't be edited or deleted, and its transaction can't be deleted or lowered below the cost (see above). The price and quantity of an expense line follow its expenses (422 invoiceExpenseLineLocked); its discount, wording, tax rate and position can change.

Locking. The bill locks the draft invoice first, then the project, then the transactions, then the expenses, each in ID order, the same order the transactions service and these endpoints use, so a bill and an edit of the linked transaction can't deadlock. Concurrent bills of the same expense leave exactly one winner; the others get 409 PROJECT_EXPENSE_BILLED. Everything is re-read after the locks, so a bill sees a cost that a concurrent transaction edit lowered.

Unbilled expenses also appear in the time by project report.

Webhooks​

project_expense.created, project_expense.updated and project_expense.deleted are public webhook events in the Projects domain; they need projects:read. They carry identifiers, the date, the cost in the stored scale (amount_minor), the markup, the billable flag and the metadata, never the description. project_expense.updated carries changes for project_id, date, amount_minor, markup_bps and billable, and clamped_to_transaction: true when a lowered transaction amount lowered the cost; project_expense.deleted carries with_transaction: true when the link went with its transaction.

Backup, export and clones​

Project expenses are part of workspace backups, which can only be restored into a business workspace, and restore linked to the restored project, transaction and invoice line. Workspace clones copy them. The data export lists them as projectExpenses in data.json and as project-expenses.csv, with the cost in the workspace's minor unit and no member IDs. Purging a workspace deletes them with it.

Errors​

StatusCodeMeaning
404PROJECT_EXPENSE_NOT_FOUNDNo project expense with that ID in the workspace.
409PROJECT_EXPENSE_BILLEDAn invoice bills the expense; it can't be edited or deleted.
409PROJECT_EXPENSE_WRITTEN_OFFAn invoice's billing wrote the expense off; delete or void that invoice to bill it again. Editing projectId, amountMinor, markupBps or billable is refused the same way.
409PROJECT_EXPENSE_ALREADY_LINKEDThe transaction already has a link.
409TRANSACTION_BILLED_ON_INVOICEA billed link keeps the transaction from being deleted or lowered below the cost.
409TRANSACTION_HAS_PROJECT_EXPENSEA linked transaction can't become a transfer.
409PROJECT_ARCHIVEDThe project is archived.
409WORKSPACE_NOT_BUSINESSThe workspace is a personal workspace.
422PROJECT_EXPENSE_NOT_BILLABLEThe expense can't be billed: it is flagged not billable, or belongs to another project than the invoice's (details.reason).
422PROJECT_EXPENSES_MULTIPLE_PROJECTSA bill names expenses of more than one project.
422VALIDATION_FAILEDA cost, markup, description, date or transaction kind the API refuses (invalidProjectExpenseAmount and the others above).