<!-- Generated by scripts/build-docs.js. Edit docs/swagger.yaml or docs/guides/, then run `npm run docs:build`. -->

# List open pay stubs

`GET https://marketplace-api.sequifi.com/v1/payroll`

Module: Payroll · operationId: `listPayroll` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/list-payroll

Lists pay stubs that have not been paid yet, one row per user per pay run, newest first. Paid stubs move to GET /v1/payroll-history and drop out of this list. There is no `user_id` filter.

**What happens:**

- Read-only.
- A one-time payment is a separate row (`is_onetime_payment: 1`) next to the user's regular stub for the same period.
- Each row can carry `custom_field`, the stub's custom payroll field values.

**Filtering and paging:**

- Filters are optional and combine with AND.
- `pay_period_from` and `pay_period_to` return stubs whose whole period falls inside the range: the period starts on or after `pay_period_from` and ends on or before `pay_period_to`. A period that crosses either boundary is left out.
- `pay_frequency` takes a pay frequency id: `2` Weekly, `3` Bi-Weekly, `4` Semi-Monthly, `5` Monthly, `6` Daily.
- `status`: `1` open, `2` finalized, `3` payment in progress. Paid stubs are not in this list, so `status=3` returns few or no rows.
- `is_mark_paid`: `true` for stubs an admin marked as paid outside Sequifi, `false` for the rest.
- `worker_type` is an exact match (`1099` or `w2`). Other values are not rejected; they match nothing.
- `page` defaults to 1 and `per_page` to 10. No maximum is enforced on `per_page`; keep it at 200 or less.
- Sorted by stub `id`, newest first. `last_page` is `0` when nothing matches.
- To find one user's stub, filter by pay period and match `user_id` yourself, or take `payroll_id` from GET /v1/users/{id}/earnings/items.

**Formats:**

- `pay_period_from` and `pay_period_to` are timestamps at midnight UTC, for example `"2026-03-01T00:00:00.000Z"`. Use the date part.
- Most money fields are JSON numbers. `employee_tax`, `employer_tax` and `total_earning` are decimal strings such as `"152.40"`, or null.
- `filters` echoes the query values as strings.

**Errors:**

- `400 Invalid query parameter(s)` for an unknown query key, with `data.invalid_params` and `data.allowed_params`.
- `400 is_mark_paid must be 'true' or 'false'`.
- `400 pay_period_from must be in YYYY-MM-DD format` (or `pay_period_to`): the value must be a real calendar date.
- A non-numeric `page`, `per_page`, `status` or `pay_frequency` returns `500`, not `400`. Validate these before sending and do not retry a `500` with the same values.

**Related:**

- GET /v1/payroll/{id} and GET /v1/payroll/{id}/line-items read one stub.
- GET /v1/payroll-history lists paid stubs.
- GET /v1/pay-frequency maps frequency ids to names.

## Query parameters

- `pay_frequency` (integer): Pay frequency id: `2` Weekly, `3` Bi-Weekly, `4` Semi-Monthly, `5` Monthly, `6` Daily. One of: `2`, `3`, `4`, `5`, `6`. Example: `2`.
- `status` (integer): `1` open (editable), `2` finalized (ready to pay), `3` payment in progress. Paid stubs are not in this list. One of: `1`, `2`, `3`. Example: `1`.
- `is_mark_paid` (string): `true` returns stubs an admin marked as paid outside Sequifi; `false` returns the rest. Omit for both. One of: `false`, `true`. Example: `false`.
- `worker_type` (string): Exact match on worker type: `1099` or `w2`. Other values return no rows. Example: `w2`.
- `pay_period_from` (string (date)): Only stubs whose period starts on or after this date. Format `YYYY-MM-DD`. Example: `2026-03-01`.
- `pay_period_to` (string (date)): Only stubs whose period ends on or before this date. Format `YYYY-MM-DD`. Example: `2026-03-07`.
- `page` (integer): Page number. Default: `1`. Minimum: 1. Example: `1`.
- `per_page` (integer): Rows per page. No maximum is enforced; keep it at 200 or less. Default: `10`. Minimum: 1. Example: `10`.

## Example request

```bash
curl -X GET "https://marketplace-api.sequifi.com/v1/payroll" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN"
```

## Responses

### 200: A page of open pay stubs

- `status` (integer): The HTTP status code, repeated. Example: `200`.
- `message` (string): Short text. Wording varies by endpoint; branch on the HTTP status, not on this text. Example: `success`.
- `data` (object)
  - `requestedBy` (string): Label of the API credential that made the call.
  - `current_page` (integer): Page returned.
  - `per_page` (integer): Rows per page.
  - `total` (integer): Rows across all pages.
  - `last_page` (integer): Last page number. `0` when nothing matches.
  - `filters` (object, nullable): The filters you sent, as strings, or null when none.
  - `payrolls` (array of object): Open pay stubs. Rows also carry other stored fields not listed here; ignore them, they can change without notice.
    - `id` (integer): The pay stub id. It stays the same after the stub is paid.
    - `user_id` (integer): The user being paid.
    - `position_id` (integer, nullable): The user's position for this pay run.
    - `pay_frequency` (integer): Pay frequency id.
    - `worker_type` (string): `1099` or `w2`.
    - `pay_period_from` (string): Start of the pay period, midnight UTC timestamp.
    - `pay_period_to` (string): End of the pay period, midnight UTC timestamp.
    - `status` (integer): `1` open, `2` finalized, `3` payment in progress. One of: `1`, `2`, `3`.
    - `is_mark_paid` (integer): `1` when an admin marked the stub as paid outside Sequifi, otherwise `0`.
    - `is_onetime_payment` (integer): `1` for a one-time payment stub.
    - `commission` (number): Commission total.
    - `override` (number): Override total.
    - `adjustment` (number): Adjustment total.
    - `reimbursement` (number): Reimbursement total.
    - `deduction` (number): Deduction total.
    - `clawback` (number): Clawback total.
    - `reconciliation` (number): Reconciliation payout total.
    - `hourly_salary` (number): Hourly and salary wages.
    - `overtime` (number): Overtime wages.
    - `custom_payment` (number): Custom payment amount.
    - `gross_pay` (number): Gross pay.
    - `net_pay` (number): Net pay. Not final until the payroll is finalized.
    - `employee_tax` (string, nullable): Employee taxes as a decimal string.
    - `employer_tax` (string, nullable): Employer taxes as a decimal string.
    - `total_earning` (string, nullable): Total earnings as a decimal string.
    - `created_at` (string): When the stub was created, ISO 8601 UTC.
    - `updated_at` (string): When the stub last changed, ISO 8601 UTC.
    - `custom_field` (array of object): Present only when the stub has custom payroll field values. A one-item array holding an object that maps each field name to its value (a string).

Example (with_filters): Filtered list with custom fields

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "requestedBy": "acme",
    "current_page": 1,
    "per_page": 10,
    "total": 2,
    "last_page": 1,
    "filters": {
      "pay_frequency": "2",
      "worker_type": "w2"
    },
    "payrolls": [
      {
        "id": 5521,
        "user_id": 4821,
        "position_id": 14,
        "pay_frequency": 2,
        "worker_type": "w2",
        "pay_period_from": "2026-03-01T00:00:00.000Z",
        "pay_period_to": "2026-03-07T00:00:00.000Z",
        "status": 1,
        "is_mark_paid": 0,
        "is_onetime_payment": 0,
        "commission": 1250,
        "override": 150,
        "adjustment": 0,
        "reimbursement": 40,
        "deduction": 0,
        "clawback": 0,
        "reconciliation": 0,
        "hourly_salary": 560,
        "overtime": 0,
        "custom_payment": 0,
        "gross_pay": 2000,
        "net_pay": 1712.5,
        "employee_tax": "152.40",
        "employer_tax": "152.40",
        "total_earning": null,
        "created_at": "2026-03-08T14:02:11.000Z",
        "updated_at": "2026-03-08T14:02:11.000Z",
        "custom_field": [
          {
            "Sales Bonus": "100",
            "Expenses": "20"
          }
        ]
      },
      {
        "id": 5520,
        "user_id": 4822,
        "position_id": 14,
        "pay_frequency": 2,
        "worker_type": "w2",
        "pay_period_from": "2026-03-01T00:00:00.000Z",
        "pay_period_to": "2026-03-07T00:00:00.000Z",
        "status": 1,
        "is_mark_paid": 0,
        "is_onetime_payment": 0,
        "commission": 900,
        "override": 0,
        "adjustment": 0,
        "reimbursement": 0,
        "deduction": 0,
        "clawback": 0,
        "reconciliation": 0,
        "hourly_salary": 600,
        "overtime": 0,
        "custom_payment": 0,
        "gross_pay": 1500,
        "net_pay": 1285.25,
        "employee_tax": "114.75",
        "employer_tax": "114.75",
        "total_earning": null,
        "created_at": "2026-03-08T14:02:11.000Z",
        "updated_at": "2026-03-08T14:02:11.000Z"
      }
    ]
  }
}
```

Example (no_filters): Unfiltered list (filters is null)

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "requestedBy": "acme",
    "current_page": 1,
    "per_page": 10,
    "total": 50,
    "last_page": 5,
    "filters": null,
    "payrolls": [
      {
        "id": 5530,
        "user_id": 4830,
        "position_id": 9,
        "pay_frequency": 3,
        "worker_type": "1099",
        "pay_period_from": "2026-03-01T00:00:00.000Z",
        "pay_period_to": "2026-03-14T00:00:00.000Z",
        "status": 1,
        "is_mark_paid": 0,
        "is_onetime_payment": 0,
        "commission": 0,
        "override": 0,
        "adjustment": 0,
        "reimbursement": 0,
        "deduction": 0,
        "clawback": 0,
        "reconciliation": 0,
        "hourly_salary": 0,
        "overtime": 0,
        "custom_payment": 0,
        "gross_pay": 0,
        "net_pay": 0,
        "employee_tax": null,
        "employer_tax": null,
        "total_earning": null,
        "created_at": "2026-03-15T09:30:00.000Z",
        "updated_at": "2026-03-15T09:30:00.000Z"
      }
    ]
  }
}
```

### 400: Unknown query parameter, bad is_mark_paid value, or bad date

Example (invalid_params): Unknown query parameter

```json
{
  "status": 400,
  "message": "Invalid query parameter(s)",
  "data": {
    "invalid_params": [
      "user_id"
    ],
    "allowed_params": [
      "pay_frequency",
      "status",
      "is_mark_paid",
      "worker_type",
      "pay_period_from",
      "pay_period_to",
      "page",
      "per_page"
    ]
  }
}
```

### 401: Missing, invalid or expired token. The gateway rejects the call before it reaches Sequifi, so the body has only a `message`.

```json
{
  "message": "Unauthorized"
}
```

### 500: Internal server error, including a non-numeric page, per_page, status or pay_frequency

```json
{
  "status": 500,
  "message": "Internal Server Error",
  "data": {}
}
```
