Three ways in: the Integration API to read your agency's data, webhooks to hear about events as they happen, and an MCP server so AI assistants can work with the same data. Every call is scoped to one agency and logged.
In your agency workspace, go to Developer → API keys and create a key. Tick only what the connection needs to read. A key can read nothing it was not given a scope for. The key is shown once; store it in your secret manager. Revoke it there at any time; revoked keys stop working immediately.
Send the key as a bearer token. The agency is taken from the key itself, so no tenant header is needed, and a key can never read another agency's data.
curl https://api.rationalhrm.com/api/v1/integration/timesheets?status=approved \
-H "Authorization: Bearer rhrm_live_…"{
"success": true,
"data": {
"items": [
{
"id": "…",
"workerId": "…",
"shiftId": "…",
"netMinutes": 330,
"hourlyRate": "16.5000",
"grossAmount": "90.7500",
"currency": "EUR",
"status": "approved",
"approvedAt": "2026-09-22T09:14:03.000Z",
"updatedAt": "2026-09-22T09:14:03.000Z"
}
],
"nextCursor": "MjAyNi0wOS0yMlQwOToxNDowMy4wMDBafDEyMzQ"
}
}Amounts are strings, never floats, so no cent is lost to rounding. Times are ISO 8601 in UTC.
Every list returns { items, nextCursor }. Keep calling with cursor=nextCursor until it is null. limit is 1–100 (default 50). For a nightly sync, remember when your last full sync started and pass it as updatedSince. You get only what changed since.
# Everything that changed since the last run, a page at a time
cursor=""
while :; do
page=$(curl -s "https://api.rationalhrm.com/api/v1/integration/shifts?updatedSince=2026-09-22T00:00:00Z&cursor=$cursor" \
-H "Authorization: Bearer $RHRM_KEY")
echo "$page" | jq '.data.items[]'
cursor=$(echo "$page" | jq -r '.data.nextCursor // empty')
[ -z "$cursor" ] && break
done| Route | Scope | Returns |
|---|---|---|
| GET /workers | workers:read | Name, email, contract type (payroll/zzp), city |
| GET /shifts | shifts:read | Client, location, times, hourly rate, places filled |
| GET /postings | postings:read | Job postings: title, role, client, status |
| GET /timesheets | timesheets:read | Worked times, net minutes, gross pay, approval |
| GET /invoices | invoices:read | Invoice number, amount, status, due and paid dates |
Shifts, postings, timesheets and invoices accept a status filter. The API is read-only; identifiers such as BSN, IBAN and date of birth are never returned. Full field lists are in the API reference.
| HTTP | Code | Meaning |
|---|---|---|
| 401 | API_KEY_REQUIRED / API_KEY_INVALID | No key, an unknown key, or a revoked or expired one. |
| 403 | API_KEY_SCOPE_MISSING | The key exists but was not given the scope this route needs. |
| 400 | INVALID_STATUS | A status filter that does not exist; the message lists the valid ones. |
| 429 | — | More than 300 requests a minute from one address. Back off and retry. |
Errors come as { "success": false, "error": { "code", "message" } }.
Add an endpoint under Developer → Webhooks and choose events. Each delivery is a POST with a JSON body and these headers:
X-RationalHRM-Event — the event nameX-RationalHRM-Delivery — this delivery's id (replays keep it)X-RationalHRM-Idempotency-Key — drop a repeat by this keyX-RationalHRM-Timestamp — seconds since the epochX-RationalHRM-Signature — HMAC-SHA256, hex, of ${timestamp}.${rawBody} with your webhook secretEvents: shift.published, shift.cancelled, application.received, application.accepted, assignment.checked_in, assignment.checked_out, timesheet.approved, invoice.paid, worker.onboarded.
Always verify the signature against the raw body, and reject timestamps more than five minutes old:
import { createHmac, timingSafeEqual } from 'node:crypto';
export function isFromRationalHrm(rawBody, headers, secret) {
const ts = Number(headers['x-rationalhrm-timestamp']);
if (!ts || Math.abs(Date.now() / 1000 - ts) > 300) return false;
const expected = createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
const given = String(headers['x-rationalhrm-signature'] ?? '');
return given.length === expected.length &&
timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}Answer with any 2xx within 10 seconds. A failed delivery is retried up to six times over about a day and a half, and can be replayed by hand from the delivery log.
The same data, as tools an AI client can call, over the Model Context Protocol. Every agency has its own address; give your AI clients that one. The generic address works too: the agency is then taken from the credential.
Agency URL: https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug>
Generic URL: https://api.rationalhrm.com/api/v1/integration/mcp
Transport: Streamable HTTP — POST only, JSON responses, no server-to-client stream
Protocol: 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05Your agency URL is shown, ready to copy, in the portal under Developer → API keys → Connected apps. A credential works only on its own agency's URL: any other slug is refused. GET answers 405; a request without an MCP-Protocol-Version header is treated as 2025-03-26.
There are two ways to authenticate, both sent as a bearer token:
Authorization: Bearer rhrm_live_…. For scripts, servers and clients that let you set a header.401 with a WWW-Authenticate header pointing to /.well-known/oauth-protected-resource/api/v1/integration/mcp/t/<agency-slug>, which names the authorization server (/.well-known/oauth-authorization-server). The client registers itself (dynamic client registration at /api/v1/oauth/register, or a client ID metadata document), then sends you to sign in to your agency portal and approve it. Authorization code with PKCE (S256 only); access tokens last an hour, refresh tokens 30 days.On the consent screen the member sees which app is asking and where it will send you back, and ticks what it may do. Write scopes start unticked, and the member can grant less than was asked, never more. Approving needs the same permission as creating an API key. A token is bound to the exact URL it was issued for (RFC 8707): a token for one agency's address is worthless on another's, or on the generic one. Every approved app is listed under Developer → API keys → Connected apps, where disconnecting it revokes every token it holds. A connection also stops working when the member who approved it leaves the agency.
| Scope | Kind | Allows |
|---|---|---|
| workers:read | Read | Workers — name, contract type, city, email |
| shifts:read | Read | Shifts — times, client, location, staffing |
| postings:read | Read | Job postings — title, role, client, status |
| applications:read | Read | Applications — who applied to which shift, and the pipeline stage |
| timesheets:read | Read | Timesheets — worked and approved hours, gross pay |
| invoices:read | Read | Invoices — number, amount, status, dates |
| postings:write | Write | Create job postings with their shifts (draft or published), edit and close them |
| shifts:write | Write | Edit shifts and cancel bookings on them |
| applications:write | Write | Move applications through the pipeline (including hiring) and reject them |
| timesheets:write | Write | Approve or dispute timesheets (approval bills the hours) |
The integration REST API uses only the read scopes. Write scopes are opt-in and only matter on the MCP server.
Under Developer → API keys, the MCP server card lets an agency admin:
403; the REST API is unaffected);A client sees only what its credential may use: a tool, resource or prompt outside its scopes, switched off by the agency, or (for writes) beyond its member's permissions is not listed at all. Read tools never change anything.
| Tool | Needs scope | Returns |
|---|---|---|
| list_workers | workers:read | Workers: name, email, contract type, city. Paged. |
| list_shifts | shifts:read | Shifts with client, location, times, rate and places filled. Paged. |
| list_job_postings | postings:read | Job postings with client, role and status. Paged. |
| list_timesheets | timesheets:read | Worked times, net minutes, gross pay, approval status. Paged. |
| list_invoices | invoices:read | Invoice number, amount, status, due and paid dates. Paged. |
| list_applications | applications:read | Applications by shift, status or pipeline stage, newest first. |
| list_clients | any of postings:read, shifts:read, postings:write | Clients and their locations (name and status only). |
| get_worker | workers:read | One worker, with onboarding and verification state. |
| get_shift | shifts:read | One shift with its bookings. |
| get_job_posting | postings:read | One job posting with a count of its shifts and places. |
| get_timesheet | timesheets:read | One timesheet: scheduled and worked times, breaks, pay. |
| get_invoice | invoices:read | One invoice with VAT, open amount and its lines. |
| get_hours_summary | timesheets:read | Approved, pending, disputed and rejected hours for a period, per client or worker. |
| get_invoice_summary | invoices:read | Outstanding, overdue, draft and recently paid totals per currency. |
| get_staffing_overview | shifts:read | Upcoming shifts over the next 1–60 days: places, fill rate, gaps. |
| search | any of workers:read, shifts:read, postings:read | Find workers, shifts and job postings by text. |
list_* tools page like the REST API (cursor, updated_since, limit up to 100). BSN, IBAN, date of birth and documents are never returned.
| Tool | Needs scope | Member needs permission | Does |
|---|---|---|---|
| create_job_posting | postings:write | staff.hire.access or staff.schedule.access | A posting with dated shifts; a draft unless publish=true, which runs the compliance check. |
| update_job_posting | postings:write | staff.hire.access or staff.schedule.access | Change wording, visibility or status (open / closed). |
| update_shift | shifts:write | staff.hire.access or staff.schedule.access | Change role, times, break, rate, places, worker type or visibility. |
| cancel_booking | shifts:write | staff.hire.access or staff.schedule.access | Cancel one worker's booking; the worker is notified. |
| move_application | applications:write | staff.hire.access | Move to new / screening / interview / offer / hired. Hired books the worker. |
| reject_application | applications:write | staff.hire.access | Reject an application; the worker is told. |
| approve_timesheet | timesheets:write | staff.pay.access | The agency's approval; full approval bills the hours. Pays nobody. |
| dispute_timesheet | timesheets:write | staff.pay.access | Dispute with a reason and, optionally, the right hours. |
| URI | Needs | Contents |
|---|---|---|
| rhrm://agency/profile | Any valid credential | Agency name, legal name, KvK, country, currency, time zone, brand. No bank details. |
| rhrm://scopes | Any valid credential | What this credential may do, and the tools it has. |
| rhrm://workers/{id} | workers:read | As get_worker |
| rhrm://shifts/{id} | shifts:read | As get_shift |
| rhrm://job-postings/{id} | postings:read | As get_job_posting |
| rhrm://timesheets/{id} | timesheets:read | As get_timesheet |
| rhrm://invoices/{id} | invoices:read | As get_invoice |
| Prompt | Needs scope | What it does |
|---|---|---|
| weekly_hours_report | timesheets:read | Hours and gross pay for one week per client: approved, waiting, disputed. |
| unpaid_invoices_followup | invoices:read | Overdue client invoices and a suggested follow-up order. |
| staffing_gaps | shifts:read | Upcoming shifts that still have open places, soonest first. |
| draft_job_posting | postings:write | Turn a short brief into a job posting, checked with you before it is saved. |
A prompt appears only when every tool it uses is available to the client.
integration.mcp.<tool>, naming the credential; a refused attempt as integration.mcp.<tool>.denied.idempotency_key (8–128 characters of letters, digits, . _ : -) on every write. Retrying with the same key within 24 hours returns the first result with "replayed": true instead of acting twice; the same key with different arguments is refused.Add a custom connector and paste your agency URL, nothing else. Claude sends you to your agency portal to sign in and approve it.
https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug>claude mcp add --transport http rational-hrm \
https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug> \
--header "Authorization: Bearer rhrm_live_xxx"Or in `.mcp.json`:
{
"mcpServers": {
"rational-hrm": {
"type": "http",
"url": "https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug>",
"headers": { "Authorization": "Bearer rhrm_live_xxx" }
}
}
}In `~/.cursor/mcp.json`:
{
"mcpServers": {
"rational-hrm": {
"url": "https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug>",
"headers": { "Authorization": "Bearer rhrm_live_xxx" }
}
}
}Add it as a custom connector (OAuth, as for Claude.ai), or with an API key through the mcp-remote bridge in claude_desktop_config.json:
{
"mcpServers": {
"rational-hrm": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug>",
"--header", "Authorization: Bearer ${RHRM_KEY}"
],
"env": { "RHRM_KEY": "rhrm_live_xxx" }
}
}
}curl -s https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug> \
-H "Authorization: Bearer rhrm_live_xxx" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'
curl -s https://api.rationalhrm.com/api/v1/integration/mcp/t/<agency-slug> \
-H "Authorization: Bearer rhrm_live_xxx" \
-H "Content-Type: application/json" \
-H "MCP-Protocol-Version: 2025-11-25" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'Replace rhrm_live_xxx with your own key and <agency-slug> with your workspace slug. The server is stateless: no session header is needed between calls.
The server introduces itself in your agency's name (serverInfo.title is “<Agency> · Rational HRM”), with the logo from your branding settings and a link to your own portal, so your team sees your brand in their AI client. Without a logo it uses the nlit icons:
https://api.rationalhrm.com/api/v1/integration/mcp/icon.png
https://api.rationalhrm.com/api/v1/integration/mcp/icon-dark.png
https://api.rationalhrm.com/api/v1/integration/mcp/icon-64.png
https://api.rationalhrm.com/api/v1/integration/mcp/icon-dark-64.png