Calculate a pay run
const url = 'https://api.usepayloom.com/api/v1/pay_runs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/calculate';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.usepayloom.com/api/v1/pay_runs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/calculate \ --header 'Authorization: Bearer <token>'Prices every employee in the run’s jurisdiction. Runs of 200 employees
or fewer calculate in the request and return calculated; larger runs
calculate in the background and return calculating — poll the pay run
until its status reads calculated (a failure falls back to draft).
Safe to repeat: recalculation reverses the prior run’s year-to-date
contributions before re-pricing, so it never double-counts.
Fails with 409 invalid_transition on a paid run (reopen it in the
console first) and 422 kyc_not_verified until the organization is
verified. Requires the payruns.run scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”A client-generated unique string (a UUID works). Retrying with the same key and body replays the original response instead of acting twice.
Responses
Section titled “Responses”OK
object
Lifecycle is draft → (calculating →) calculated → approved → paid;
volume runs price in the background and read calculating
meanwhile. A paid run is
immutable; later corrections arrive as retro adjustments on the next
open run rather than by rewriting history.
The date whose statutory rules priced this run.
object
object
Integer amount in the currency’s minor unit. 50000 GHS = 500.00.
object
Integer amount in the currency’s minor unit. 50000 GHS = 500.00.
object
Integer amount in the currency’s minor unit. 50000 GHS = 500.00.
Sits ON TOP of gross — do not add it into gross.
object
Integer amount in the currency’s minor unit. 50000 GHS = 500.00.
Example
{ "object": "pay_run", "status": "draft", "totals": { "gross": { "currency": "GHS" }, "net": { "currency": "GHS" }, "employee_deductions": { "currency": "GHS" }, "employer_cost": { "currency": "GHS" } }}Missing, invalid, revoked or expired key.
object
object
object
Example
{ "error": { "code": "missing_token" }}The key is valid but lacks the required scope.
object
object
object
Example
{ "error": { "code": "missing_token" }}No such resource in this organization.
object
object
object
Example
{ "error": { "code": "missing_token" }}A request with this Idempotency-Key is still in progress.
object
object
object
Example
{ "error": { "code": "missing_token" }}Headers
Section titled “Headers”Validation failed, or the Idempotency-Key was reused for a different
request (idempotency_key_reuse).
object
object
object
Example
{ "error": { "code": "missing_token" }}