Record facts
const url = 'http://127.0.0.1:9090/api/attendance/tenants/example/people/example/facts';const options = { method: 'POST', headers: { 'X-Request-Id': '4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f', 'Idempotency-Key': '0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09', Authorization: 'Basic <credentials>', 'Content-Type': 'application/json' }, body: '{"facts":[{"correction":{"by":"lead","change":{"move":{"punch":"9f2d","to":"2026-10-05T22:00:00Z"}},"id":"c1","reason":"left at five","recorded":"2026-10-06T14:00:00Z"}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:9090/api/attendance/tenants/example/people/example/facts \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09' \ --header 'X-Request-Id: 4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f' \ --data '{ "facts": [ { "correction": { "by": "lead", "change": { "move": { "punch": "9f2d", "to": "2026-10-05T22:00:00Z" } }, "id": "c1", "reason": "left at five", "recorded": "2026-10-06T14:00:00Z" } } ] }'Records facts about the person, all of them or none: corrections, labor entries, approvals, closes, accrual
adjustments, schedule overrides, employment changes, exception notes, leave requests, break attestations, or punches made outside a
clock. A punch, and one a correction adds, names the device it was made on (device): a clock’s id, or the id the
system that took it gives itself (mobile, web). Each fact is stamped with when it was stored (stored), which alone orders the person’s facts and tells
which pay period it was recorded in (a change to a closed one is late by it); a recorded the caller gives is
kept as information, and a stored it gives is not kept. A fact recorded again (the same id, the same
content, whenever sent) changes nothing; the same id with other content refuses the whole request (409). An approval of a
subject that is blocked now (exceptions not excused on its days where its rule says blocked_by_exceptions, or a
policy step) is refused (409), naming what blocks it, at whatever stage. The person is marked to
have their ledgers worked out again from the earliest day the new facts change. A post records at most 1000 facts,
each with an id of at most 256 characters (a punch’s device 1 to 256), naming days from 1900-01-01 through 2199-12-31 (an instant’s day in
UTC); an attestation names at most 16 breaks, each numbered 1 to 16, with a reason of at most 1000 characters.
With preview=true, nothing is recorded: the answer is what recording would change in the person’s ledgers,
checked and refused exactly as the write is.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The tenant’s id.
The person’s id.
Query Parameters
Section titled “Query Parameters”True: record nothing, and answer what recording would change (a preview); checked and refused as the write is.
Header Parameters
Section titled “Header Parameters”An id to follow the request by: answered back in X-Request-Id, and in the log, the audit trail and the events the request causes. 1 to 128 letters, digits, -, _, . or :; anything else is replaced by a new id.
Example
4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7fDoes the request once, however often it is sent with this key, for 24 hours: sent again with the same request, it is answered as it was the first time (Idempotent-Replayed: true); with another, 422; while the first runs still, 409.
Example
0b6f1d3e-2c4a-4f8e-9a1b-7d5c3e2f1a09Request Bodyrequired
Section titled “Request Bodyrequired”Facts to record about a person.
object
Each as {"<kind>": {...}}, as GET .../facts shows them.
object
Example
{ "facts": [ { "correction": { "by": "lead", "change": { "move": { "punch": "9f2d", "to": "2026-10-05T22:00:00Z" } }, "id": "c1", "reason": "left at five", "recorded": "2026-10-06T14:00:00Z" } } ]}Responses
Section titled “Responses”What came of each; with preview=true, what recording them would change.
What came of recording each fact.
object
For each fact, in order: new, or already (the same fact was
recorded before; nothing changed).
What the write would do, recording nothing.
object
The facts it would record, in order.
A fact the write would record, and what the write would say of it.
object
New, or already (recorded before: it changes nothing).
Each of the person’s ledgers that would change, by period, then side; none: nothing would.
What one ledger would change by: only what differs is listed.
object
Why: the ledger lines that would be added and taken away, each with what the policy’s steps did to it (an adjustment for a closed period says which).
object
The approvals whose state would change, by subject.
An approval or leave request whose state would change; absent before or after: there is none then.
object
Where an approval or a leave request stands.
object
The stage it waits for, was approved at before a change, or was rejected or disputed at.
Pending, needs_reapproval, rejected, disputed, blocked, refused or approved.
Why, where it is refused (a leave request the policy refused) or an approve step blocked it.
Where an approval or a leave request stands.
object
The stage it waits for, was approved at before a change, or was rejected or disputed at.
Pending, needs_reapproval, rejected, disputed, blocked, refused or approved.
Why, where it is refused (a leave request the policy refused) or an approve step blocked it.
The approval’s subject, or the leave request’s id.
The accrual balances at the period’s end that would change.
An accrual balance at the period’s end, as a duration, before and after.
object
The accrual category.
An exception that would be raised, or go.
object
The workday it is on, and the instant it is about.
Its kind: one the engine finds (missing_out…) or a policy step’s.
Its id, as the ledger and the follow-up list name it.
The exceptions that would be raised, and those that would go.
An exception that would be raised, or go.
object
The workday it is on, and the instant it is about.
Its kind: one the engine finds (missing_out…) or a policy step’s.
Its id, as the ledger and the follow-up list name it.
The pay period’s first and last day.
The decimal hours of each pay category that would change.
The hours of a pay category, before and after.
object
The leave requests whose state would change, by id.
An approval or leave request whose state would change; absent before or after: there is none then.
object
Where an approval or a leave request stands.
object
The stage it waits for, was approved at before a change, or was rejected or disputed at.
Pending, needs_reapproval, rejected, disputed, blocked, refused or approved.
Why, where it is refused (a leave request the policy refused) or an approve step blocked it.
Where an approval or a leave request stands.
object
The stage it waits for, was approved at before a change, or was rejected or disputed at.
Pending, needs_reapproval, rejected, disputed, blocked, refused or approved.
Why, where it is refused (a leave request the policy refused) or an approve step blocked it.
The approval’s subject, or the leave request’s id.
The money of each category and currency that would change; absent where the person has no rates set up.
Money of a currency and pay category, in minor units, before and after.
object
The decimal hours in paid categories, and the time worked.
object
object
Pay or bill.
A value as it is, as it would be, and the difference.
object
Why the person’s ledgers cannot be worked out (no zone set up for them, a policy step failing): the write would still be taken.
Example
{ "recorded": [ "new" ]}A fact is not one, its id is more than 256 characters, a punch (or one a correction adds) names no device or one of more than 256 characters, it names a day before 1900 or after 2199, an attestation is past its bounds, or there are more than 1000.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Examplegenerated
{ "error": "example", "fields": [ { "field": "example", "message": "example" } ], "request_id": "example"}A login is configured and the request carries neither it nor an API token, or it carries a wrong login (WWW-Authenticate: Basic realm="Hour Advantage", no body). Or the request carries an API token that is not one (revoked, or never made), login or not (WWW-Authenticate: Bearer realm="Hour Advantage", error="invalid_token", the body the API token was refused).
Example
the API token was refusedHeaders
Section titled “Headers”The scheme to answer with: Basic realm="Hour Advantage", or for a refused token Bearer realm="Hour Advantage", error="invalid_token".
The Host header does not name a loopback address while one is required (no login configured, or the API listens on loopback), or the Origin header does not match the Host: {"error": ...} says which. Or no login is configured and the request carries Forwarded, X-Forwarded-For or X-Real-IP (a proxy forwarded it): the plain text body says so. Or an API token asks for a route its scope does not reach: the plain text body says so.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "the Host must name this machine (localhost or a loopback address); an API reached by other names needs the admin login"}Example
a forwarded request needs the admin login; none is setA fact’s id is recorded already, with other content; or an approval is of a subject blocked now (open exceptions on its days, or a policy step), named.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Examplegenerated
{ "error": "example", "fields": [ { "field": "example", "message": "example" } ], "request_id": "example"}More than 2 admin logins are being checked at once: send the request again after the Retry-After seconds. A request carrying the login that checked out last, or an API token, is not held up.
Example
too many logins at once; try againHeaders
Section titled “Headers”Seconds to wait: 1.
Something went wrong in the gateway that asking again will not put right by itself; error says what.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Example
{ "error": "db error: ERROR: permission denied for table settings"}The attendance engine does not run here.
A refusal, and why.
object
Why the request was refused, in a sentence.
For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.
What is wrong with one field of a request.
object
The parameter, as the request names it (values.volume for a
setting inside values).
What is wrong with it.
The request’s id, as its X-Request-Id header gives it: what to
quote when asking what happened to it.
Examplegenerated
{ "error": "example", "fields": [ { "field": "example", "message": "example" } ], "request_id": "example"}