Payroll Sessions

A payroll session is a short-lived token (rlm_ps_…) that lets a web page call a fixed set of payroll routes for 15 minutes. Your server creates it with a secret key; the Payroll widget uses it. You only need this page for the details, or if you build your own payroll UI on the same routes.


Create a session

POST /v1/payroll/sessions, from your server, with a secret key that has PAYROLL_SESSIONS_WRITE.

curl -X POST "https://sandbox.api.relm.co/v1/payroll/sessions" \
  -H "Authorization: Bearer rlm_sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "allowedOrigin": "https://hr.example.com",
    "features": ["VIEW", "UPLOAD_SHEET", "CREATE_REQUEST", "CANCEL_REQUEST", "MANAGE_BENEFICIARIES", "ADD_FUNDS"],
    "sourceAccountCurrencyId": "8a4f…",
    "maxRequestAmount": "250000.00",
    "approverUserId": "c1b6…",
    "externalUserReference": "hr-user-42",
    "ttlSeconds": 900
  }'
Field Required Description
allowedOrigin Yes The page that embeds payroll. Must be one of the key’s Allowed websites.
features Yes At least one of the features below.
sourceAccountCurrencyId No Pins the account payroll is paid from. Any other account is refused.
maxRequestAmount No Caps each payroll’s total, in the pinned account’s currency, fees included. Needs sourceAccountCurrencyId.
approverUserId No Who receives approval codes. Defaults to the key’s creator. Must be a user of the same business.
requireStepUp No Defaults to true. May be false only for ["VIEW"] sessions.
externalUserReference No Your own user id, for your records.
ttlSeconds No 60 to 3600. Default 900 (15 minutes).

Response 201:

{
  "success": true,
  "data": {
    "id": "5d0e…",
    "sessionToken": "rlm_ps_test_…",
    "features": ["VIEW", "UPLOAD_SHEET", "CREATE_REQUEST", "CANCEL_REQUEST", "MANAGE_BENEFICIARIES", "ADD_FUNDS"],
    "allowedOrigin": "https://hr.example.com",
    "sourceAccountCurrencyId": "8a4f…",
    "maxRequestAmount": "250000.00",
    "externalUserReference": "hr-user-42",
    "requireStepUp": true,
    "expiresAt": "2026-12-01T12:15:00.000Z",
    "revokedAt": null,
    "createdAt": "2026-12-01T12:00:00.000Z"
  }
}

Hand only sessionToken to the page.

Check or end a session

Call Description
GET /v1/payroll/sessions/:sessionId The session’s current state.
POST /v1/payroll/sessions/:sessionId/revoke Ends the session at once (e.g. when the user logs out of your app).

Both need a secret key with PAYROLL_SESSIONS_WRITE. Revoking the secret key itself ends all its sessions.


Using a session from the page

Every call sends Authorization: Bearer rlm_ps_…. Relm accepts the call when its Origin is:

  • any of the secret key’s Allowed websites (checked live, so removing a site from the key cuts it off at once), including the session’s allowedOrigin; or
  • the Relm portal, which serves the widget’s iframe.

Anything else gets 403 This payroll session cannot be used from this origin. You never need Relm to configure anything for your domains: adding the site to the key is enough.

On load, GET /v1/customers/payroll/session returns the session’s own settings: features, allowedOrigin, limits, expiry, whether approval is needed, stepUpMethod ("TOTP", "EMAIL" or null), and customer: { id, displayName, payrollStatus }. Use it to show only the allowed actions.

Features

Feature Allows
VIEW GET /customers/payroll/requests, GET /customers/payroll/requests/:requestId, GET /customers/payroll/transfers, GET /customers/payroll/template
CREATE_REQUEST POST /customers/payroll/estimate (returns feeHash), then POST /customers/payroll/requests with { sourceAccountCurrencyId, payrollAccountCurrencyId, amountSplitDetails, feeHash, stepUpCode }
UPLOAD_SHEET GET /customers/payroll/template; POST /customers/payroll/sheet/estimate (multipart file, returns feeHash); POST /customers/payroll/sheet/confirm with { feeHash, stepUpCode }
CANCEL_REQUEST DELETE /customers/payroll/requests/:requestId with { cancellationReason }
MANAGE_BENEFICIARIES Add: POST /accounts/:accountId/beneficiary; GET /accounts/:accountId/beneficiary/:beneficiaryId/payout-config; confirm or discard: PUT /accounts/:accountId/beneficiaries/:beneficiaryId with { confirmed, stepUpCode }; remove: DELETE /accounts/:accountId/beneficiaries/:beneficiaryId with the code in the x-payroll-step-up-code header (or body stepUpCode)
ADD_FUNDS POST /accounts/:accountId/deposit/:currencyCode (deposit instructions), GET /accounts/:accountId/whitelisted, POST /accounts/:accountId/crypto-wallets/whitelist and POST /accounts/:accountId/fiat-accounts/whitelist with stepUpCode

All paths are under /v1. With VIEW, CREATE_REQUEST or UPLOAD_SHEET, a session can also read the account pickers: GET /customers/:customerId/accounts, GET /accounts, GET /accounts/:accountId/currencies and GET /accounts/:accountId/beneficiary. Every session can call GET /customers/me (the key creator’s profile), GET /currencies, GET /config/banking/payout and GET /config/banking/account.

Sessions can never call the customer MFA and passcode routes; they use the approval code below instead. Any other call answers 403 This payroll session does not allow this action.


Approval before money moves

When requireStepUp is true (the default), creating a payroll, confirming a sheet, confirming or removing a beneficiary and whitelisting a funding account need a one-time approval code from the approver. The method follows the approver’s own MFA setting in Relm:

  • Authenticator app (TOTP) enabled: the code always comes from the app. Nothing is emailed, and emailed codes are never accepted.
  • Otherwise: a 6-digit code is emailed, valid for 10 minutes, with 3 attempts.

Steps:

  1. After the estimate, call POST /v1/customers/payroll/step-up. It returns { "method": "TOTP" | "EMAIL" }.
    • TOTP: nothing is sent. Show “Enter the code from your authenticator app”.
    • EMAIL: show “We emailed a code to the approver” and a resend button (call step-up again).
  2. Send the code as stepUpCode on the call that moves money (for DELETE, the x-payroll-step-up-code header also works). Each approval needs a fresh code; an emailed code is used up once accepted.
  3. Errors:
    • No code: 403 STEP_UP_REQUIRED.
    • Wrong or expired code: 400 invalid-code. For EMAIL, ask for a new code after 3 misses; for TOTP, wait for the next code in the app.
    • A different source account than the pinned one, or a total above maxRequestAmount: 403.

Expiry

When any call returns 401 Invalid or expired payroll session, the session is over. Ask your server for a new one and continue. Sessions are never refreshed.

Tracking from your server

Poll GET /v1/customers/payroll/requests/:requestId with a secret key that has PAYROLL_READ, or use webhooks.


Copyright © 2025 Relm