Deliver punches
const url = 'http://127.0.0.1:9090/api/attendance/tenants/example/deliveries';const options = { method: 'POST', headers: { 'x-houradvantage-timestamp': '1791403200', 'x-houradvantage-signature': '<x-houradvantage-signature>', 'X-Request-Id': '4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f', 'Content-Type': 'application/json' }, body: '{"events":[{"data":{"state_name":"check_in","time":"2026-10-07T08:00:00-05:00","user_id":"1001"},"device":"CG1","endpoint":"office","id":"bfd9ac4682c0d0c9b901bb6c4189f75c","package":"[email protected]","received_at":"2026-10-07T13:00:02Z","schema":3,"tenant":"dealer-north","type":"punch"}]}'};
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/deliveries \ --header 'Content-Type: application/json' \ --header 'X-Request-Id: 4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f' \ --header 'x-houradvantage-signature: <x-houradvantage-signature>' \ --header 'x-houradvantage-timestamp: 1791403200' \ --data '{ "events": [ { "data": { "state_name": "check_in", "time": "2026-10-07T08:00:00-05:00", "user_id": "1001" }, "device": "CG1", "endpoint": "office", "id": "bfd9ac4682c0d0c9b901bb6c4189f75c", "package": "[email protected]", "received_at": "2026-10-07T13:00:02Z", "schema": 3, "tenant": "dealer-north", "type": "punch" } ] }'Takes a batch of events exactly as a Connect webhook sink posts it ({"events": [...]}, the event contract), and
records the punches in it as the tenant’s facts; other events are passed over. Every event’s id makes its punch’s:
a batch delivered again records nothing twice.
It takes no login and no API token: only a signature by one of the tenant’s delivery keys, as a webhook sink signs
with its secret. x-houradvantage-timestamp is the Unix time in seconds; x-houradvantage-signature is
v1=<hex>, the HMAC-SHA256, keyed with the delivery key, of the timestamp, a ., and the body as sent (several
v1= signatures may be given, separated by commas or spaces). A timestamp more than 5 minutes from this server’s
clock, either way, is refused. Each refusal says why in error, so a sender’s status shows it. A tenant that does
not exist is answered as a signature by none of its keys is (401), so nothing about which tenants exist is told
before a key is proven; once one is, a suspended tenant is answered 409.
A sender (a client address, as device listeners read it behind trusted_proxies, an IPv6 one by its /64) whose
deliveries, to any tenants, have failed their signature check 10 times lately is answered 429 for its next
delivery, before the body is read, until a failure is forgiven every 10 seconds. A sender behind a proxy
trusted_proxies does not name is its address. At most 8 deliveries have their body read at once before their
signature is checked: a ninth is answered 503 with Retry-After, and is to be sent again.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The tenant’s id.
Header Parameters
Section titled “Header Parameters”When it was signed: Unix seconds.
Example
1791403200v1= and the HMAC-SHA256 of <timestamp>.<body>, hex, keyed with a delivery key.
Example
v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bdAn 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-3a6b8d0c1e7fRequest Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "events": [ { "data": { "state_name": "check_in", "time": "2026-10-07T08:00:00-05:00", "user_id": "1001" }, "device": "CG1", "endpoint": "office", "id": "bfd9ac4682c0d0c9b901bb6c4189f75c", "received_at": "2026-10-07T13:00:02Z", "schema": 3, "tenant": "dealer-north", "type": "punch" } ]}Responses
Section titled “Responses”Taken: how many of its punches were readable and taken in.
What a delivery came to.
object
The readable punches in it, each recorded (or kept as it was, sent before). A punch that cannot be read, kept aside, is not counted.
Example
{ "punches": 1}The body is not a batch of events.
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"}No signature, a stale timestamp, or a signature by none of the tenant’s keys; and for a tenant that does not exist, the same answer as for a wrong key.
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 signature matches none of tenant 'acme''s delivery keys (wrong, or revoked)"}The body stopped arriving (nothing for 10 seconds) or had not all arrived in 60 seconds: deliver again.
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"}The tenant is suspended: deliver again once it is resumed.
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": "tenant 'acme' is suspended"}Larger than 16 MiB.
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"}Too many deliveries from this sender failed their signature check lately: deliver again later.
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"}The attendance engine does not run here, its database cannot be used right now, or too many deliveries are being read at once: deliver again shortly.
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"}