Set a document's pricing table
Replaces the whole pricing table on a draft document and returns it with the totals Bonsai computed. A document without a pricing table gets one, in a new section at the end.
This is a full replace: send every package and row the table should
have, in order. Anything you leave out is removed. Packages and rows
have no id to send: each set writes them under new ids, and keys this
endpoint does not take are ignored. To change one row, read the table
with GET /public-api/v1/docs/{id}, change that row, and send the whole
table back.
Bonsai prices every row at quantity × rate, adding tax from the
row's tax_rate_ids when its package sets includes_tax. A row priced
from an estimate loses its markup and discount, and the table stops
following the estimate. Optional packages and optional rows are priced
but left out of subtotal, tax_total and total until the client
picks them. Each total is rounded to the cent on its own, so subtotal
plus tax_total can be a cent off from total.
The table keeps its currency; a new one takes your account's currency. Change the currency in Bonsai.
To make sure nobody changed the document since you read it, send its
updated_at as expected_updated_at, exactly as the document returned
it. If the document changed since, nothing is written and the response
is 409 with document_changed: read it again and retry.
Setting the table sends nothing to the client and leaves the payment
settings as they are; warnings says when the new table changes what
they collect. Someone with the document open in Bonsai has to reload it
to see the new table.
A document the token cannot see returns 404, and so does a template or
a document made in the previous Bonsai editor. One it can see returns
403 when the token may not edit documents, and 409 with
document_not_editable once it has been sent: only drafts can be
changed. A document with more than one pricing table returns 422 with
feature_not_available; change it in Bonsai.
Path Parameters
- Type: integerdoc
_id requiredThe document's
id.
Body
The pricing table, wrapped in a pricing_table key.
- Properties: 3Type: objectpricing
_table required
Responses
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
curl https://app.hellobonsai.com/public-api/v1/docs/1/pricing_table \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"pricing_table": {
"packages": [
{
"title": "Website",
"description": "Design and build",
"optional": false,
"includes_tax": false,
"unit": "flat",
"rows": [
{
"name": "Development",
"description": "Frontend and CMS",
"rate": "120",
"quantity": "40",
"unit": "per_hour",
"optional": false,
"tax_rate_ids": []
}
]
}
],
"package_selection": "multiple",
"expected_updated_at": "2026-04-14T09:12:04.000Z"
}
}'
{
"data": {
"currency": "USD",
"package_selection": "multiple",
"packages": [
{
"id": "V1StGXR8Z5jdHi6BmyTq2",
"title": "Website",
"description": "Design and build",
"optional": false,
"includes_tax": false,
"unit": "flat",
"total": "7800.0",
"rows": [
{
"id": "Uakgb4Jk0sQ3dTz9mPw7x",
"name": "Development",
"description": "Frontend and CMS",
"rate": "120.0",
"quantity": "40.0",
"unit": "per_hour",
"optional": false,
"tax_rate_ids": [],
"total": "4800.0",
"tax_total": "0.0"
}
]
}
],
"subtotal": "7800.0",
"tax_total": "0.0",
"total": "7800.0",
"warnings": [
{
"code": "recurring_pricing_locks_payments",
"message": "package Hosting recurs per_month, and Bonsai doesn't collect payments on a document with recurring pricing, so this document will not collect the payments it is set to; invoice the client from Bonsai instead, or make every package flat"
}
]
},
"meta": {
"request_id": "b1f0d2c4-7a9e-4c3b-8d5f-1e2a3b4c5d6e"
}
}