Resource Load#
This guide shows how to measure how busy each resource is over a date range. You get the data a resource histogram needs. It covers the profile query, how capacity follows resource calendars, which tasks fill each bucket, and how to get the load for dates you haven't committed yet.
How a load profile works#
loadProfile reads the solved baseline of a JsonProject and cuts the date range into buckets of one hour or one day. For every resource it reports each bucket's load and capacity. The call is read-only: it never schedules and never changes the project.
The request and the response fit together like this:
- The request is a
LoadProfileOptionsobject. It says what to measure: the rangefrom..to(both required), whichresources, the bucket size (basis) and whether to listtasks. It also takes an optionalbaselineId. Every field exceptfromandtocan be left out: you then get every resource, the default basis and no task lists. - The response is a
LoadProfilein the envelope'sresult: thebasisit used, and one entry per resource with the resource id, itscapacityModeand abucketsarray. Each bucket is{ start, load, capacity }, plustaskswhen you ask for them.
A few rules decide what ends up in the buckets:
- Range. A bucket is included when its start lies in
[from, to). A day bucket starts at midnight, so afromof Monday 12:00 skips Monday and starts on Tuesday.tois exclusive. - Dense output. Every bucket in the range appears, including empty ones with load 0. That's why the range is capped at 100 000 buckets per resource, about 11 years at hour basis.
- Basis. By default the basis follows
config.duration_unit:"day"for days,"hour"for hours and minutes. Setbasisto override it. - Load units. Load is in assignment
valueunits, where 1 is 100 %. Nothing is converted to hours. An assignment that works in a bucket books itsvaluethere, so two full-time tasks on the same day give a load of 2. - Same load as leveling. The profile counts load the same way as leveling and the
overallocationsinScheduleResultdo: only real work segments, each assignment on its own calendar, cut to its slice. A bucket overallocates whenload > capacity. - Order. Resources come back in input order, and so do the task ids in a bucket.
The profile always describes the accepted baseline, so the project must be solved and have no unsolved edits. Failures come back as an error envelope:
| Failure | Error envelope |
|---|---|
Project never solved, or edited with apply since the last solve |
kind: "project", code: "no-baseline" |
baselineId doesn't name the current baseline |
kind: "project", code: "stale-baseline" |
to <= from, or more than 100 000 buckets per resource |
kind: "validation", path: "to" |
Unknown id in resources |
kind: "validation", path: "resources" |
tasks isn't "none", "overallocated" or "all" |
kind: "validation", path: null |
| Unknown field in the options | kind: "parse" |
See Error handling for the envelope and the LoadProfile reference for every field.
Querying a profile#
Solve the project, then pass the range to loadProfile as JSON. Save this as profile.cjs:
const = ;
// 2026-08-10 is a Monday.
const = ;
const = new;
Output of node profile.cjs:
basis: day
dev 2026-08-09 00:00: load 0 of 1
dev 2026-08-10 00:00: load 2 of 1
dev 2026-08-11 00:00: load 1.5 of 1
dev 2026-08-12 00:00: load 1 of 1
dev 2026-08-13 00:00: load 0 of 1
The project uses day units, so the basis is "day" and you get five buckets, Sunday to Thursday. Monday has a and b (2), Tuesday has a plus c at half time (1.5), and Wednesday has d (1). Capacity is 1 in every bucket: dev has no capacity of its own, so it takes config.default_resource_capacity.
For a single day, the result in the envelope looks like this:
Narrowing the query#
Set resources to measure only some resources, and basis to change the bucket size:
const = ;
const = ;
const = new;
Output:
dev: 0 2 2
Only dev comes back, with three hour buckets. 07:00 is before work starts (0), and 08:00 and 09:00 carry both tasks (2 each). An id in resources that isn't in the project fails the call:
Pinning the profile to a baseline#
A UI often fetches the profile some time after the solve. To make sure the profile matches the dates on screen, pass the baselineId from the solve result in the options. If the project was solved again in the meantime, the call returns a stale-baseline error instead of load for other dates.
const = ;
const = ;
const = new;
baselineId sits next to from and to in the same object. After another solve, even with the same data, the same options give:
Take the token from the latest solve result. Tokens are opaque, so don't store them or compare them across runs.
Capacity modes#
Capacity is the resource's capacity (default config.default_resource_capacity, 1). The capacityMode of each resource entry tells you how that capacity is spread over the buckets:
"calendar": the resource has its owncalendar_id,config.calendar_modeis"resource"(the default) andconfig.use_calendarsis on. Buckets with working time on that calendar get the full capacity. All others get 0."flat": every bucket gets the full capacity, weekends and nights included. This applies when the resource has no calendar, whencalendar_modeis"task"or"task-inherited", or whenuse_calendarsisfalse.
In calendar mode an assignment always works on the resource's calendar, or on the overlap of the task's and the resource's calendars. So a bucket with capacity 0 never gets load, and a bucket overallocates in the profile exactly when leveling sees it as overallocated.
const = ;
const = ;
const = new;
Output:
office (flat): capacity 1 1 1 1 1 1 1 | load 0 0 0 0 0 0 0
shop (calendar): capacity 0 0 1 1 1 1 1 | load 0 0 1 1 0 0 0
part-time (calendar): capacity 0 1 1 1 1 1 0 | load 0 0 0 0 0 0 0
part-time hourly capacity: 0 0 1 1 1 1 0 0 0 0 0 0
What the week shows:
officehas no calendar, so it's"flat"with capacity 1 on all seven days, Sunday and Saturday included.shopis"calendar". Its capacity is 0 on Sunday and Monday and 1 from Tuesday to Saturday. Taskaruns Tuesday and Wednesday, so those two buckets have load 1.- At hour basis,
part-timehas capacity only in the four hour buckets between 08:00 and 12:00. The other eight hours are 0.
Add config: { calendar_mode: "task" } to the data (or use_calendars: false) and all three resources become "flat", with capacity 1 in every bucket. See Working time and calendars for calendar setup and SchedulingConfig for the config fields.
Task lists per bucket#
A histogram usually needs to say who is overloading a resource. Set tasks in the options to fill each bucket's tasks array:
tasks |
Bucket tasks |
|---|---|
"none" (default; null reads the same) |
absent from every bucket |
"overallocated" |
ids in buckets where load > capacity, [] elsewhere |
"all" |
ids of every task booked in the bucket |
const = ;
const = ;
const = new;
Output:
2026-08-10 00:00: load 2, tasks ["a","b"]
2026-08-11 00:00: load 1.5, tasks ["a","c"]
2026-08-12 00:00: load 1, tasks []
2026-08-13 00:00: load 0, tasks []
With "overallocated", Monday lists a and b, and Tuesday lists a and c. Wednesday and Thursday aren't overloaded, so they get empty arrays. Switch to "all" and Wednesday lists d too, because "all" reports every booked task regardless of capacity.
If you need only the overloaded periods, not the full histogram, skip the profile. Every ScheduleResult of a project with assignments carries overallocations: per-resource windows with peak, overload and the contending tasks (see Overallocation). Leveling resources shows how to remove the overload.
Load of hypothetical dates#
loadProfile only reads the baseline. To see the load an edit would cause, add a profile query to the options of preview. The result's profile is computed on the previewed dates, and the project stays as it was.
const = ;
const = ;
const = new;
Output:
previewed dev: 1 1.5
previewed qa: 1 0
baseline dev: 2 1.5
In the preview, dev drops to 1 on Monday and keeps 1.5 on Tuesday, and qa gets 1 on Monday. The baseline profile still shows 2 and 1.5 for dev. Without a profile query, the preview result has no profile field.
The profile query takes the same fields as the loadProfile options except baselineId. A baselineId inside profile is an unknown field and fails the preview with a parse error. Put it at the top level of the preview options instead, as the example does. An invalid query, such as an unknown resource, fails the whole preview with a validation error.
To profile a multi-step edit or a leveling run, clone() the project, edit or level the clone, and call loadProfile on it. Cloning is cheap and the original stays as it was. Free the clone when you're done. See Previewing changes for both approaches.