Skip to content

Deliver punches

POST
/api/attendance/tenants/{tenant}/deliveries
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.

tenant
required
string

The tenant’s id.

x-houradvantage-timestamp
required
string

When it was signed: Unix seconds.

Example
1791403200
x-houradvantage-signature
required
string

v1= and the HMAC-SHA256 of <timestamp>.<body>, hex, keyed with a delivery key.

Example
v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
X-Request-Id
string
<= 128 characters /^[A-Za-z0-9._:-]+$/

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-3a6b8d0c1e7f
Media typeapplication/json
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",
"package": "[email protected]",
"received_at": "2026-10-07T13:00:02Z",
"schema": 3,
"tenant": "dealer-north",
"type": "punch"
}
]
}

Taken: how many of its punches were readable and taken in.

Media typeapplication/json

What a delivery came to.

object
punches
required

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.

integer
Example
{
"punches": 1
}

The body is not a batch of events.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Examplegenerated
{
"error": "example",
"fields": [
{
"field": "example",
"message": "example"
}
],
"request_id": "example"
}

The tenant is suspended: deliver again once it is resumed.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "tenant 'acme' is suspended"
}

Larger than 16 MiB.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
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.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Examplegenerated
{
"error": "example",
"fields": [
{
"field": "example",
"message": "example"
}
],
"request_id": "example"
}