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

# Get a user's reserve balance

`GET https://marketplace-api.sequifi.com/v1/users/{id}/reserve`

Module: Reserve · operationId: `getUserReserve` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/get-user-reserve

Returns a user's Reserve Balances position: the current `balance`, lifetime `totals`, and the ledger of every movement, newest first. The same dollars are counted as `paid` in GET /v1/users/{id}/earnings, so never add `balance` to that figure.

**What happens:**

- When the Reserve Balances add-on is on, part of a user's earnings is held in a reserve instead of going onto a pay stub. Held money leaves the reserve only when an admin sends it to payroll, which puts a Reserve Payout adjustment on a stub and writes a `send_to_payroll_debit` entry here.
- Held lines are never on a pay stub, so they are absent from pay stub line items. Use line items to reconcile what was paid, and this endpoint to explain where the rest went.
- `reserve_status` says whether your company uses the reserve: `active` (new movements are recorded), `deactivated` (frozen, but existing balances are still owed and visible, so do not hide them), or `available`, `requested` or `coming_soon` (never turned on). When it was never turned on, `balance` is `0`, `entries` is empty and `last_page` is `0`.
- `reserve_enabled` is `true` only when `reserve_status` is `active`.
- `balance` is the stored current balance, the same figure the app shows.
- A clawback settled against the reserve appears here as `clawback_debit` and is also counted in the earnings `clawbacks` total. Do not subtract it twice.

**Filtering and paging:**

- `entry_type`, `date_from` and `date_to` narrow `entries` only. `totals` are lifetime and never filtered; `total` (the pager count) is.
- Dates filter on `effective_date`, inclusive.
- `entry_type` accepts any lowercase identifier, so a type added after this page was written still works. An unknown but well-formed type returns an empty page.
- `page` defaults to 1. `per_page` defaults to 50, maximum 500. `last_page` is `0` when there are no entries.

**Formats:**

- Amounts are JSON numbers in dollars, rounded to cents, signed as they move the balance: credits positive, debits negative.
- `direction` comes from the sign of `amount`, not from `entry_type`. A `send_to_payroll_debit` that clears a negative balance is a `credit`.
- `totals.paid_out` is the signed sum of payouts and their reversals, so it is normally negative.
- Deal entries carry `pid` and `customer_name` and no pay period. Payout entries carry the paycheck's `pay_period_from` and `pay_period_to` and no `pid`.
- `effective_date` is `YYYY-MM-DD`. `created_at` is `YYYY-MM-DD HH:MM:SS` with no time zone.
- `ref_type` and `ref_id` identify the source record. Treat `ref_type` as an opaque label.
- `entry_type` values in use today: `milestone_credit`, `milestone_adjustment`, `milestone_adjustment_reversal`, `override_credit`, `clawback_debit`, `deduction_accrual_clawback`, `advance_repayment_debit`, `send_to_payroll_debit`, `send_to_payroll_reversal`, `source_retired_reversal` (the source line was removed, so its entry is reversed) and `source_retired_reversal_correction` (a reversal that should not have been written, undone). The list can grow.

**Errors:**

- `400 Invalid user id`, `400 Invalid query parameter(s)`, `400 entry_type must be a lowercase identifier` (with `data.known_entry_types`), `400 date_from must be in YYYY-MM-DD format` (or `date_to`), `400 date_from must be on or before date_to`, `400 page must be a positive integer`, `400 per_page must be an integer between 1 and 500`.
- `404 User not found`.

**Related:**

- GET /v1/users/{id}/earnings/items marks held lines as `reserved`.
- GET /v1/payroll-history/{id}/line-items shows the Reserve Payout adjustment on a stub.

## Path parameters

- `id` (integer, **required**): User id from GET /v1/users. Minimum: 1. Example: `4821`.

## Query parameters

- `entry_type` (string): Only entries of this type. An unknown but well-formed value returns an empty page. Example: `milestone_credit`.
- `date_from` (string (date)): Only entries with `effective_date` on or after this date. Format `YYYY-MM-DD`. Example: `2026-08-01`.
- `date_to` (string (date)): Only entries with `effective_date` on or before this date. Format `YYYY-MM-DD`. Example: `2026-08-31`.
- `page` (integer): Page of entries. Default: `1`. Minimum: 1. Example: `1`.
- `per_page` (integer): Entries per page. Default: `50`. Minimum: 1. Maximum: 500. Example: `50`.

## Example request

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

## Responses

### 200: The user's reserve balance and ledger

- `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.
  - `user` (object): The user: `id`, `employee_id`, `first_name`, `last_name`, `position_id`, `position_name`.
  - `reserve_status` (string): `active`, `deactivated`, or a value meaning never turned on (`available`, `requested`, `coming_soon`).
  - `reserve_enabled` (boolean): `true` only when `reserve_status` is `active`.
  - `balance` (number): Current reserve balance in dollars.
  - `totals` (object): Lifetime totals, never filtered.
    - `credited` (number): Sum of positive entries.
    - `debited` (number): Sum of negative entries.
    - `paid_out` (number): Signed sum of payouts and payout reversals. Normally negative.
    - `entry_count` (integer): Number of entries.
  - `filters` (object, nullable): Filters as applied, or null.
  - `current_page` (integer): Page returned.
  - `per_page` (integer): Entries per page.
  - `total` (integer): Entries matching the filters.
  - `last_page` (integer): Last page number. `0` when there are no entries.
  - `entries` (array of object): Ledger entries, newest first.
    - `id` (integer): Entry id.
    - `entry_type` (string): Kind of movement.
    - `direction` (string): From the sign of `amount`. One of: `credit`, `debit`.
    - `amount` (number): Signed dollars.
    - `pid` (string, nullable): Sale id on deal entries.
    - `customer_name` (string, nullable): Sale customer on deal entries.
    - `description` (string, nullable): Text describing the movement.
    - `effective_date` (string): When the movement counts, `YYYY-MM-DD`.
    - `pay_period_from` (string, nullable): Pay period start of the paycheck, on payout entries.
    - `pay_period_to` (string, nullable): Pay period end of the paycheck, on payout entries.
    - `ref_type` (string, nullable): Opaque label for the source record.
    - `ref_id` (integer, nullable): Id of the source record.
    - `created_at` (string): When the entry was written, `YYYY-MM-DD HH:MM:SS` with no time zone.

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "requestedBy": "acme",
    "user": {
      "id": 4821,
      "employee_id": "EMP-4821",
      "first_name": "Alex",
      "last_name": "Morgan",
      "position_id": 5,
      "position_name": "Closer"
    },
    "reserve_status": "active",
    "reserve_enabled": true,
    "balance": 740,
    "totals": {
      "credited": 1450,
      "debited": -710,
      "paid_out": -500,
      "entry_count": 6
    },
    "filters": {
      "date_from": "2026-08-01"
    },
    "current_page": 1,
    "per_page": 50,
    "total": 3,
    "last_page": 1,
    "entries": [
      {
        "id": 3108,
        "entry_type": "milestone_credit",
        "direction": "credit",
        "amount": 420,
        "pid": "SALE-10482",
        "customer_name": "Riley Chen",
        "description": "Final commission milestone for sale SALE-10482",
        "effective_date": "2026-08-14",
        "pay_period_from": null,
        "pay_period_to": null,
        "ref_type": "user_commission",
        "ref_id": 70114,
        "created_at": "2026-08-14 09:12:00"
      },
      {
        "id": 3102,
        "entry_type": "clawback_debit",
        "direction": "debit",
        "amount": -180,
        "pid": "SALE-10517",
        "customer_name": "Jordan Patel",
        "description": "Clawback settled against reserve for sale SALE-10517",
        "effective_date": "2026-08-11",
        "pay_period_from": null,
        "pay_period_to": null,
        "ref_type": "clawback_settlements",
        "ref_id": 712,
        "created_at": "2026-08-11 17:02:41"
      },
      {
        "id": 3095,
        "entry_type": "send_to_payroll_debit",
        "direction": "debit",
        "amount": -500,
        "pid": null,
        "customer_name": null,
        "description": "Reserve payout to payroll",
        "effective_date": "2026-08-09",
        "pay_period_from": "2026-08-09",
        "pay_period_to": "2026-08-15",
        "ref_type": "approvals_and_requests",
        "ref_id": 3307,
        "created_at": "2026-08-08 11:20:05"
      }
    ]
  }
}
```

### 400: Invalid user id, query parameter, entry type, date, or paging value

Example (invalid_params): Unknown query parameter

```json
{
  "status": 400,
  "message": "Invalid query parameter(s)",
  "data": {
    "invalid_params": [
      "pay_period_from"
    ],
    "allowed_params": [
      "entry_type",
      "date_from",
      "date_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"
}
```

### 404: User not found

```json
{
  "status": 404,
  "message": "User not found",
  "data": {}
}
```

### 500: Internal server error

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