[Canonical page](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/slot/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Slot

One requirement instance on one task: the resources eligible to fill it and, once filled, the assignment that fills it. [`slots`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-slots.md>) returns a `Slot[]` built from skills and requirements, and [`suggestAssignments`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-suggest-assignments.md>) takes a `Slot[]` in `slots_json`. A slot can also be written by hand, without the skill layer.

## Fields

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) | yes | - | The slot's id, unique among the slots of a call. It's also the id of the assignment that fills the slot. It must not equal the id of any other existing assignment, active or inactive. |
| `task` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) | yes | - | The task the slot belongs to. Must be a scheduled leaf task. |
| `allowed` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>)`[]` | yes | - | Resources eligible for the slot. The order is the tie-break preference: when two resources score the same, the earlier one wins. |
| `value` | `number` \| `null` | no | `1` | Units of the assignment created when the slot is filled. Must be finite and greater than 0. Always present in `slots` output. |
| `assignment` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) \| `null` | no | absent | The active assignment that fills the slot, on the same task. Absent or `null` means the slot is empty. Omitted from `slots` output when the slot is empty. |

Unknown fields are rejected with `parse`; see [Wire format](<https://docs.dhtmlx.com/planning-engine/wasm/wire-format.md#input-unknown-fields>).

The slot's current resource is the resource of its `assignment`. `suggestAssignments` treats a slot as empty (no `assignment`), broken (the resource isn't in `allowed`) or valid (the resource is in `allowed`). What it does with each kind is covered in [Suggesting assignments](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/suggesting-assignments.md>).

Since the slot id becomes the new assignment's id, pass it back as `assignment` on the next run so the slot counts as filled. `slots` binds it automatically.

## Errors

A missing `id`, `task` or `allowed` fails the call with `parse` and no `path` (see [Required fields](<https://docs.dhtmlx.com/planning-engine/wasm/wire-format.md#required-fields>)). `suggestAssignments` also fails with `validation` at these paths, checking slots in input order:

| Path | When |
|---|---|
| `slots[i].id` | Another slot has the same id, or the id is another existing assignment's id (other than the slot's own `assignment`). |
| `slots[i].task` | The task is unknown, unscheduled or a summary. |
| `slots[i].allowed[j]` | No resource has this id. |
| `slots[i].value` | `value` isn't finite or is 0 or less. |
| `slots[i].assignment` | The assignment is unknown, inactive, on another task, or bound by two slots. |

## Used by

- [`slots`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-slots.md>) - response
- [`suggestAssignments`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-suggest-assignments.md>) - `slots_json` request

## Example

An empty slot that either of two developers can fill at 50 %, and a filled slot bound to assignment `be#1`.

```json
[
  { "id": "qa#1", "task": "C", "allowed": ["bob", "eve"], "value": 0.5 },
  { "id": "be#1", "task": "B", "allowed": ["ann", "bob"], "value": 1, "assignment": "be#1" }
]
```

## Related

- [`SuggestOptions`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-suggest-assignments.md#suggestoptions>) - `targets` picks empty, broken or valid slots
- [`AssignmentData`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/assignment-data.md>) - the assignment that fills a slot
- [Suggesting assignments](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/suggesting-assignments.md>) - filling, repairing and rebalancing slots
- [Skills and requirements](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/skills-and-requirements.md>) - building slots from skills
