API reference / Rules

get/v1/rules/export

The whole rule set, for a partner to hold locally

Operation
exportRules
Authentication
API key

A partner with volume does not want a round trip per passenger. This is the state; the `rule.changed`, `rule.added` and `rule.retired` webhooks are the delta.

**`sha256` is what joins them.** It is computed over `JSON.stringify(rules)` exactly as returned, and it is the same value `rule_snapshots.hash` holds, so it appears in every `rule.*` payload. One string answers both *"is my cached copy current?"* (compare against the webhook) and *"is my stored file intact?"* (recompute over the file).

The keys are camel-case here rather than snake-case as elsewhere in this API, because these are the exact bytes the hash covers and the exact object the webhook delivers.

Every rule carries its citation and the date we last read the source. A cached copy is only as good as that date, which is why it travels with the rule rather than beside it.

Request

Responses

200Every rule across all four destinations, plus the product catalogue.
exported_atstringrequired
sha256stringrequired

SHA-256 of `JSON.stringify(rules)` exactly as returned here, and the same value `rule_snapshots.hash` holds — so comparing it against a `rule.changed` payload tells a partner whether their copy is current, and recomputing it over a stored file tells them whether that file is intact.

rule_countintegerrequired
rulesRule[]required
productsProduct[]required
notestringrequired
400The request body or query failed validation.
errorobjectrequired
401No key, an unknown key, a revoked key, or a key whose tenant is not active. All four return an identical body on purpose: distinguishing them would let a caller discover which partners we have.
errorobjectrequired
403The key is valid but does not hold the scope this route requires.
errorobjectrequired
404Not found, or not yours. A resource belonging to another tenant answers 404 rather than 403, because 403 would confirm the record exists.
errorobjectrequired

Example

curl
curl -X GET https://api.haavisa.com/v1/rules/export \
  -H "Authorization: Bearer $HAAVISA_API_KEY"

Something unclear? The eligibility guide explains the model behind the answers; the errors guide covers the envelope.