Resources
Estimates
Find, create, and edit estimates, including their sections and lines. Find the project first with GET /v1/opportunities, then work with the estimates on it.
What the API can do
You can search estimates, read one, create one, duplicate one, edit its header fields, and add, edit, arrange, copy, and delete its sections, groups, and lines. A key acts as the workspace member who generated it, so that member needs estimates.view to read, estimates.create to create, and estimates.editfor every other write. Every write is recorded in the workspace's audit log against that member.
What the API cannot do
It never sends, approves, cancels, or deletes an estimate. Do those in Coastline.
It does not yet link sections to measurements or edit measurement sets. Do that in Coastline, then use the measurements in a line's formula.
Editing a sent or approved estimate is allowed; the response's has_unsent_changes tells you the customer has not seen the edit.
/v1/estimatesFind an estimate
All filters are optional and combine. To get the estimates on a project, pass its project_id. To get one estimate without knowing its id, pass project_id and number together. Results are newest first.
List rows have no total. Read the estimate to get it. The response carries has_more rather than a count.
| Query parameter | Type | Description |
|---|---|---|
| project_id | uuid | Only estimates on this project. |
| number | integer | The estimate number on its project. Requires project_id, because numbers repeat across projects. |
| status | enum | One of: draft, sent, approved, cancelled. |
| contact_id | uuid | Only estimates addressed to this contact. |
| q | string | Case-insensitive match on the estimate name. |
| updated_since | ISO timestamp | Only estimates changed at or after this time. |
| limit | integer | Default 25, maximum 100. |
| offset | integer | Default 0. |
/v1/estimates/{id}Read an estimate
Returns the estimate with its total, its sections in order, and each section's lines in order. tax_rate and section margin are fractions: 0.0825 is 8.25%.
Lines with generated: true are labor minimum lines that Coastline adds and updates automatically, in a section with maintained_automatically: true. They count toward the total, and the API refuses to change or delete them. Their labor_minimum_category is the {category}for the labor minimums endpoint; it is null on every other line. A line's calc and waste_pct show how its quantity was worked out, whether it was entered as a formula in the app or sent through the API.
The read also returns the numbers the customer sees, so you can check your work without doing the math. Every money figure, totalincluded, is in dollars rounded to cents. The estimate's tax follows the customer document: the rounded total minus the rounded subtotal after discount. Prices are covered in Cost and price.
| Added to every read | Type | Description |
|---|---|---|
| subtotal | number | Estimate level. The sum of the section subtotals, before discount and tax. |
| discount | number | Estimate level. The discount in dollars, 0 when there is none. |
| tax | number or null | Estimate level. The tax in the total. Null when override_total is set, because that figure already includes tax. |
| discount_amount | number or null | Estimate level. The discount that was set, in dollars. |
| waived_labor_minimums | string[] | Estimate level. The labor minimum categories waived on this estimate. |
| groups | object[] | Estimate level. Section groups, each with id, parent_id, name, description, and position. See Groups and Arranging sections. |
| group_id | uuid or null | Section level. The group the section sits in. |
| description | string or null | Section level. Text shown under the section name. |
| subtotal | number | Section level. The section subtotal override when one is set, otherwise the sum of its line totals. |
| subtotal_overridden | boolean | Section level. True when override_subtotal is set. |
| tax | number | Section level. Tax on the section subtotal, 0 when the section is not taxable. |
| total | number | Section level. Section subtotal plus section tax. |
| price | number | Line level. The price per unit, before any section subtotal override. When subtotal_overridden is true the customer document scales line prices to fit the override, so use the section subtotal there. |
| labor_minimum_category | string or null | Line level. On a generated line, the category to use with the labor minimums endpoint. Null otherwise. |
| line_total | number | Line level. price times quantity, before tax and before any section subtotal override. |
Cost and price
unit_costis what the work costs you, not what the customer pays. The section's margin turns it into the customer's price: price = unit_cost / (1 - margin). A cost of 100 in a section with a margin of 0.3 is a price of about 142.86 per unit.
A new section takes the estimate's default_section_margin, then the project location's margin, then the workspace target. To charge a specific price, set the section's margin to 0 and send the price as unit_cost, or work backward: unit_cost = price * (1 - margin). Read the estimate back and check price and line_total.
/v1/estimates/{id}/activityRead an estimate's activity
Returns the estimate's timeline, newest first, up to the latest 50 events. A person is named only when they are a member of your workspace; otherwise performed_by_name is null.
| Event field | Type | Description |
|---|---|---|
| id | uuid | The event. |
| event_type | string | What happened. |
| actor | string | Who the timeline credits with it. |
| performed_by_id | uuid or null | The workspace member behind it, when there is one. |
| performed_by_name | string or null | That member’s name. |
| metadata | object | Holds name or new_expiration_date when the event has one. Often empty. |
| created_at | ISO timestamp | When it happened. |
/v1/estimatesCreate an estimate
Creates an estimate on a project with one empty section, and returns it as a read does. Tax rate, margin, and expiry start from the project's location and the workspace defaults. With template_idthe template's sections and lines are copied in.
| Body | Type | Description |
|---|---|---|
| project_id | uuid | Required. The project the estimate belongs to. |
| name | string | Required. 200 characters or fewer. |
| template_id | uuid | Optional. An estimate template in your workspace. |
| id | uuid | Optional. Makes a retry safe. See Safe retries. |
/v1/estimates/{id}Edit an estimate
Every field is optional; only what you send changes. Returns the full estimate.
| Body | Type | Description |
|---|---|---|
| name | string | 200 characters or fewer. |
| notes | string | 10,000 characters or fewer, or null to clear. |
| tax_rate | number | A fraction from 0 to 1. 0.0825 is 8.25%. |
| expiration_date | date | YYYY-MM-DD, or null to clear. |
| default_section_margin | number | A fraction from 0 up to, but not including, 1. Used for sections added later. Null clears it. |
| override_total | number | Replaces the calculated total. Null clears it. |
| contact_id | uuid | The contact the estimate is addressed to, or null to clear. Must be a contact in your workspace. |
| project_manager_id | uuid | The project manager, or null to clear. Must be a member of your workspace. |
| discount_amount | number | A discount in dollars, above 0 and no more than the subtotal. Null clears it. Refused on an approved estimate and while override_total is set, and cannot be sent in the same request as override_total. |
/v1/estimates/{id}/reset-tax-rateNo body. Sets the tax rate back to what a new estimate on the same project would start with: the project location's rate, then the workspace's, then 0. Returns { "data": { "tax_rate": 0.0825 } }.
/v1/estimates/{id}/labor-minimums/{category}Waives or restores one category's labor minimum. Send { "waived": true } or { "waived": false }. The automatic labor minimum lines update to match. Take {category} from labor_minimum_category on a generated line.
On an approved or cancelled estimate the choice is saved but the lines are left as they were, and the response says "applied": false. The response also carries category, waived, and the full waived_labor_minimums list.
Sections
/v1/estimates/{id}/sectionsAdds an empty section after the last one. Without marginit takes the estimate's default margin, then the location's, then the workspace target. Sections are taxable unless you say otherwise. Returns the section.
| Body | Type | Description |
|---|---|---|
| name | string | 200 characters or fewer. Defaults to Section N. |
| margin | number | A fraction from 0 up to, but not including, 1. |
| taxable | boolean | Defaults to true. |
| description | string | 5,000 characters or fewer, or null to clear. |
| id | uuid | Optional, on create only. Makes a retry safe. See Safe retries. |
/v1/estimates/{id}/sections/{sectionId}Takes the same fields as adding a section, except id, plus override_subtotal (a number, or null to clear). To reorder sections or move one into a group, see Arranging sections.
/v1/estimates/{id}/sections/{sectionId}Deletes the section and every line in it. Returns { "id": "...", "deleted": true }.
/v1/estimates/{id}/sections/{sectionId}/duplicateCopies a section and its lines. The copy keeps the name and lands right after the original, in the same group. It also copies the section's margin, tax setting, subtotal override, and measurement link, and each line's formula. Send nothing, or { "id": "..." } to make a retry safe. Returns the new section with its lines, status 201.
The automatic labor minimum section cannot be duplicated, and its generated lines are never copied.
Groups
A group collects sections under one heading on the customer document. Read them in the groups list of an estimate; a section's group_id says which one it is in.
/v1/estimates/{id}/groupsAdds a group at the top level, after everything else. To put sections in it, or to nest it, use Arranging sections. Returns the group, status 201.
| Body | Type | Description |
|---|---|---|
| name | string | 200 characters or fewer. Defaults to Group N. |
| description | string | 5,000 characters or fewer, or null. |
| id | uuid | Optional. Makes a retry safe. See Safe retries. |
/v1/estimates/{id}/groups/{groupId}Changes name or description (null clears it). Send at least one. Returns the group.
/v1/estimates/{id}/groups/{groupId}Deletes the group only. The sections and groups inside it move up one level, and nothing else is deleted. Returns { "id": "...", "deleted": true }.
Arranging sections
/v1/estimates/{id}/layoutSections and groups are ordered as one list, the way they read on the customer document. A group's members must follow it directly in that list. You send the whole list: every group and every section on the estimate, except the automatic labor minimum section, which always stays last. Each entry names its kind (group or section), its id, and its parent_id: the id of the group it sits in, or null at the top level.
This one call is how you reorder sections, move a section into or out of a group, and nest a group inside another. There is no call that moves a single section: read the estimate, reorder the list, and send it back. Returns the whole estimate, as a read does.
Nothing is applied unless the list is valid. The request is refused with 400when it leaves out a group or section, lists one twice or one that is not on this estimate, splits a group's members apart, names a parent_id that is not a group, or lists the labor minimum section. If the estimate changed while you were arranging it, the answer is 409: read it again and retry.
| Body | Type | Description |
|---|---|---|
| nodes | object[] | Required. The whole list, in order. Each entry has kind, id, and parent_id, and nothing else. |
Lines
/v1/estimates/{id}/itemsAdds a line to a section, after its last line. To add several at once, send items instead of a single line: between 1 and 200, saved together or not at all. A single line returns the line; a list returns a list in order.
Size a line with quantity, or with a formula. See Formulas and waste below. Without either, the quantity is 1.
| Body | Type | Description |
|---|---|---|
| section_id | uuid | Required. A section of this estimate. |
| id | uuid | Optional. Makes a retry safe. In the bulk form it goes on each line instead. See Safe retries. |
| name | string | Required. 500 characters or fewer. |
| quantity | number | Defaults to 1. |
| unit | string | 20 characters or fewer. Defaults to ea. |
| unit_cost | number | Cost per unit. Defaults to 0. |
| description | string | 5,000 characters or fewer, or null. |
| catalog_item_id | uuid | Optional link to a catalog item in your workspace. |
| calc | string | A formula, 500 characters or fewer. The quantity is worked out from it. Cannot be sent with quantity. |
| waste_pct | number | 0 to 999.999. Needs calc on a new line. |
| is_bold | boolean | Defaults to false. Bolds the whole line on the estimate and its PDF. |
| is_underline | boolean | Defaults to false. Underlines the whole line on the estimate and its PDF. Independent of is_bold. |
| items | object[] | Bulk form. Each entry takes the fields above except section_id. Send this or a single line, not both. |
/v1/estimates/{id}/items/{itemId}Takes any of the line fields above, plus two for placement. section_id moves the line to another section of the same estimate, where it lands last unless you also send position. position is zero-based, and the other lines shift to make room.
Changing quantity on a line that was entered as a formula clears its calc and sets waste_pct to 0, so the line never shows a formula that no longer produces its quantity. is_bold bolds or unbolds the whole line and changes nothing else. is_underline underlines it, independently: a line can be bold, underlined, both or neither.
Sending calcworks out the quantity from it, using the line's waste. Sending only waste_pctworks the quantity out again from the line's formula, or from its current quantity when it has none, and leaves calc as it was. If the stored formula points at a measurement that has since been removed, the new waste is saved and the quantity is left alone. Sending quantity together with calc or waste_pct is refused.
Formulas and waste
calc is the same formula you would type in the builder: numbers, + - * /, brackets, and measurement references in braces such as {roof_squares}. Short codes such as SQare expanded to their references, and the line stores the expanded formula. A reference resolves against the measurement set linked to the line's section (or its group) in Coastline; a formula with no references needs no set.
Waste is applied once, at the end: quantity = result * (1 + waste_pct / 100), rounded to two decimals. If the line has a catalog item with unit conversions, the result is converted to the line's unit first; otherwise the number passes through unchanged. Changing a measurement or a link never recomputes existing lines. Send the calc again to refresh one.
A formula that cannot be worked out is a 400 and nothing is saved, in a bulk request too: an empty formula, one that is not valid, or one that names a measurement the section has no usable number for. The message names the missing references and lists what is available.
Example: with 30 roof squares in the section's set, sending { "calc": "{roof_squares}*3.5", "waste_pct": 10 } gives a quantity of 115.5.
/v1/estimates/{id}/items/{itemId}Deletes the line. Returns { "id": "...", "deleted": true }.
/v1/estimates/{id}/items/bulk-deleteDeletes several lines at once. Send { "item_ids": ["...", "..."] }, from 1 to 200 different ids. It is all or nothing: if any id is not a line of this estimate, or is an automatic labor minimum line, nothing is deleted. Returns { "data": { "deleted": 2 } }.
/v1/estimates/{id}/items/duplicateCopies from 1 to 200 lines of this estimate, in the order of item_ids, with their formulas. The copies go to the end of the section you name in section_id. Without it they go to the section the lines are in, which works only when they all share one; otherwise section_id is required. Add index (zero-based) to place them there instead of at the end.
Generated labor minimum lines cannot be copied, and nothing can be copied into the labor minimum section. Returns the new lines in order, status 201.
| Body | Type | Description |
|---|---|---|
| item_ids | uuid[] | Required. 1 to 200 different lines of this estimate. |
| section_id | uuid | Optional. The section to copy into. |
| index | integer | Optional. Where the copies land in that section, counting from 0. |
| ids | uuid[] | Optional. One new id per entry in item_ids, in the same order. Makes a retry safe. |
Duplicate an estimate
/v1/estimates/{id}/duplicateCopies an estimate onto the same project, with its groups, sections, and lines. The copy is always a draft with a new number, and none of the original's sent, viewed, or approved state. Waived labor minimums, the bill-to account, and the default section margin are not copied. The key's member needs estimates.create. Returns the new estimate, status 201.
| Body | Type | Description |
|---|---|---|
| name | string | Required. 200 characters or fewer. |
| id | uuid | Optional. Makes a retry safe. See Safe retries. |
Safe retries
When a request times out you cannot tell whether it landed, and sending it again can create a second estimate, section, group, or line. Every create and every copy accepts an optional id: a UUID you choose for the new row. Send the same one on the retry. Copying several lines takes ids, one per line.
If the row already exists, you get it back with 200 and nothing is written. That response is the row as first created, even if the retry body differs. An id that belongs to anything else is 409. For several lines in one request, give every line an id or none of them; they land together or not at all. A retried copy of lines is answered with 200 only when every id is already a line of the target section.
A retried estimate must name the same project, and a retried duplicate must be of an estimate on that project. A retried duplicate of an estimate or a section that has not finished copying is 409; wait a moment and send it again. A duplicate's id cannot be the id of the thing you are copying. Edits take no id, because sending the same edit twice is already harmless. Arranging with PUT /layout is the same: sending the same list twice changes nothing.
Bulk delete is the one write that is not safe to retry: after a success the lines are gone, so the retry is 404. Read the estimate to check.
Errors worth knowing
| Status | Type | Description |
|---|---|---|
| 400 | validation_error | A malformed field, an unknown field, a status field (estimates cannot be sent, approved, or cancelled here), a formula that cannot be worked out, quantity sent with calc or waste_pct, waste_pct without calc on a new line, number without project_id, a change to a labor minimum line or section, a layout that is incomplete or splits a group, a copy of a labor minimum line or section, a duplicate whose id is the id of what it copies, or a discount that is refused (approved estimate, total override set, above the subtotal, or sent together with override_total). |
| 404 | not_found | The estimate, section, group, line, project, template, catalog item, contact, or project manager does not exist in your workspace. One in another workspace answers 404, never 403. |
| 409 | conflict | An id you sent on a create or a copy is already used by something else, or a retried estimate or duplicate arrived before the first attempt finished. Also a layout sent for an estimate that changed while you arranged it (read it again and retry), a section that changed while it was being deleted, for example someone added a line, and a discount change that lost a race with an approval or a total override. Read it again and retry. |
Error bodies look like { "error": { "code": "...", "message": "..." } }. A key whose member lacks the needed permission gets 403 naming it.