Rivil API
Two roots
Section titled “Two roots”| Root | What for | Key |
|---|---|---|
/api/site/v1/<module> |
everything the public sees: site, store, appointments, stays, tickets, client account | site key (or channel, portal, event key) |
/api/v1/<resource> |
administration, integrations, automations | company key |
/api/public/... serves ERP pages, embeds, token links and third-party webhooks. Do not build new sites on it.
Keys and authentication
Section titled “Keys and authentication”Every request sends the key in a header:
curl https://<erp-host>/api/site/v1/types \ -H "Authorization: Bearer $RIVIL_SITE_KEY"| Key | Create it in the ERP | What it can do |
|---|---|---|
| site | Site, the site’s page | content, forms, appointments, stays, careers, reviews, events; the store, accounts and auction linked to that site |
| store channel | the channel’s page | only that channel’s store |
| client portal | the portal’s page | only client accounts |
| company | Settings, API | /api/v1, with the permissions you pick (<module>:read, <module>:write) |
The key is shown once, when created. Keep it on the server only, in environment variables, and revoke it in the ERP if it leaks. Clinical data and user accounts have separate permissions that * does not include.
Visitor header
Section titled “Visitor header”Your site calls Rivil from its server, so every visitor would look like the same address. Send the real one, so limits apply per person:
X-Rivil-Client-IP: 203.0.113.24X-Shop-Client-IP is accepted too.
Errors
Section titled “Errors”{ "error": { "code": "validation_failed", "message": "...", "details": {} } }Use code in your logic, it stays stable. message is human text in the company’s language. A few older routes (stays, careers, reviews) return { "error": "text" }, so handle both shapes.
| Status | Meaning |
|---|---|
| 400 / 422 | wrong or missing data |
| 401 | missing or expired key or session |
| 403 | the key lacks the permission or the module is off |
| 404 | does not exist or is not public |
| 409 | conflict: the slot was taken, stock ran out, someone else bid meanwhile |
| 423 | the company is temporarily read only; retry after Retry-After |
| 429 | too many requests; wait for Retry-After |
Limits
Section titled “Limits”/api/v1: 300 requests per minute per key./api/site/v1: limits per visitor address, stricter on writes (forms, bookings, orders).
Cache content briefly in your site (one minute is enough) and purge it from webhooks.
Idempotency
Section titled “Idempotency”On a flaky network a retried request can create something twice. Send a unique identifier per operation:
Idempotency-Key: 7f0c2d6e-5c1b-4c2a-9a57-0e6c3f4b8d21It works on POST under /api/v1, on store checkout and on stay reservations.
Webhooks
Section titled “Webhooks”Instead of polling “did anything change?”, Rivil tells you. Add your address in the ERP (Settings, API) or on the site’s or channel’s page and pick events: clients.created, content.*, shop.changed, *.
{ "id": "evt_1042", "type": "clients.updated", "created_at": "2026-01-31T09:30:00.000Z", "tenant": { "id": "1", "slug": "your-company" }, "data": { "object": {}, "previous_attributes": {} }}Headers: X-Rivil-Event, X-Rivil-Delivery, X-Rivil-Attempt, X-Rivil-Signature: t=<timestamp>,v1=<hmac>. The signature is HMAC-SHA256 over <timestamp>.<raw body> with the endpoint secret.
import { createHmac, timingSafeEqual } from 'node:crypto'
export function verifyRivil(raw: string, header: string, secret: string): boolean { const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('='))) if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false const expected = createHmac('sha256', secret).update(`${t}.${raw}`).digest('hex') return expected.length === v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(v1))}Answer quickly with 2xx and do the work afterwards. If you do not answer, delivery is retried (6 attempts in total, over a few hours). Skip an X-Rivil-Delivery you already processed.
OpenAPI
Section titled “OpenAPI”- Public, with no company data:
/openapi/site.json,/openapi/v1.json - For your site, with its content types:
GET /api/site/v1/openapi.json - For your store:
GET /api/site/v1/shop/openapi.json - For your company, with its modules and fields:
GET /api/v1/openapi.json
For AI assistants
Once you have a key, request the matching OpenAPI file first and work from it. Do not guess field names.