Docs
  • Solver
  • Models
    • Field Service Routing
    • Employee Shift Scheduling
  • Platform
Try models
  • Employee Shift Scheduling
  • Getting started: Hello world

Employee Shift Scheduling

    • Introduction
    • Getting started: Hello world
    • User guide
      • Terms
      • Planning AI concepts
      • Constraints
      • Understanding the API
      • Planning window
      • Time zones and Daylight Saving Time (DST)
      • Tags and tag types
      • Validation
      • Metrics and optimization goals
      • Score analysis
    • Employee resource constraints
      • Employee availability
      • Employee contracts
      • Pairing employees
      • Shift travel and locations
      • Work limits
        • Minutes worked per period
        • Minutes worked in a rolling window
        • Minutes logged per period
        • Days worked per period
        • Days worked in a rolling window
        • Consecutive days worked
        • Shifts worked per period
        • Shifts worked in a rolling window
        • Weekend minutes worked per period
        • Weekends worked per period
        • Weekends worked in a rolling window
        • Consecutive weekends worked
      • Time off
        • Days off per period
        • Consecutive days off per period
        • Consecutive days off in a rolling window
        • Consecutive minutes off in a rolling window
        • Shifts to avoid close to day off requests
      • Shift rotations and patterns
        • Shift rotations
        • Single day shift sequence patterns
        • Minimize gaps between shifts
        • Multi-day shift sequence patterns
        • Daily shift pairings
        • Overlapping shifts
        • Shift start times differences
        • Minutes between shifts
      • Shift type diversity
        • Shift types worked per period
        • Unique tags per period
      • Fairness
        • Balance time worked
        • Balance shift count
    • Shift service constraints
      • Alternative shifts
      • Cost management
      • Demand-based scheduling
      • Mandatory and optional shifts
      • Shift assignments
      • Skills and risk factors
    • Recommendations
    • Real-time planning
    • Real-time planning (preview)
    • Changelog
    • Upgrade to the latest version
    • Feature requests

Getting started: Hello world

The Employee Shift Scheduling model assigns shifts to employees with the goals of creating schedules that minimize labor costs, ensure proper shift coverage, and treats employees fairly and with respect.

This guide introduces Timefold’s Employee Shift Scheduling model and walks you through the steps to use Timefold Platform to create an optimized employee shift scheduling solution.

To follow the steps in this guide, you need an active Timefold Platform account.

Request a trial
  1. Navigate to https://app.timefold.ai.

  2. Click Log in.

  3. Click Sign up.

    Either enter the email address and password you want to register with and click continue or select one of the federated log-in options and follow the prompts.

  4. Verify your email address.

  5. Click Request a trial.

A member of our team will contact you to arrange a trial.

The steps in this guide can be completed in under 10 minutes:

  1. Create a problem dataset

  2. Post the dataset

  3. Request the solution

This hello world example uses an example with 1 employee and 1 shift to demonstrate the process of requesting and retrieving a solution from Timefold’s Employee Shift Scheduling model.

At the end of this guide, you will have a solution for the employee shift scheduling hello world problem.

getting started

This hello world uses the POST and GET methods and the API endpoint: https://app.timefold.ai/api/models/employee-scheduling/v1/schedules/

1. Create a problem dataset

A dataset for the Employee Shift Scheduling model must include information about your shifts and your employees' availability.

The following is an example employee shift scheduling input dataset:

{
  "modelInput": {
    "employees": [
      {
        "id": "Beth"
      }
    ],
    "shifts": [
      {
        "id": "Mon Night",
        "start": "2027-02-01T00:00:00Z",
        "end": "2027-02-02T08:00:00Z"
      }
    ]
  }
}
Copy this example dataset into a file called sample.json to use in this hello world example.

The modelInput object of the dataset contains the data to be optimized.

At a minimum, modelInput must include employees and shifts:

1.1. Employees

In this example, there is 1 employee. employees must include an id.

  • id is a unique identifier that identifies the individual employee.

{
  "employees": [
    {
      "id": "Beth"
    }
  ]
}
Learn about additional options that can be included for employees in the Employee resource constraints guides.

1.2. Shifts

In this example, there is 1 shift. shift includes an id, start, and end.

  • id is a unique identifier that identifies the individual shift.

  • start is the start time of the shift in ISO 8601 date and time format.

  • end is the end time of the shift in ISO 8601 date and time format.

{
  "shifts": [
    {
      "id": "Mon Night",
      "start": "2027-02-01T00:00:00Z",
      "end": "2027-02-02T08:00:00Z"
    }
  ]
}
Learn about additional options that can be included for shifts in the Shift service constraints guides.

When the dataset is posted to Timefold, Timefold will attempt to assign employees to shifts, while considering the constraints of the domain.

2. Post the dataset

You have two options to post the dataset.

  1. Post the dataset in the Timefold Platform UI

  2. Post the dataset to the Timefold API

2.1. Post the dataset in the Timefold Platform UI

Typically, you post the dataset to the API. However, for testing purposes, you can upload your sample.json file directly in the Timefold Platform UI:

  1. Log into the Timefold Platform dashboard: https://app.timefold.ai

  2. Select the Employee Shift Scheduling tile.

  3. Click New dataset.

  4. Select Custom and click Next

  5. Upload the sample.json file you saved earlier.

  6. Click Next, then click Run.

2.2. Post the dataset to the Timefold API

You need an API key to access the API.

Learn how to configure an API Key to run the examples in this guide:
  1. Log in to Timefold Platform: app.timefold.ai.

  2. From the Dashboard, click your tenant, and from the drop-down menu select Tenant Settings, then choose API Keys.

  3. Create a new API key or use an existing one. Ensure the list of models for the API key contains the current model.

In the examples, replace <API_KEY> with the API Key you just copied.

POST the dataset contained in the sample.json file for solving to the API endpoint: https://app.timefold.ai/api/models/employee-scheduling/v1/schedules/

curl -X POST -H "Content-type: application/json" -H 'X-API-KEY: <API_KEY> https://app.timefold.ai/api/models/employee-scheduling/v1/schedules [email protected]

The dataset will be validated. If the dataset is valid you will receive a response similar to:

{
  "id": "ID",
  "parentId": null,
  "originId": "ID",
  "name": "Dataset-2025-09-17T06:13:03.424997617Z",
  "submitDateTime": "2025-09-17T06:13:03.424997617Z",
  "startDateTime": null,
  "activeDateTime": null,
  "completeDateTime": null,
  "shutdownDateTime": null,
  "solverStatus": "SOLVING_SCHEDULED",
  "score": null,
  "tags": [
    "system.type:from-request",
    "system.profile:default"
  ],
  "validationResult": null
}

The output includes an ID that has been assigned to the dataset. You’ll use this ID to retrieve the solution for your dataset.

solverStatus confirms the dataset has been scheduled for solving.

3. Request the solution

Append the <ID> from the output you received to the endpoint https://app.timefold.ai/api/models/employee-scheduling/v1/schedules/ and create a GET request to retrieve the solution:

curl -X GET -H 'X-API-KEY: <API_KEY>' https://app.timefold.ai/api/models/XXXX/v1/XXXX/<ID>
{
  "metadata": {
    "id": "ID",
    "parentId": null,
    "originId": "ID",
    "name": "Dataset-2025-09-17T06:13:03.424997617Z",
    "submitDateTime": "2025-09-17T06:13:03.424997617Z",
    "startDateTime": "2025-09-17T06:13:23.044444944Z",
    "activeDateTime": "2025-09-17T06:13:23.102121607Z",
    "completeDateTime": "2025-09-17T06:13:53.903832134Z",
    "shutdownDateTime": "2025-09-17T06:13:54.150644305Z",
    "solverStatus": "SOLVING_COMPLETED",
    "score": "0hard/0medium/0soft",
    "tags": [
      "system.type:from-request",
      "system.profile:default"
    ],
    "validationResult": {
      "summary": "OK"
    }
  },
  "modelOutput": {
    "shifts": [
      {
        "id": "Mon Night",
        "employee": "Beth"
      }
    ]
  },
  "inputMetrics": {
    "employees": 1,
    "shifts": 1,
    "pinnedShifts": 0
  },
  "kpis": {
    "assignedShifts": 1,
    "unassignedShifts": 0,
    "disruptionPercentage": 0,
    "activatedEmployees": 1,
    "assignedMandatoryShifts": 1,
    "assignedOptionalShifts": 0,
    "travelDistance": 0
  },
  "run": {
    "id": "531f5e8b-d705-4404-93f6-d10234445dec",
    "parentId": null,
    "originId": "531f5e8b-d705-4404-93f6-d10234445dec",
    "name": "Dataset-2025-09-17T06:13:03.424997617Z",
    "submitDateTime": "2025-09-17T06:13:03.424997617Z",
    "startDateTime": "2025-09-17T06:13:23.044444944Z",
    "activeDateTime": "2025-09-17T06:13:23.102121607Z",
    "completeDateTime": "2025-09-17T06:13:53.903832134Z",
    "shutdownDateTime": "2025-09-17T06:13:54.150644305Z",
    "solverStatus": "SOLVING_COMPLETED",
    "score": "0hard/0medium/0soft",
    "tags": [
      "system.type:from-request",
      "system.profile:default"
    ],
    "validationResult": {
      "summary": "OK"
    }
  }
}

The output shows the solverStatus is SOLVING_COMPLETED.

modelOutput contains the solution for the dataset.

{
  "modelOutput": {
    "shifts": [
      {
        "id": "Mon Night",
        "employee": "Beth"
      }
    ]
  }
}

In this solution Beth has been assigned to the Mon Night shift.

getting started

Next

  • See the full API spec or try the online API.

  • Learn more about employee shift scheduling from our YouTube playlist.

  • Configure a webhook.

  • Refer to the User guide or learn about Employee resource constraints and Shift service constraints.

  • © 2025 Timefold BV
  • Timefold.ai
  • Documentation
  • Changelog
  • Send feedback
  • Privacy
  • Legal
    • Light mode
    • Dark mode
    • System default