Motivation MoneyMotivation Money
API 参考Payroll Runs

Execute a payroll run (async)

Initiates CEX withdrawals for all payouts in the run. This is an async operation — returns immediately with a job_id for progress tracking.

The run must be in DEPOSITED status (funds arrived at CEX).

Requires payroll:execute scope. Requires Idempotency-Key header.

Allowed from status: DEPOSITED only.

Side effects: Creates audit log entries. Sends payout notification emails. Triggers webhooks: payroll.run.executing, payout.processing.

POST
/payroll-runs/{run_id}/execute
AuthorizationBearer <token>

API key: Authorization: Bearer mpk_live_<key>

In: header

Path Parameters

run_id*string

Payroll run identifier

Header Parameters

Idempotency-Key*string

UUID v4. Required on all write operations. Prevents duplicate execution on retry.

Formatuuid

Response Body

application/json

application/json

application/json

curl -X POST "https://motivation-money.vercel.app/api/v1/payroll-runs/run_cm5x8k2a3000108l3g8h1j2k4/execute" \  -H "Idempotency-Key: 7f3c4d2a-8b1e-4f6a-9c2d-1a5b8e3f7d4c"
{
  "data": {
    "id": "run_new456",
    "status": "PAYING_OUT",
    "job": {
      "job_id": "job_exec_789",
      "status": "PROCESSING",
      "status_url": "/api/v1/jobs/job_exec_789",
      "estimated_duration_seconds": 120
    }
  }
}
{
  "error": {
    "code": "CEX_INSUFFICIENT_BALANCE",
    "message": "CEX account balance insufficient for this payroll run.",
    "details": {},
    "recovery_hint": "Transfer funds to CEX before retrying.",
    "docs_url": "http://example.com"
  },
  "api_version": "2026-03-01",
  "request_id": "req_abc123"
}
{
  "error": {
    "code": "CEX_INSUFFICIENT_BALANCE",
    "message": "CEX account balance insufficient for this payroll run.",
    "details": {
      "required_usdc_cents": 4782350,
      "available_usdc_cents": 1240000,
      "deficit_usdc_cents": 3542350
    },
    "recovery_hint": "Transfer funds to CEX before retrying. Check GET /v1/treasury/balance."
  }
}