Attendance API
This page lists every Time and Attendance operation, over HTTP and from the command line. It includes a walk-through that takes one person from nothing to a ledger.
Time and Attendance is reached through the admin API, under
/api/attendance. It uses the same login or API tokens and the same audit
trail as the rest of the admin API. You can also
reach it from the command line with hourctl attend. An instance that does not
run the engine (HOURADVANTAGE_ATTEND=on, running
it) answers every route here with 503.
The engine serves every tenant of the
install. /api/attendance/tenants lists, creates, changes, suspends,
resumes and deletes them. It also writes one out or loads one in
(hourctl attend tenants).
Every other route is one tenant’s, under
/api/attendance/tenants/{tenant}/. The table below gives each path from
there. hourctl names the tenant with the global --tenant (-t, or
HOURADVANTAGE_TENANT). Every hourctl attend command needs it, except
tenants and test.
A token scoped attend:<tenant> reaches only
that tenant’s paths. deliveries takes no token at all. It takes only the signature of a
delivery key.
| Reference | |
|---|---|
| Endpoints | Every operation, with its parameters, bodies and answers. |
hourctl attend | Every command, with its options and examples. |
| HTTP | hourctl attend | Does |
|---|---|---|
GET people/{person}/ledger?day=&side= | ledger <PERSON> [--day] [--side] | The person’s ledger of the pay period that day is in, as last worked out. side is pay (the default) or bill. Without day, it is the person’s current workday in their own time zone. The answer is 400, asking for the day, when they have no zone set up. hourctl leaves the day to the server. The answer is 404 until the ledger has been worked out. |
GET people/{person}?day= | person <PERSON> [--day] | The person’s employment on a day. The default is their current workday, in their time zone. It gives: employed, hired, first hired, terminated, on leave since, days employed, details (people). |
GET people/{person}/facts | facts <PERSON> | Everything recorded about the person, as recorded. |
POST people/{person}/facts | record <PERSON> <FACTS> | Records facts, all or none. With ?preview=true, the answer is what recording them would change (previewing a change). |
GET people?under=&on= | people [--under] [--on] | The people with facts, by id, in byte order. That is everyone the tenant knows, or those under an organization on a day (lists of those under an organization). |
GET pay-periods?person=&from=&to=, GET people/{person}/days?from=&to=, GET days?from=&to= | Timecards by date, whatever pay periods the days fall in (reading timecards by date). | |
GET in?under=&on=&location= | Who is in now (below). | |
GET timecards?period=&side=&under=&on= | timecards <PERIOD> [--side] [--under] [--on] | Each person’s timecard of a pay period. It shows hours, approved, closed, where each subject’s approval stands, and the exceptions still to deal with. |
GET people/{person}/record, PUT people/{person}/record | employee show <PERSON>, employee set <PERSON> [--employer] [--worker] | The person’s employee record: their employer (set once) and worker. |
GET workers/{worker} | employee worker <WORKER> | A worker’s records. |
employee place <PERSON> --from [--org H=ORG] [--location] | Records where the person is from a day. It is an employment change (where a person is). | |
GET exceptions | exceptions [--state] [--person] [--exception] [--from] [--to] [--unlinked] [--under] [--on] [--after] [--limit] | Everyone’s exceptions in the tenant, oldest first. By default, those open or acknowledged (follow-up). |
POST people/{person}/exceptions/{id} | note <PERSON> <ID> acknowledge|excuse|reopen [--comment] [--id] | Records a note on an exception, as the caller. |
GET people/{person}/leave | leave list <PERSON> | The person’s leave requests, with where each stands and at which stage. |
POST people/{person}/leave | leave request <PERSON> --category --day DATE=TIME... [--comment] [--replaces] [--id] | Asks for leave, as the caller. |
POST people/{person}/leave/{id}/decision | leave decide <PERSON> <ID> approve|reject|dispute --stage [--comment] | Decides a request at a stage, as the caller. |
DELETE people/{person}/leave/{id} | leave cancel <PERSON> <ID> | Takes a request back, as the caller. |
POST delivery-keys | delivery-keys create [--label] | Issues a delivery key. The answer carries its secret, once. |
GET delivery-keys | delivery-keys list | The tenant’s delivery keys: id, label, who issued it and when, last_used. |
DELETE delivery-keys/{id} | delivery-keys revoke <ID> | Revokes a key. The next delivery with it is refused. |
POST deliveries | Takes {"events": [...]} signed by one of the tenant’s delivery keys, and records the punches in it. Without a valid signature it is refused with 401 (delivering punches). | |
POST shift-costs | What working proposed shifts would add to each person’s pay: hours and a labor-cost estimate. It records nothing (shift cost estimates). | |
POST exports | export run <EXPORTER> <PERIOD> [--only] [--side] [--param K=V] [--employer] [-o FILE] | Writes a pay period’s timecards of an employer’s people out with an exporter, streamed (payroll export). |
GET exports?limit=, GET exports/{id} | export list [--limit], export show <ID> | Past exports, newest first. Or one export, with whose time changed since. |
GET unreadable?after=&limit= | Punches delivered that could not be read (no time, no device or no user), oldest first. Each is shown as it came, with why (a punch that cannot be read). | |
DELETE unreadable/{id} | Forgets an unreadable punch, once the punch it should have been is recorded. | |
GET pending | pending [--unlinked] [--under] [--on] | Who waits to be worked out again, from which instant (since_at) and workday (since_day). For those whose last try failed, it also says why. |
GET employers, POST employers, GET employers/{id}, PATCH employers/{id} | employers list|create|show|update | The tenant’s employers. |
GET hierarchies, POST hierarchies, PATCH hierarchies/{h} | hierarchies list|create|rename | The tenant’s hierarchies. |
GET, POST hierarchies/{h}/organizations; GET, PATCH .../organizations/{id}; POST .../organizations/{id}/move | orgs <H> list|create|show|update|move | A hierarchy’s organizations, and moving one under another parent from a day. |
GET locations, POST locations, GET locations/{id}, PATCH locations/{id} | locations list|create|show|update | The tenant’s work locations. |
GET clocks, POST clocks, PUT clocks, GET clocks/{id}, PATCH clocks/{id}, DELETE clocks/{id} | clocks list|create|show|update|delete | The tenant’s clock records, stamped on the punches that arrive from them. PUT gives a list of whole records, all or none. |
GET clocks/{id}/restamp?from=, POST clocks/{id}/restamp | clocks restamp <ID> --from [--preview] [--reason] | Re-stamps a clock’s punches from a date or time with its record as it is now, by corrections. The GET only says what it would do. |
GET clocks/{id}/shift?from=&to=&by_seconds=, POST clocks/{id}/shift | clocks shift <ID> --from --to --by-seconds|--undo [--request-id] [--preview] [--reason] | Shifts a clock’s punches made in a range by a number of seconds, by corrections. It also takes a shift back. The GET only says what it would do. |
GET unlinked?linked=&under=&on=, GET unlinked/{id}, POST unlinked/{id}/link | unlinked list|show|link|unlink | Unlinked people, and linking one to the person they are. |
GET setup?person= | setup show [--person] | The setup items in force: the tenant’s, and with person that person’s own. |
PUT setup/{kind}/{id}?person= | setup set <KIND> <ID> <VALUE> [--person] | Sets a setup item, as a new revision. |
DELETE setup/{kind}/{id}?person= | setup remove <KIND> <ID> [--person] | Takes a setup item away, as a new revision that holds nothing. |
GET layers, POST layers | layer list, layer add <LAYER> | Lists the policy layers. Adds a revision of one (policy layers). |
GET packages, POST packages, GET packages/{name}, POST packages/{name}/revisions/{r}/activate | pkg list, pkg publish <FOLDER>, pkg show <NAME> | The tenant’s own policy packages: pushed (?activate=true: and published), listed, read, a revision published. |
GET packages/adopted, PUT packages/adopted/{name}, DELETE packages/adopted/{name} | pkg adopted, pkg adopt <NAME@MAJOR>, pkg pin <NAME@VERSION>, pkg drop <NAME> | The packages the tenant adopts, following a major version or pinning one. |
GET sinks, GET sinks/status, POST sinks, GET, PATCH, DELETE sinks/{id}, POST sinks/{id}/position | sinks, sink add|set|remove|position | The tenant’s sinks: webhooks its events are posted to. |
GET events, POST events | events [--after] [--since] [--until] [--follow] [--type] [--source], event post <EVENTS> [--source] | The tenant’s events in Time and Attendance’s log. Also events other systems post into it. |
On the command line, a JSON argument is the JSON itself, @FILE to read
it from a file, or - to read it from stdin. Every command takes
--json to print the API’s answer as it is.
The install’s own routes are:
/api/attendance/packages/shared: shared policy packages. You can list, push, read, publish a revision and download one. On the command line, usehourctl attend pkg list|publish|show --shared./api/attendance/sinks: the install-level sinks, which are sent every tenant’s events. On the command line, usehourctl --install attend sinks.
They take an install token.
Every change marks whom it applies to. Their ledgers are worked out again in the background (recalculation). Nothing is overwritten. Facts are only added. Setup items, layers and packages are kept as revisions (storage).
A person, from nothing to a ledger
Section titled “A person, from nothing to a ledger”The hourctl commands connect as every hourctl command does
(connecting). Over HTTP,
use the admin login or an API token
(-H "Authorization: Bearer hadv_...").
0. A tenant. Everything below is one tenant’s. Create it. Name it
with -t acme on each hourctl attend command that follows.
HOURADVANTAGE_TENANT=acme would do the same. It would also name acme
as the Connect tenant of every other hourctl command in that shell, where
there is none:
hourctl attend tenants create acme --name "Acme Manufacturing"1. A time zone. No one can be worked out without one. Set the
tenant’s. kind is zone. The item is the zone’s name, as JSON:
hourctl -t acme attend setup set zone zone '"America/Chicago"'curl -u admin:password -X PUT http://127.0.0.1:9090/api/attendance/tenants/acme/setup/zone/zone \ -H 'Content-Type: application/json' -d '"America/Chicago"'# {"revision": 1}Any hourctl argument that takes JSON also takes @FILE, to read it from
a file, or -, for standard input. PowerShell strips the double
quotes from JSON given in single quotes. So in PowerShell, give the JSON as a file.
There curl is an alias of another command. Call curl.exe instead. Its -d also reads
@FILE:
Set-Content -Encoding ascii zone.json '"America/Chicago"'hourctl -t acme attend setup set zone zone '@zone.json'curl.exe -u admin:password -X PUT http://127.0.0.1:9090/api/attendance/tenants/acme/setup/zone/zone ` -H 'Content-Type: application/json' -d '@zone.json'2. A policy. Layers are the policy, as JSON. This one, for everyone, pays every two weeks and adds a weekly threshold:
{ "id": "tenant", "revision": 1, "order": 0, "locks": [], "settings": { "pay_periods": { "every_days": 14, "from": "2026-10-05" } }, "steps": [ { "add": { "id": "weekly", "uses": "standard/threshold", "params": { "over": "40h", "to": "overtime", "window": "week" } } } ]}hourctl -t acme attend layer add @layer.jsonOr send POST /api/attendance/tenants/{tenant}/layers with the same body.
A layer for some people only says whom in applies_to (eligibility
rules). A revision
once kept never changes. The same layer again is already. Another layer under
the same id and revision is refused (409). Change the policy with the
next revision.
Or adopt a package of layers instead, such as a cookbook
recipe published for the install. Do this from a
checkout of the examples repository (hourctl attend pkg publish hour-advantage-examples/attendance/weekly_overtime --shared, then
hourctl -t acme attend pkg adopt weekly_overtime@1).
3. Punches. From a clock, they arrive through the time sink. Punches made elsewhere (web, mobile, an import) are facts recorded like any other.
4. The ledger, once it has been worked out:
hourctl -t acme attend ledger 104552 --day 2026-10-09104552 pay ledger, 2026-10-05 to 2026-10-18DAY CATEGORY HOURS CONTEXT2026-10-09 work 4.002026-10-09 overtime 5.002026-10-09 (day) 9.00It prints one line per ledger line with its labor context, each day’s
total, and the exceptions. While the person waits to be worked out again
(something new was recorded, or their setup or policy changed), it says
so first: being worked out again from 2026-10-09: this may change.
GET people/{person}/ledger?day=2026-10-09 answers the whole ledger as
JSON. It has these fields:
pending: set while the person waits to be worked out again.recalculated: why it was last worked out, and which stages were redone from where (what gets redone).approvals: where each approval stood when the ledger was worked out. Each hasapprover(who the stage it waits for goes to) andwhy(what blocked it, or why it was routed). These appear where the policy’sapprovestep said.
5. A correction. A supervisor moves an out punch:
[ { "correction": { "id": "c1", "recorded": "2026-10-10T14:00:00Z", "by": "lead", "reason": "left at five", "change": { "move": { "punch": "9f2d", "to": "2026-10-09T22:00:00Z" } } } }]hourctl -t acme attend record 104552 @fix.jsonhourctl -t acme attend pendingOr send POST /api/attendance/tenants/{tenant}/people/104552/facts with
{"facts": [...]}. pending then lists the person, from the day the
correction affects, until their ledgers are worked out again.
Each fact is an object with one key, its kind:
| Kind | Required | May be left out |
|---|---|---|
punch (punches) | id, at, kind, device (the device it was made on) | recorded (the same as at), values (none: no job or work code) |
correction | id, recorded, by, reason, change: one of add (a punch, with a punch’s required fields), move (punch, to), void (punch), retype (punch, kind), set_values (punch, values) | |
labor (a labor entry) | id, workday, measure, quantity, category, by, recorded | values (none), segment, replaces, void (not a void) |
approval (a decision) | subject, stage, decision, by, recorded, fingerprint | comment (none) |
close (a period closed or reopened) | period, recorded, by | reopen (not set: the period is closed; true reopens it) |
accrual_adjustment (an accrual changed by hand) | id, category, workday, amount, recorded, by, reason | |
schedule_override (one date of a schedule changed) | id, date, kind (off, leave, holiday, or replace or extra with a start and an end), recorded, by, reason | values of a replace or an extra (none) |
employment (a change of employment) | id, effective (a day), kind (hired, terminated, leave_started, leave_ended, changed), recorded | attributes (null removes one), organizations (by hierarchy, null for none), location (where a person is), by, reason, replaces or void as for labor entries |
attestation (a person’s answer at clock-out about their meal and rest breaks: break attestations) | id, workday, recorded | breaks (none: every break was taken) |
exception_note (a note on an exception, below) | id, exception, at, action, by, recorded | comment |
leave_request (a leave request, or the cancelling of one) | id, category, days, by, recorded | comment, replaces, cancel, values |
A fact without a field it requires is refused (400) naming the field. The
fields the server sets (stored, via) are not sent.
Times are RFC 3339 instants (2026-10-05T13:00:00Z). Days are
YYYY-MM-DD. hourctl attend record takes a list of facts,
{"facts": [...]}, or a single fact. A request records all its facts or
none.
A fact recorded again (the same id, the same content) is already
and changes nothing. So a request can be sent twice safely. The same id
with other content refuses the whole request (409).
Every fact has two times.
recordedis what its sender says. For a clock’s punch, it is when Connect received it. For a fact through the API, it is the time the caller gave. It is shown as given.storedis when Time and Attendance stored it. The server stamps it, whatever the sender says. Astoredsent with a fact is not kept.
stored alone orders a person’s facts. The decision, correction or note stored last is the one that stands.
It also tells which pay period a change was recorded in. So no caller can
date a fact into a closed period (closed
periods).
GET people/{person}/facts shows both.
An approval of a subject that is blocked is refused, at any stage,
with 409 naming what blocks it (day:2026-10-05 of 104552 is blocked by missing_in 3f9a... at 2026-10-05T17:05:00Z: put it right or excuse it first). A subject is blocked when its rule says
blocked_by_exceptions and an exception that is not excused is on one of
its days. It is also blocked when a policy approve step blocks it.
A rejection or a dispute is accepted.
Exceptions and follow-up
Section titled “Exceptions and follow-up”GET exceptions lists exceptions across everyone’s ledgers as last
worked out, ordered by time, then person. It takes these parameters:
state: comma separatedopen,acknowledged,excused. The default isopen,acknowledged.person.exception: its kind.fromandto: RFC 3339.unlinked:truegives only unlinked people’s.falsegives everyone else’s.underandon: those under an organization on a day.limit: 100 unless given, at most 1000.
The answer is
{"exceptions": [...], "next": ...}. While there may be more, next is
set. Pass it back as after.
Each exception has person, period (the
first day of its pay period), id, exception, at, about,
detail and state. Once someone has noted it, it also has noted_by,
noted_at and comment. In a ledger, an exception that has been noted
has a follow_up with state, by, at and comment.
POST people/{person}/exceptions/{id} with
{"action": "excuse", "comment": "agreed with the supervisor"} records a
note, as whoever is calling (following up).
Give it an id to make it safe to send twice. The same id with the same
action and comment is already. With anything different, it is refused
(409). An exception no kept timecard has is 404.
Notes are facts too. A note is {"exception_note": {...}} in a person’s facts,
with the exception’s id and at, the action, by, recorded and
comment.
POST people/{person}/leave takes
{"category": "vacation", "days": {"2026-10-12": "8h", "2026-10-13": "4h"}},
with an optional comment, replaces (the request it changes) and id
(the same id sent again with the same content is already). It is
recorded as the caller. It answers {"id": ..., "recorded": "new"}
(or "already"). A request with no days, or a time that is not a
duration, is refused (400).
A decision is
{"stage": "supervisor", "decision": "approve", "comment": "..."} to
.../leave/{id}/decision, on the request as it stands. DELETE .../leave/{id} cancels. It records a new request that cancels it, and
answers with that one’s id. Both are 404 when the person has no
standing request with that id.
GET people/{person}/leave lists the person’s requests as they stand.
Those replaced or cancelled are left out. Each request has:
id,category,by,recorded,commentandreplaces.days: each day’s time,{"2026-10-12": "8h"}.state:pending,approved,rejected, orrefusedby the policy’s leave check.stage: the stage it waits for, or was rejected at.approver: where the policy routed that stage.subjectandfingerprint: what a decision names, a hash of the category and days.
Requests are facts too: {"leave_request": {...}} with id,
category, days (each date and time), by, recorded,
comment, and replaces or cancel. Their approval subject is
leave:<id>:<first day>. Ordinary approval facts decide it, under an
approval rule whose subject is leave. With no such rule, a request
waits for one decision at the stage approval
(POST people/{person}/leave/{id}/decision with
{"stage": "approval", "decision": "approve"}).
Ledgers list the requests with a day in their
period under leave, each with where it stands. Approved leave
appears as lines with from {"leave": {"id": ...}}. A person’s
ledgers are worked out through the last day of their leave. So future
periods with leave in them exist too. The events leave.requested,
leave.decided and leave.cancelled are sent from the ledger of the
period the request’s first day is in (events).
Reading timecards by date
Section titled “Reading timecards by date”Timecard and calendar screens read days by date, whatever pay periods
they fall in. Each read is of from through to (YYYY-MM-DD, both
days read), at most 366 days. A longer range, or from after to, is refused
(400). side is pay (the default) or a bill side.
| Read | What it answers |
|---|---|
GET pay-periods?person=&from=&to= | The person’s pay periods holding a day of the range, the earliest first. |
GET people/{person}/days?from=&to= | The person’s days, their totals, and a summary of each pay period the days touch. |
GET days?from=&to= | The same for a page of people, by person. It takes after, limit (100 at most), under and on as the other lists take them. Without on, it uses to. detail=totals leaves the days out. |
A person’s pay periods are their own. A layer may give some people other periods than others. Each period says where it stands for them:
kept: a ledger of it is kept.closed: when.approved.pending: they wait to be worked out again from a day of it or before, so what is kept of it is about to change.
Each day has:
- The pay period it is in, and its zone.
- Its schedule:
shifts,off,holidays, and theleaveasked for with where each request stands. - Its
lines. - Its counts and money (
quantities). - The
puncheswhose workday it is. Each is as taken after its corrections, withoriginalwhere a correction changed it. - Its
exceptions, and itstotals.
A line has:
- Its pay category, labor
context,timeand decimalhours. - Its
startandend, when its time has a time of day. from: where its time came from. That is the punch that started the work, a labor entry, a leave request, or a business rule.stamps: what each rule did to it.
Totals are sums of lines. hours and each category’s hours add up the
lines’ decimal hours. worked adds up the time in categories that count as
worked. quantities adds up each measure’s counts or money by category (money
in minor units). The read’s totals are its days’. Each period’s
in_range is its days’ within the read, and its totals the whole period’s.
A day of a period with no kept ledger (ahead, or not worked out yet) has
kept false. Its schedule and leave are worked out on read, and it has no
lines. A ledger kept for pay periods the policy does not have (after a
change of pay periods, until the person is worked out again) is not read.
curl -u ann 'https://hours.example.com/api/attendance/tenants/acme/people/104552/days?from=2026-10-05&to=2026-10-11'{ "side": "pay", "from": "2026-10-05", "to": "2026-10-11", "person": "104552", "days": [ { "date": "2026-10-05", "zone": "America/Chicago", "period": { "first": "2026-10-05", "last": "2026-10-18" }, "kept": true, "shifts": [{ "id": "days@2026-10-05", "start": "2026-10-05T13:00:00Z", "end": "2026-10-05T21:00:00Z", "values": {} }], "holidays": [], "leave": [], "lines": [{ "category": "work", "start": "2026-10-05T13:00:00Z", "end": "2026-10-05T21:00:00Z", "time": "8h", "hours": "8.00", "context": {}, "from": { "segment": { "kind": "work", "punch": "p-1182" } }, "stamps": [] }], "quantities": [], "punches": ["..."], "exceptions": [], "totals": { "hours": "8.00", "worked": "8h", "categories": [{ "category": "work", "hours": "8.00", "time": "8h" }], "quantities": [] } }, "..." ], "totals": { "hours": "40.00", "worked": "40h", "categories": ["..."], "quantities": [] }, "periods": [ { "first": "2026-10-05", "last": "2026-10-18", "kept": true, "closed": null, "approved": false, "pending": false, "totals": { "hours": "48.00", "...": "..." }, "in_range": { "hours": "40.00", "...": "..." } } ] }A person who cannot be read (no time zone set up for them) is refused
(400) on their own reads. On a page of people, error says why. The
others are still read. A tenant’s token (attend:<tenant>) reads its own
tenant’s people only.
Previewing a change
Section titled “Previewing a change”The five writes about one person take ?preview=true. The request is
checked as the write is. Instead of being recorded, it is answered
with what recording it would change in the person’s timecards and
balances. An employee sees whether the policy would refuse a leave
request. A manager sees the balance approving it leaves. Payroll sees
what a late correction does to the open period.
| Write | Route |
|---|---|
| Record facts | POST people/{person}/facts |
| Note an exception | POST people/{person}/exceptions/{id} |
| Ask for leave | POST people/{person}/leave |
| Decide on leave | POST people/{person}/leave/{id}/decision |
| Take leave back | DELETE people/{person}/leave/{id} |
A preview takes the same body and needs the same access as its write. A refused preview gets the same status and error the write would. Those are:
- 400 for a fact out of bounds.
- 404 for leave there is none of.
- 409 for a fact kept with other content, an approval that is blocked, or a suspended tenant.
So a client handles refusals one way.
What a policy decides is not a
refusal of the request. A leave request the policy refuses, or a late
change it refuses (close.late_changes = "refuse"), is answered 200. It
shows as it would once recorded.
A fact recorded before with the same content is already and changes
nothing. A correction in the same request can name a punch proposed in
it. A change to a closed period is late exactly as the write would make
it. The preview shows the closed period as it was and the adjustment
lines in the open period, or the late_change_refused exception there.
An id the write would make for you (a leave request or note sent without one) is made again by the write itself. Send an id to have the write use the one the preview showed.
The person’s timecards are worked out two ways: as they are, and with the proposed facts. This runs from the earliest workday the facts change through today, and on through anything dated ahead. Each ledger that would differ is listed:
| Field | What it says |
|---|---|
side, first, last | Which ledger: pay or bill, and its period. |
hours, total_hours, worked | hours is the decimal hours of each pay category that would change. total_hours is the hours in all. worked is the time worked. Each has before, after, change. |
money | The money of each category and currency that would change, in minor units. Absent where the person has no rates. |
balances | The time-off balances at the period’s end that would change. |
exceptions_raised, exceptions_cleared | The exceptions that would appear and go: id, kind, workday, instant. |
approvals | The approval subjects whose state would change, before and after. |
leave | The leave requests whose state would change, before and after. Absent on one side: none then. |
added, removed | Why: the ledger lines added and taken away, each with what the policy’s rules did to it. |
facts lists what the write would say of each fact (new or
already). Where the person’s timecards cannot be worked out (no time
zone set up, a rule failing), not_worked_out says why and ledgers is
empty. The write would still be accepted. A preview that takes longer than
10 seconds is refused (400). It records nothing and is not in the audit
trail.
curl -u ann -X POST 'https://hours.example.com/api/attendance/tenants/acme/people/104552/leave/v1/decision?preview=true' \ -H 'content-type: application/json' -d '{ "stage": "approval", "decision": "approve" }'{ "person": "104552", "facts": [{ "kind": "approval", "id": "9c2f...", "recorded": "new" }], "ledgers": [{ "side": "pay", "first": "2026-10-05", "last": "2026-10-11", "hours": [{ "category": "vacation", "before": "0.00", "after": "8.00", "change": "8.00" }], "total_hours": { "before": "40.00", "after": "48.00", "change": "8.00" }, "worked": { "before": "40h", "after": "40h", "change": "0s" }, "balances": [{ "category": "vacation", "before": "20h", "after": "12h", "change": "-8h" }], "exceptions_raised": [], "exceptions_cleared": [], "approvals": [], "leave": [{ "id": "v1", "before": { "state": "pending", "stage": "approval" }, "after": { "state": "approved" } }], "added": [{ "workday": "2026-10-07", "category": "vacation", "...": "..." }], "removed": [] }] }Who is in now
Section titled “Who is in now”GET in lists the people at work, on a lunch or on a break, as their
timecards were last worked out:
{ "as_of": "2026-10-07T17:00:00Z", "in": [{ "person": "104552", "kind": "lunch", "since": "2026-10-07T16:31:00Z", "punch": "p-88213", "device": "CG1", "values": { "job": "picking" }, "until": "2026-10-08T05:02:00Z", "period": "2026-10-05", "pending": false }], "next": null }kind:work(an in, a lunch or break end, a transfer, a punch of unknown direction),lunchorbreak(their start).since,punch,device: that punch’s instant, id and device.values: the labor context of the work.period: the pay period the stretch started in.pending: something was recorded for them that is not worked out yet, so this may be about to change.
Corrections, voided punches and punches of unknown direction are already taken into account. A person is in when their last punch leaves a stretch without an end.
Nothing in the punches tells work still going on from an
out never punched. So a stretch counts as in until a shift started at its
first punch (through any lunch or break) reaches the longest a shift may
be. That is the longest of the policy’s longest_shift
step in force on its workday, or 16h where the policy lists none
(until). From then it is not listed. The list is as of as_of, the
moment it was read.
under=<hierarchy>:<org> lists those in that organization or one under
it. location=<id> lists those at that work location. Both are on the day
on=YYYY-MM-DD (today, UTC, without it). limit (100 unless given, at
most 1000) and after (the previous page’s next) page it.
Exports
Section titled “Exports”POST exports takes {"exporter": "standard/csv", "period": "2026-10-05", "only": "closed", "side": "pay", "employer": "acme-ca", "params": {"id_attribute": "payroll_id"}}.
onlyisall,closedorapproved. The default isall.sidedefaults topay.employeris one of the tenant’s employers, or*for all of them. It may be left out only where the tenant has one.
It answers with the file itself, streamed, in the exporter’s
content type with a Content-Disposition file name. The X-Export-Id
header names the export.
It is refused with 409 while anyone in the
period waits to be worked out again (the first 20 named, failed ones
included). It is refused with 400 for an exporter there is none of, or an only that is
none of the three.
The file is not kept. An exporter that fails partway
ends the export failed and cuts the download short. So does a download
the caller stops before the file is written.
GET exports lists exports newest first. Each has id, exporter, side,
period, only, by, created, state (running, done or
failed), error, people and finished. limit is 100 unless given,
at most 1000. GET exports/{id} adds changed: the people whose ledger
of the period is no longer the one the export wrote (changed since, or
gone).
kind is one of dimension, assignment, implication, shift,
shift_definition, holiday, category, measure, rate,
approval_rule, accrual_category, defaults or zone. The item
is its JSON (what each is). Without
--person (?person=) an item is the tenant’s. With it, the item is the person’s
own, over the tenant’s.
# This person works in New York's time from October 8.hourctl attend setup set zone zone '{"zone": "America/New_York", "from": "2026-10-08"}' --person 104552hourctl attend setup show --person 104552Each item is an object of the fields its kind lists. The scenario file
([[dimension]] and the others in scenarios)
leaves out the same fields to the same effect.
| Kind | Required | May be left out |
|---|---|---|
dimension | id | required (false: work without a value is not flagged), allowed (any value) |
assignment | id | from, to (open), defaults (none), allowed (any value), organizations (none) |
implication | when (["work_code", "7"]: a dimension and a value), then (the values it means) | from, to (open) |
shift | id, start, end (instants) | values (none) |
shift_definition | id, start, end (times of day; at or before start: the next day), repeats ({"weekly": ["monday"]}, {"every": {"days": 4, "from": "2026-10-01"}} or {"dates": ["2026-10-05"]}) | from, to (open), values (none) |
holiday | id, rule ({"fixed": {"month": 12, "day": 25}}, {"nth": {"month": 11, "weekday": "thursday", "n": 4}} with n -1 for the last, or {"date": "2026-12-24"}) | name (the id), observed (as_is: on the day itself. nearest_weekday moves a weekend day to the Friday or Monday) |
category (a pay category) | id | worked (true), paid (true), code (none) |
measure | id, kind ("duration", "count" or {"money": {"currency": "USD"}}) | decimals of money (2) |
rate | kind, amount (minor units), currency | matches (none: any work), from, to (open) |
approval_rule | subject (day, period, entry, leave, assignment or {"category": "overtime"}), stages (each with a name) | side (pay), blocked_by_exceptions (false). A stage’s approver (its name) and organization (none) |
accrual_category | id | uses (none) |
defaults | the values, an object | |
zone | a zone name, or {"zone": "America/New_York", "from": "2026-10-08"} |
An item without a field it requires is refused (400) naming the field. An item that is not one of its kind is refused (400). Which layers of the policy apply to a person is not setup. Each layer’s eligibility rule says (policy layers).
Policy packages
Section titled “Policy packages”A tenant’s own policy package
is a folder (package.toml, main.lua where it has steps of its own,
scenarios/; writing policy steps).
hourctl attend pkg publish <FOLDER> pushes it and publishes it.
Its scenarios run on the server first. One whose scenarios fail
is kept as a failed revision and refused (400). A version published never
changes. Steps name it as <name>/<step>.
hourctl -t acme attend pkg publish my-policies/overtime --effective 2026-11-02hourctl -t acme attend pkg show overtimehourctl -t acme attend pkg adopt overtime@1pkg list (GET packages) lists the tenant’s own. --shared lists the
install’s. The official standard package is built in and not listed.