Email an invoice to the customer
POST/api/v1/invoices/{id}/send
Sends the customer a link to the online invoice and a PDF copy. A draft is issued first, with the same rules as issueInvoice (422 invoice_has_no_items when it has no lines), taking issue_date and due_date when given. A void invoice returns 409. Emails are limited to 100 a day per account.
- Needs an API key, and runs with the access of the member who made the key.
- Send an
Idempotency-Key. The same key with the same request within 24 hours gives the first answer again and changes nothing. - A connected AI assistant can use it too, as
sendInvoice.
Parameters
In the address
idstring (uuid)required
Headers
Idempotency-KeystringrequiredUnique user-scoped key for safely retrying this mutation for 24 hours.
At least 1 character. Up to 200 characters.
Request body
Sent as application/json.
lock_versionintegerAt least 0.
emailobjectrequiredFields(3)
tostring (email)requiredmessagestring or nullReplaces the default email text (`email_message` on the quote or invoice).
Up to 2000 characters.
copy_to_senderbooleanBlind-copies the signed-in user so they keep what the customer received.
Default: false.
issue_datestring (date)Draft only: the invoice date it is issued with. Ignored once issued.
due_datestring (date)Draft only: the due date it is issued with. Ignored once issued.
Responses
200Invoice details.
dataobjectrequiredFields(49)
lock_versionintegerrequiredAt least 0.
created_atstring (date-time)requiredupdated_atstring (date-time)requiredidstring (uuid)requiredaccount_idstring (uuid)requiredcustomer_idstring (uuid)requiredjob_idstring (uuid) or nullquote_idstring (uuid) or nullkindstring`deposit` for the invoice issued when a quote that asks for a deposit is accepted; its `quote_id` is that quote. It is an invoice like any other: sent, paid, reminded about and voided the same way. Every other invoice is `standard`. Read-only.
One of: standard, deposit.
deposit_invoice_idstring (uuid) or nullThe deposit invoice this invoice takes off. The first invoice for a job whose quote had its deposit invoiced deducts it, once: the one invoice of a job billed on completion always, and for a job billed by visit the first invoice that comes to at least the deposit. An invoice made with createInvoice that names the job counts as the job's. A deposit invoice that has been voided is never deducted, and voiding or deleting the invoice that deducted one leaves it to be deducted again. Read-only.
deposit_deduction_centsinteger (int64)The deposit invoice's amount before tax, taken off this invoice before tax beside `discount_cents`: `total_cents` is `subtotal_cents` less `discount_cents` less this, plus `tax_cents`. `tax_cents` is then the tax the lines carry after the discount, less the tax the deposit invoice charged, so the two invoices come to exactly what one would have. When the lines come to less than the deposit, all of them comes off and nothing is left to pay. 0 when no deposit is taken off. Read-only.
At least 0.
numberstringrequiredtitlestringrequireddescriptionstring or nullstatusstringrequiredOne of: draft, issued, void.
payment_statusstringrequired`written_off` when the business has written off what was left to pay (writeOffInvoice): settled, and never received.
One of: unpaid, partially_paid, paid, written_off.
overduebooleanrequiredPast its due date with something left to pay. Never while `collecting`, or while `collect_on` is set.
collectingbooleanrequiredA payment is on its way and has not cleared: one the customer made online, or a Direct Debit. The invoice is not overdue, cannot be voided and is not to be chased.
collecting_centsinteger (int64)requiredHow much is on its way: the invoice's `pending` payments.
At least 0.
collect_onstring (date) or nullThe day the customer's bank is expected to be debited, when the invoice is going to be collected by Direct Debit without anybody asking: the due date, or the next working day; later when the invoice was issued with less than two working days to go, and on a bank holiday. Null for any other invoice, and once a collection has been started. An invoice collects itself only if it was issued while its customer's Direct Debit was in force, and nothing has been paid or tried online for it: one issued while a new Direct Debit was still being confirmed by the customer's bank is paid some other way, or collected with collectInvoice.
collectablebooleanrequiredWhether collectInvoice would start a Direct Debit for what is left to pay now.
direct_debit_failedbooleanrequiredTrue when the last Direct Debit collection tried for the invoice failed, or could not be started, and something is still left to pay. Nothing is tried again by itself: it stays true until collectInvoice starts another collection or the invoice is paid some other way. A payment recorded by hand with the method `direct_debit` does not count as a collection.
currencystringrequiredsubtotal_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
discount_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
tax_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
total_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
paid_centsinteger (int64)requiredPayments that have `succeeded`, less what was refunded.
At least 0.
written_off_centsinteger (int64)requiredWhat the business wrote off with writeOffInvoice because the customer will not pay it: settled, and never received, so it is not in `paid_cents`. 0 unless written off.
At least 0.
written_off_atstring (date-time) or nullWhen it was written off. Null unless it is.
write_off_reasonstring or nullWhy it was written off. The customer is never shown it.
Up to 255 characters.
written_off_by_membership_idstring (uuid) or nullThe member who wrote it off.
balance_due_centsinteger (int64)requiredWhat is left to pay: the total less `paid_cents` and `written_off_cents`, and never below zero.
At least 0.
issue_datestring (date) or nulldue_datestring (date) or nullissued_atstring (date-time) or nullpaid_atstring (date-time) or nullWhen nothing was left to pay. Null again if a refund, a failed payment or a dispute leaves a balance, and null for an invoice written off: that is settled, not paid.
voided_atstring (date-time) or nullsent_atstring (date-time) or nullWhen the invoice was last emailed.
sent_to_emailstring (email) or nullemail_messagestringThe note the invoice is emailed with unless the sender edits it, from the account's template. [Link] and any placeholder without a value yet are filled in on sending.
public_urlstring (uri) or nullThe customer's link. Null while the invoice is a draft or archived.
notesstring or nulltermsstring or nullbill_toobject or nullWho the invoice is addressed to and where the work was, frozen when it is issued. Null on a draft, which shows the live customer and property.
Fields(4)
namestringrequiredThe property's billing name, else the customer's name.
company_namestring or nulladdressobject or nullThe property's billing address, else the customer's, else the property's own address.
Fields(6)
address_line_1stringrequiredaddress_line_2string or nullcitystringrequiredregionstring or nullpostal_codestringrequiredcountry_codestringrequiredAt least 2 characters. Up to 2 characters.
propertystring or nullThe property the work was at, on one line, printed as "Property: …".
invoice_remindersstringrequiredWhether the overdue reminders the workspace sends by itself go for this invoice: `default` follows its customer's `invoice_reminders`. The one field an issued invoice can still change: send it with `lock_version` alone.
One of: default, on, off. Default: "default".
remindersobject or nullrequiredWhere the invoice's overdue reminders stand. Null for an invoice that asks for nothing: a draft, a void or archived invoice, and one with nothing left to pay.
Read only.
Fields(5)
settingstringrequiredWhether an email the workspace sends by itself goes: `default` follows the workspace's switch, `on` sends it even while that is off, and `off` never does. The most specific setting wins: an invoice's own over its customer's, and a customer's over the workspace's. Set to `on`, it counts from that moment, so nothing already overdue or awaiting an answer is chased that day. Emails a person sends are not affected.
One of: default, on, off. Default: "default".
sentintegerrequiredHow many reminders the customer has been sent about it, by themselves or with sendInvoiceReminder.
At least 0.
limitintegerrequiredThe most that are sent by themselves, the workspace's `invoice_reminder_limit`.
At least 1.
next_onstring (date) or nullrequiredThe first day the next reminder can go by itself, in the workspace's time zone. A refund, a failed payment or a dispute can hold it back. Null when `reason` says why none will.
reasonstring or nullrequiredWhy no reminder will go by itself. `collecting`: a payment is on its way. `direct_debit`: a Direct Debit is going to collect it. `customer_archived`: the customer is archived. `no_email`: the customer has no email address. `off_invoice`, `off_customer`, `off_workspace`: the setting that decides is off. `plan`: the plan does not include automatic emails. `all_sent`: it has had `limit`. Null while one is to come.
One of: collecting, direct_debit, customer_archived, no_email, off_invoice, off_customer, off_workspace, plan, all_sent.
itemsarray of objectrequiredEach item(12)
idstring (uuid)requiredservice_idstring (uuid) or nullpositionintegerrequireddescriptionstringrequiredquantitystringrequiredMatches ^\d{1,9}(\.\d{1,3})?$.
unit_namestring or nullunit_price_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
tax_rate_basis_pointsintegerrequiredAt least 0. At most 10000.
tax_inclusivebooleanrequiredsubtotal_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
tax_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
total_centsinteger (int64)requiredInteger minor currency units, such as pence.
At least 0.
paymentsarray of objectrequiredEach item(10)
idstring (uuid)requiredamount_centsinteger (int64)requiredAt least 1.
methodstringrequiredOne of: cash, cheque, card, bank_transfer, direct_debit, other.
statusstringrequiredA payment recorded with createInvoicePayment or createCustomerPayment has `succeeded`. One the customer made online, or a Direct Debit, is `pending` until the money clears, `failed` if it does not or if a dispute is lost, and `disputed` while the customer's bank decides a dispute. A Direct Debit collection that could not be started at all is recorded as `failed` too, with why in `notes`. Only a `succeeded` payment, less `refunded_cents`, counts towards the invoice's `paid_cents`.
One of: pending, succeeded, failed, disputed.
refunded_centsinteger (int64)requiredHow much of the payment has been refunded: its `refunds` that `succeeded`, added up, and 0 for a payment that `failed`. Never more than `amount_cents`.
At least 0.
refundsarray of objectrequiredEvery refund of the payment, oldest first, including those that failed. Empty when there are none. A history: `refunded_cents` is the figure to count with.
Each item(9)
idstring (uuid)requiredamount_centsinteger (int64)requiredHow much was refunded, in minor currency units.
At least 1.
statusstringrequired`succeeded` from the moment the refund is made, though a refund through Stripe can take 5 to 10 working days to reach the customer's card or bank account. `failed` when Stripe could not get the money back to the customer, or the refund was cancelled: it no longer counts in the payment's `refunded_cents`, so the payment counts towards the invoice again.
One of: succeeded, failed.
sourcestringrequiredHow it was made. `app`: from TradeSender, through the business's Stripe account ("From TradeSender"). `manual`: a payment recorded by hand, refunded as a record, with no money moved ("Recorded by hand"). `stripe`: outside TradeSender, in the Stripe dashboard or by Stripe itself ("In Stripe").
One of: app, manual, stripe.
membership_idstring (uuid) or nullrequiredThe member who made it. Null for a refund made in Stripe, and for one whose maker was not kept.
refunded_atstring (date-time)requiredWhen the refund was made.
failed_atstring (date-time) or nullrequiredWhen the refund was found to have failed. Null unless it `failed`.
failure_reasonstring or nullrequiredStripe's reason for a refund that failed, such as `expired_or_canceled_card` or `lost_or_stolen_card`, when it gives one.
referencestring or nullrequiredThe last 8 characters of Stripe's id for the refund. Null for a refund recorded by hand.
onlinebooleanrequiredWhether the payment went through the business's Stripe account: paid online by the customer, or collected by Direct Debit. A refund of it goes back through Stripe to the card or bank account it came from. False for a payment recorded with createInvoicePayment or createCustomerPayment, whose refund moves no money.
referencestring or nullnotesstring or nullFor a payment that failed, why.
paid_atstring (date-time)requiredWhen it was paid. For a payment made online, when the customer started it.
A refusal answers in the one error shape every operation shares.
Example
A request our own tests send. The ids are made up: put your own in their place.
curl -X POST "https://app.tradesender.co.uk/api/v1/invoices/5c559b97-554b-55cc-840a-83f274908399/send" \
-H "Authorization: Bearer $TRADESENDER_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"email": {
"to": "taylor@example.test"
}
}'