Skip to main content

Partner API: payroll runs

Payroll comes in two layers: the run summaries, which are totals per run, and one run's per-employee lines. They need different scopes, because the second is per-person pay.

Written by Vaibhav Kashyap

Scopes used on this page: payroll:read, payroll:read_detail. Calling an endpoint your key was not granted the scope for returns 403 insufficient_scope.

Every call below needs your API key — see Partner API: authentication and your first call — and every response follows the paging and field-selection rules in Partner API: pagination, field selection and identifiers.

GET /v1/payroll/runs

Run-level payroll summaries across every active legal entity, newest first, defaulting to REGULAR runs. Totals are the same pre-aggregated figures the Asanify product UI shows. Per-employee and per-component amounts are not on this endpoint.

Scope required: payroll:read.

Query parameters:

  • month — Calendar month of the run, 1-12.

  • year — Calendar year of the run.

  • type — Comma-separated payrun types. Defaults to REGULAR. Values are the payrun_type each run carries in the response.

  • entity_id — Restrict to one legal entity. Omitted covers every active entity.

Fields on each record: currency, entity_id, from_date, month, payrun_type, processed_on, status, subtotal_id, to_date, total_payable, year.

Example:

curl -s "https://api.asanify.com/v1/payroll/runs" \
  -H "Authorization: Bearer $ASANIFY_API_KEY"

GET /v1/payroll/runs/{subtotal_id}

One payroll run plus the per-employee lines behind it, for posting to a general ledger. Requires payroll:read_detail, which is granted separately from payroll:read.

Scope required: payroll:read_detail.

Path variables:

  • subtotal_id — the subtotal_id of a payroll run, as returned by the run-summary endpoint.

Query parameters:

  • fields — Comma-separated subset of this endpoint's response fields, at most 100. Narrowing only: a name outside the documented field list is rejected with 400, never silently ignored.

The response comes back in sections rather than as one flat list:

  • Fields on each entry in employees: adjustments, asan_empcode, basic, commission, components, custom_fields, date_of_exit, date_of_joining, employee_id, employee_status, epf_admin_employer, epf_edli_employer, epf_employee, epf_employer, eps_employer, esi_employee, esi_employer, from_date, full_name, gross_salary, hra, lop_days, month, net_salary, payroll_type, professional_tax, special_allowance, state_id, tds_after_cess, tds_normal, to_date, total_outflow, total_payable, work_address_name, working_period_lop_days, year.

  • Fields on run: currency, entity_id, from_date, month, payrun_type, processed_on, status, subtotal_id, to_date, total_payable, year.

Example:

curl -s "https://api.asanify.com/v1/payroll/runs/{subtotal_id}" \
  -H "Authorization: Bearer $ASANIFY_API_KEY"

Substitute {subtotal_id} before running it.

Did this answer your question?