Skip to content

Shift cost estimates

A scheduling system can ask Time and Attendance what proposed shifts would add to each person’s pay. It asks before anyone works them. It might do this to choose who to put on a shift, or to price a draft schedule.

The answer is a labor-cost estimate. It gives the hours in each pay category and the money. They are worked out with the person’s real history and your business rules. Payroll pays. The estimate is an input to decisions.

An estimate records nothing. It creates no fact, ledger or event. It leaves no entry in the audit trail.

POST /api/attendance/tenants/{tenant}/shift-costs takes the people and the shifts:

  • People: 1 to 100.
  • Shifts: 1 to 31. Each is at most 24 hours. Each has a start, a finish and the labor context values it is worked with, such as an assignment or a cost center.

Every person is estimated as working every shift. Send one shift and many people to compare the people. Send one person and a week of shifts to price their draft week.

Terminal window
curl -u ann -X POST https://hours.example.com/api/attendance/tenants/acme/shift-costs \
-H 'content-type: application/json' \
-d '{ "people": ["104552", "104553"],
"shifts": [{ "start": "2026-10-10T12:00:00Z", "finish": "2026-10-10T22:00:00Z",
"values": { "assignment": "A12" } }] }'

A token scoped to a tenant (attend:<tenant>) estimates that tenant’s people only.

For each person, the pay ledgers are worked out twice. Both times use their real facts and the setup and policy in force on each day. The first time is as things stand. The second is with the shifts worked as proposed. The answer is the difference.

So what a shift costs depends on what the person has already worked that week. For example, the same ten hours cost more for someone already at 35.

FieldWhat it says
hours, paid_hoursThe decimal hours each pay category changes by. Only categories that change are listed. paid_hours is the hours in paid categories in all.
workedThe time worked the shifts add.
money, total_moneyThe money each category and currency changes by, in minor units. It is an earnings rule’s pay and premiums paid as money. It is left out where the person has no rates. Then only time is given.
added, removedWhy. These are the ledger lines the shifts add and the lines they take away. Each comes with what your rules did to it. Time that was in one category and moves to another is one line removed and one added. An example is the overtime a shift tips a week into.
added_quantities, removed_quantitiesThe counts and money lines added and taken away.
exceptionsThe exceptions the shifts would raise, such as a short rest or a long day.
refusedThe leave requests your rules would refuse with these shifts, and why.
errorWhy a person cannot be estimated, such as no time zone set up for them. The others are still answered.
{ "estimates": [
{ "person": "104552",
"hours": { "work": "8.00", "overtime": "2.00" }, "paid_hours": "10.00", "worked": "10h",
"money": [{ "category": "overtime", "currency": "USD", "amount": 6000 },
{ "category": "work", "currency": "USD", "amount": 16000 }],
"total_money": [{ "currency": "USD", "amount": 22000 }],
"added": [{ "workday": "2026-10-10", "category": "overtime", "...": "...",
"stamps": [{ "step": "daily", "did": "moved 2h from work to overtime: over 8h in the day" }] }],
"removed": [], "added_quantities": [], "removed_quantities": [],
"exceptions": [], "refused": [] },
{ "person": "104553", "error": "104553 of acme: no time zone set up" }
] }
  • A shift in a pay period that is closed for any of the people (409). The cost of work in a closed period is a late change to it, not an estimate.
  • More than 100 people or 31 shifts (400).
  • A shift that does not finish after it starts, or lasts longer than 24 hours (400).
  • An ask that takes longer than 10 seconds to work out (400).