Skip to main content
This tutorial takes you through a full loop with the Kua API — from an empty sandbox to a disbursed payroll run you observe via a webhook. Use a kua_test_… key so nothing moves real money.
Everything here runs in test mode. Test data is isolated and auto-purges after 14 days, so experiment freely.

Before you start

  • A kua_test_… API key with the employees:write and payroll:write scopes (or *).
  • An employment type to place the employee in. Employment types are created in the dashboard; grab its id from Settings → Employment types. We’ll call it EMPLOYMENT_TYPE_ID below.
  • Optionally, an SDK installed (npm install @kua/node or pip install kua).
1

Add an employee

Create the person you’re going to pay. Send an Idempotency-Key so a retry can’t add them twice.
You get back the new employee’s id. Set their salary structure in the dashboard so they’re included in payroll (or via your normal onboarding flow).
2

Create a payroll run

Build a draft run for the month from your current roster. This does not move money — it stages payroll for approval.
The run comes back with status: "Draft".
3

Approve and disburse

Approval and disbursement are deliberate, owner-gated steps — done from the dashboard (or an owner-authorized flow), not with a scoped API key. This keeps an integration from releasing funds on its own. Approve and disburse the draft run there.As it progresses, Kua emits events: payroll.run.hr_approved, payroll.run.disbursement_started, payroll.line.settled (per employee), and finally payroll.run.disbursed.
4

Receive the event

Rather than polling, let Kua tell you when the run settles. Register a webhook (once), then handle the delivery.
Register an endpoint
The response includes a signing secret (whsec_…) — store it. Now handle deliveries, verifying each one:
Not ready to stand up a public endpoint? Fire a test delivery at your handler with POST /v1/webhooks/{id}/ping, or just poll GET /v1/events.

What you built

You added an employee, staged a payroll run, and wired up a verified, real-time event handler — the backbone of any Kua integration. From here:

Webhooks overview

Delivery, retries, and the full event catalog.

API reference

Every endpoint with a live playground.