[Canonical page](<https://docs.dhtmlx.com/planning-engine/js/api/project-load-profile/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Project#loadProfile

Reads per-bucket load and capacity of resources on the solved baseline of a [`Project`](<https://docs.dhtmlx.com/planning-engine/js/api/project.md>). Needs a solved project: after [`apply`](<https://docs.dhtmlx.com/planning-engine/js/api/project-apply.md>), call [`solve(null)`](<https://docs.dhtmlx.com/planning-engine/js/api/project-solve.md>) or [`level`](<https://docs.dhtmlx.com/planning-engine/js/api/project-level.md>) first. To get the load of hypothetical dates, use [`preview`](<https://docs.dhtmlx.com/planning-engine/js/api/project-preview.md>) with its `profile` option instead.

## Signature

```ts
loadProfile(options: LoadProfileOptions): LoadProfile
```

Synchronous. Never changes the project.

## Parameters

| Name | Type | Description |
|---|---|---|
| `options` | [`LoadProfileOptions`](<https://docs.dhtmlx.com/planning-engine/js/api/project-load-profile.md#loadprofileoptions>) | Required. Range, resources, bucket size, task lists and an optional baseline check. |

### LoadProfileOptions

What the profile covers, plus an optional expected baseline.

| Field | Type | Default | Description |
|---|---|---|---|
| `from` | [`DateValue`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#datevalue>) | required | Start of the range, inclusive. The profile holds every bucket whose start lies in `[from, to)`. |
| `to` | [`DateValue`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#datevalue>) | required | End of the range, exclusive. Must be later than `from`; the range can hold at most 100 000 buckets per resource. |
| `resources` | [`Id`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#id>)`[]` | every resource | Resources to include, in the order the profile lists them. Each id must name an existing resource. |
| `basis` | `"hour" \| "day"` | derived from [`config.duration_unit`](<https://docs.dhtmlx.com/planning-engine/js/api/types/scheduling-config.md>) | Bucket size. The profile reports the basis it used in `basis`. |
| `tasks` | `"none" \| "overallocated" \| "all"` | `"none"` | Which buckets list their booked task ids in `tasks`: none, only buckets where load exceeds capacity, or all. |
| `baselineId` | `string` | none | Expected baseline token, taken from the latest result's `baselineId`. A mismatch throws `ProjectError("stale-baseline")`. Absent skips the check. |

:::note
Pass the query fields (`from`, `to`, ...) directly in the options object, next to `baselineId`.
:::

## Returns

A [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/js/api/types/load-profile.md>): a fresh object that shares nothing with the project. Bucket `start` dates are strings, or local `Date` objects on a project created with [`dates: "date"`](<https://docs.dhtmlx.com/planning-engine/js/api/project.md#projectoptions>).

## Errors

| Error | When |
|---|---|
| [`ProjectError`](<https://docs.dhtmlx.com/planning-engine/js/api/types/errors.md>) `"no-baseline"` | The project is unsolved, including after `apply` |
| [`ProjectError`](<https://docs.dhtmlx.com/planning-engine/js/api/types/errors.md>) `"stale-baseline"` | `options.baselineId` doesn't name the current baseline |
| [`InputError`](<https://docs.dhtmlx.com/planning-engine/js/api/types/errors.md>) `"validation"` | `to <= from`, or more than 100 000 buckets per resource (path `"to"`); an unknown resource id (path `"resources"`); a `tasks` value other than the three listed |
| [`InputError`](<https://docs.dhtmlx.com/planning-engine/js/api/types/errors.md>) `"parse"` | `options` is missing, lacks `from` or `to`, or has an unknown key |
| `Error("Project has been disposed")` | The project was disposed |

## Example

Print the overloaded days of a resource that works on two tasks at once.

```js
import { Project } from "plen-js";

const project = new Project();
const solved = project.solve({
  config: { use_calendars: false },
  tasks: [
    { id: "a", start_date: "2026-01-01", duration: 2 },
    { id: "b", start_date: "2026-01-02", duration: 2 },
  ],
  resources: [{ id: "dev" }],
  assignments: [
    { task: "a", resource: "dev", value: 1 },
    { task: "b", resource: "dev", value: 1 },
  ],
});

const profile = project.loadProfile({
  from: "2026-01-01",
  to: "2026-01-05",
  tasks: "overallocated",
  baselineId: solved.baselineId,
});

for (const resource of profile.resources) {
  for (const bucket of resource.buckets) {
    if (bucket.load > bucket.capacity) {
      console.log(`${resource.resource} at ${bucket.start}: ${bucket.load} of ${bucket.capacity} (${bucket.tasks.join(", ")})`);
    }
  }
}
// dev at 2026-01-02 00:00: 2 of 1 (a, b)
```

## Related

- [`Project`](<https://docs.dhtmlx.com/planning-engine/js/api/project.md>) - the class and its other methods
- [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/js/api/types/load-profile.md>) - the returned profile
- [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/js/api/types/common.md#profilequery>) - the same query in `preview` options
- [Resource Load](<https://docs.dhtmlx.com/planning-engine/js/resources-and-assignment/resource-load.md>) - querying profiles for histograms
