Project budgets
These endpoints write the original budget of a delivery project (the budget as it was sold) one row at a time, through the same code as the Budget tab in Drum. To change the budget after it is sold, raise a variation instead.
To read the budget, use GET /api/v1/projects/:id?include=budget_lines. An opportunity is not a delivery project: write its deliverables and tasks with the opportunity row endpoints, and its prices in its proposal budget.
Money is integer cents, tax exclusive. You send cents in fields ending _cents. Results show money as an object: {"cents": 120000, "currency": "AUD", "formatted": "$1,200.00"}. Quantities are decimals, and percents are numbers from 0 to 999.99.
Endpoints
All paths start with /api/v1/projects/:project_id/budget.
| Method and path | Does |
|---|---|
POST .../deliverables |
Adds a deliverable, or deliverables from a project template |
PATCH .../deliverables/:id |
Changes a deliverable, its budget type or its rate card |
DELETE .../deliverables/:id |
Deletes a deliverable with its tasks |
POST .../tasks |
Adds a task to a deliverable |
PATCH .../tasks/:id |
Changes a task, its pricing or its contingency, or moves it to another deliverable |
DELETE .../tasks/:id |
Deletes a task with its lines |
POST .../resources |
Adds a resource line to a task |
PATCH .../resources/:id |
Changes a resource line |
DELETE .../resources/:id |
Deletes a resource line |
POST .../costs |
Adds an expense line to a task |
PATCH .../costs/:id |
Changes an expense line or its markup |
DELETE .../costs/:id |
Deletes an expense line |
Send the row’s fields at the top level of a JSON body. A PATCH changes only the keys you send, and null clears an optional field.
Which projects you can reach
The project must be a kept delivery project that the token’s user can read. Anything else, an opportunity included, answers 404 project_not_found. A row of another project answers 404 with the row’s code, for example task_not_found.
A row that a variation adds belongs to that variation until it is approved. While the variation is a draft, submitted or rejected, a write to the row here answers 422 row_in_variation, and the message names the variation. Change it through the variation’s rows. Once the variation is approved, its rows are ordinary budget rows.
Permissions
| Row | API permission | Drum role permission |
|---|---|---|
| Deliverable | api_create, api_update or api_delete (by method) |
To add or change: the deliverable edit rights, or update_budgets (or a project role with it). budget_type, rate_card_id and reprice_resources always need update_budgets. To delete: the deliverable delete rights, or delete_budgets |
| Task | As above | To add or change: the task edit rights, or update_budgets. The pricing fields (budget_type, quantity, quantity_unit, rate_cents, contract_value_cents, resource_type_id, contingency_percent) always need update_budgets. To delete: the task delete rights, or delete_budgets |
| Resource line | As above | The right to edit the task |
| Expense line | As above | update_budgets to add or change, delete_budgets to delete |
A project role grants update_budgets and delete_budgets on its own project. A missing role permission answers 403 not_authorized.
How the budget is priced
The rules are Drum’s, and they are the same on the web, in the REST API and in the MCP tools.
- A fixed task is priced by its own
quantityxrate_cents. Until it has lines, its budget is the same amount. Once it has resource or expense lines, they make its internal budget, and its price stays its own quantity and rate. - A dynamic task is priced by its lines. Its budget is the lines at cost. Its contract value is the resource lines, plus its contingency, plus the price of each expense line.
- Contingency is the task’s
contingency_percentof its resource and expense lines at cost. It is never charged on markup. - An expense line’s price is its cost plus its
markup_percentof the cost. - Each contingency and markup amount is rounded to the cent on its own line, then summed.
- Contingency and markup apply only on a fixed fee deliverable in an account that shows contract values. On a time and materials deliverable, or in a budget only account, the contract value is the budget and the stored percents have no effect.
- A dynamic task with no lines is worth zero.
Switching a task’s budget type
- Fixed to dynamic. The task is priced again from its lines, and Drum prefills the contingency that keeps the contract value as close as it can to the old fixed price. The prefill is 0 when the task has no lines, or when the fixed price is below the lines. A
contingency_percentsent with the switch wins over the prefill. - Dynamic to fixed. The task becomes quantity 1,
per_item, at a rate of its current contract value, with contingency and markup included, so the client price does not drop. With no lines, the rate is 0. contingency_percenton a fixed task answers422 invalid_inputwith codecontingency_dynamic_only. Sendbudget_type: "dynamic"in the same request, or leave the percent out.
Deliverables
| Field | Notes |
|---|---|
name |
Default on POST: New Deliverable |
description, colour, start_date, end_date |
null clears |
position |
1-based place among the deliverables, or {"after": id} or {"before": id} |
project_phase_id |
A phase of the project. null takes it out of its phase |
budget_type |
fixed_fee or time_and_materials |
client_cap |
true makes a time_and_materials budget a client cap, false an estimate. See Estimate or client cap |
rate_card_id |
See Deliverable rate card. null uses the project’s rates |
reprice_resources |
PATCH only. See below |
allow_time_tracking |
Boolean |
status, percentage_complete |
PATCH only |
from_project_template_deliverable_ids |
POST only: up to 50 project template deliverables. Adds one deliverable for each, with its tasks and budget lines, as Add from template does. Only project_phase_id and position may be sent beside it |
POST /api/v1/projects/20488/budget/deliverables
Content-Type: application/json
{"name": "Stage 2 documentation", "budget_type": "fixed_fee"}
A deliverable with tracked time cannot be deleted (422 deliverable_has_tracked_time).
Estimate or client cap
A time and materials deliverable’s amount is either an estimate (a planning figure) or a client cap (a limit agreed with the client). A deliverable row gives client_cap and limit_kind:
limit_kind |
Means |
|---|---|
fixed_fee |
A fixed fee deliverable |
client_cap |
Hourly work with a limit agreed with the client |
estimate |
Hourly work whose amount is a planning figure |
open |
Hourly work with no amount |
Only fixed_fee and client_cap hold resourcing and invoicing to their amount: an estimate earns revenue as time is billed, and is not in the invoicing budget. A fixed fee deliverable refuses client_cap: true with 422 client_cap_needs_hourly. A live project changes it with no variation. Conversion from a proposal carries the proposal’s choice to the project.
Deliverable rate card
A deliverable’s rate card prices its new resource lines before the project’s card. rate_card_id takes a card from selectable_rate_cards of GET /api/v1/projects/:id, and each deliverable there shows its own rate_card, or null. A card change also changes the rates of the deliverable’s bookings.
On a PATCH, reprice_resources: true with a new rate_card_id moves the lines that are at the old card’s rate to the new card’s rate, in the same write. A line with a typed rate, a lump sum line and a task that a variation changes keep their rates. Budget and contract are then worked out again. false, or no reprice_resources, changes the card only. The same card again with reprice_resources: true changes nothing. reprice_resources on a POST is 422 invalid_input.
warnings give the figures:
| Code | When | Fields |
|---|---|---|
resources_repriced |
Lines moved to the new card’s rates | count (lines), subject_ids (task ids). The message gives the budget and contract change, for example Budget +$200.00. Contract +$220.00. |
typed_rates_kept |
Lines with a typed rate kept it | count (lines), subject_ids (task ids) |
tasks_skipped_variation |
Tasks kept their rates because a variation changes them | count (tasks), subject_ids (task ids) |
rates_unchanged |
reprice_resources: true with no card change |
count: 0 |
The deliverable’s variation can refuse the change with 409: rate_card_reprice_locked (reprice_resources: true on a deliverable of an approved or partly approved variation; the card alone saves), rate_card_locked_internal_variation (an internal variation that is a draft or submitted) and rate_card_locked_variation (a rejected variation). A card that the deliverable cannot take answers 404 rate_card_not_found.
Tasks
POST needs deliverable_id.
| Field | Notes |
|---|---|
name |
Default on POST: New Task |
item_type, priority, visible, allow_time_tracking |
As on the web task form |
position |
1-based place in the deliverable, or {"after": id} or {"before": id} |
budget_type |
fixed or dynamic. See Switching a task’s budget type |
quantity, quantity_unit, rate_cents |
A fixed task’s price. quantity_unit is hour, day or per_item |
contract_value_cents |
A fixed task with lines: its contract value |
resource_type_id |
The task’s role |
contingency_percent |
A dynamic task only, 0 to 999.99 |
status, start_date, due_date, note |
As on PATCH /api/v1/projects/:project_id/tasks/:id, with the same rules |
member_ids |
PATCH only. The people assigned to the task |
deliverable_id |
On PATCH, moves the task to another deliverable of the project |
POST /api/v1/projects/20488/budget/tasks
Content-Type: application/json
{"deliverable_id": 3310, "name": "Site survey", "budget_type": "dynamic", "contingency_percent": 10}
The task model refuses to delete a task with tracked time, costs or a variation (422 validation_failed).
Resource lines
POST needs task_id.
| Field | Notes |
|---|---|
resource_type_id |
The role. Leave it out for a lump sum line |
member_id |
A person. The line takes their rate, and the person is assigned to the task |
quantity, quantity_unit |
Hours or days for a role line |
rate_cents |
A typed rate, kept even when it is 0. Without it, a role line takes the rate of the deliverable’s card, else the project’s |
note |
The line’s notes |
position |
1-based place among the task’s lines |
POST /api/v1/projects/20488/budget/resources
Content-Type: application/json
{"task_id": 81231, "resource_type_id": 3, "quantity": 16}
A process-only task has no budget lines (422 task_is_process_only).
Expense lines
POST needs task_id.
| Field | Notes |
|---|---|
name |
Default on POST: New Expense |
cost_type_id |
The cost type. Default: the account’s default cost type |
quantity, quantity_unit |
Default 1, per_item |
billable_rate_cents |
The cost of one unit. Default 0 |
markup_percent |
0 to 999.99. A new line without it takes the project’s default cost markup, else the account’s |
PATCH /api/v1/projects/20488/budget/costs/5512
Content-Type: application/json
{"markup_percent": 15}
Each expense line has a planned cost, which the cost screens show. A change of the line changes that planned cost. Markup on a budget line never reaches a cost record or an invoice.
Results
A POST answers 201 and a PATCH answers 200, with the written rows and the warnings of the write:
{
"rows": [
{
"record_kind": "budget_cost",
"id": 5512,
"task_id": 81231,
"name": "Printing",
"cost_type_id": 12,
"quantity": 1.0,
"quantity_unit": "per_item",
"rate": {"cents": 10000, "currency": "AUD", "formatted": "$100.00"},
"total": {"cents": 10000, "currency": "AUD", "formatted": "$100.00"},
"markup_percent": 15.0,
"markup": {"cents": 1500, "currency": "AUD", "formatted": "$15.00"},
"price": {"cents": 11500, "currency": "AUD", "formatted": "$115.00"}
}
],
"warnings": []
}
record_kind |
Fields |
|---|---|
deliverable |
id, name, status, budget_type, position, project_phase_id, rate_card ({id, name} or null), task_ids, and budget |
task |
id, deliverable_id, name, item_type, status, budget_type, position, quantity, quantity_unit, resource_type_id, and rate, budget and contract_value. A dynamic task also has contingency_percent and contingency |
task_budget_resource |
id, task_id, resource_type_id, member_id, quantity, quantity_unit, note, position, and rate and total |
budget_cost |
id, task_id, name, cost_type_id, quantity, quantity_unit, and rate and total (at cost), markup_percent, markup and price (cost plus markup) |
Money is in a row only when the token’s user can see the project’s budget money. contract_value, contingency and markup also need the contract value right, or a budget only account. The amounts are zero where contingency and markup do not apply.
A POST of template deliverables answers each new deliverable. A DELETE answers 200 with {"record_kind": "task", "id": 81231, "deleted": true}.
Errors
Error bodies follow Requests, errors and limits. The field names the input.
| Status | code |
When |
|---|---|---|
403 |
not_authorized |
The token’s user lacks the role permission for the row or field |
404 |
project_not_found |
Not a kept delivery project the user can read. An opportunity answers this too |
404 |
deliverable_not_found, task_not_found, task_budget_resource_not_found, budget_cost_not_found |
The row, or the parent you named, is not in this project |
404 |
project_phase_not_found, rate_card_not_found, resource_type_not_found, member_not_found, cost_type_not_found, project_template_deliverable_not_found |
A record you named is not one the row can take |
409 |
rate_card_reprice_locked, rate_card_locked_internal_variation, rate_card_locked_variation |
The deliverable’s variation does not allow the card or the new rates |
409 |
row_busy |
Another change to the same row ran at the same time. Try again |
422 |
missing_input, invalid_input |
A required field is missing, a field is unknown or cannot be read, or a percent is outside 0 to 999.99 |
422 |
contingency_dynamic_only (with invalid_input) |
contingency_percent on a fixed task |
422 |
row_in_variation |
The row belongs to a variation that is not approved |
422 |
client_cap_needs_hourly |
client_cap: true on a fixed fee deliverable |
422 |
task_is_process_only |
A process-only task has no budget lines |
422 |
deliverable_has_tracked_time |
A deliverable with tracked time cannot be deleted |
422 |
validation_failed |
The row would not save (errors) |