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

# List a user's commission rates

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

Module: Commissions · operationId: `listUserCommissions` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/list-user-commissions

Returns a user's commission rate card, the same settings as the Commission tab on their profile in Sequifi, grouped by product and split by role (closer, setter, self-gen). These are rates, not money earned; use GET /v1/users/{id}/earnings for amounts.

**What happens:**

- Products returned are those the user has any commission, milestone, override or withheld setting for. The full catalog is at GET /v1/products.
- Each rate is the one in effect today in your company's time zone: the latest setting effective on or before today, otherwise the next upcoming one.
- Roles come from the user's own commission settings for the product: `closer`, `setter` or `self_gen`.
- `redlines` are per role, not per product, so they are returned once at the top level. The list is empty when the user has no redline settings.
- `tiered: true` means the actual rate depends on a tier table that this endpoint does not return, so `amount` alone is not the rate.

**Filtering and paging:**

- `product_id` limits the result to one product.
- `role` limits each product's `roles` to that role and returns only products where the user has commission or milestone settings for it. Products with only override or withheld settings are left out under a role filter.
- Paging is over products, sorted by name. `per_page` defaults to 25, maximum 200. `last_page` is `0` when the user has no products.

**Formats:**

- Read each rate's `unit` to interpret `amount`: `percent`, `per_sale`, `per_kw`, `per_watt`, `flat` or `custom_field`. With `custom_field`, a `custom_field_id` names the sale field the rate uses.
- `effective_date` is `YYYY-MM-DD`.

**Errors:**

- `400 Invalid user id`, `400 Invalid product_id`, `400 Bad Request: role must be one of closer, setter, self_gen`, `400 page must be a positive integer`, `400 per_page must be an integer between 1 and 200`, and `400 Invalid query parameter(s)` for any other query key.
- `404 User not found`.

**Related:**

- GET /v1/users/{id}/earnings shows what these rates produced.
- GET /v1/products lists the product catalog.

## Path parameters

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

## Query parameters

- `product_id` (integer): Limit to one product (`id` from GET /v1/products). Minimum: 1.
- `role` (string): Limit to one role. Case-insensitive. One of: `closer`, `setter`, `self_gen`.
- `page` (integer): Page number, over products. Default: `1`. Minimum: 1.
- `per_page` (integer): Products per page. Default: `25`. Minimum: 1. Maximum: 200.

## Example request

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

## Responses

### 200: The user's commission rates

- `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` (integer): User id.
    - `employee_id` (string, nullable): Employee id shown in Sequifi.
    - `first_name` (string): First name.
    - `last_name` (string): Last name.
    - `position_id` (integer, nullable): Position id.
    - `position_name` (string, nullable): Position name.
  - `current_page` (integer): Page returned.
  - `per_page` (integer): Products per page.
  - `total` (integer): Products across all pages.
  - `last_page` (integer): Last page number. `0` when there are no products.
  - `filters` (object, nullable): `product_id` and `role` as applied, or null.
  - `redlines` (array of object): One redline per role the user has a redline setting for.
    - `role` (string): Role. One of: `closer`, `setter`, `self_gen`.
    - `core_position_id` (integer, nullable): `2` closer, `3` setter, null self-gen.
    - `amount` (number, nullable): Redline value.
    - `unit` (string, nullable): Unit of `amount`.
    - `redline_type` (string, nullable): Redline type as set in Sequifi.
    - `effective_date` (string, nullable): Date the setting took effect, `YYYY-MM-DD`.
  - `commissions` (array of object): One group per product on this page.
    - `product` (object): `id`, `product_id` (your product code) and `name`.
    - `overrides` (object, nullable): Override rates: `direct`, `indirect`, `office` and `manager`, each `{amount, unit, tiered, effective_date}` or null. Null when the user has no override setting for the product.
    - `withheld` (object, nullable): Withheld setting `{amount, unit, effective_date}`, or null.
    - `roles` (array of object): Rates per role.
      - `role` (string): Role. One of: `closer`, `setter`, `self_gen`.
      - `core_position_id` (integer, nullable): `2` closer, `3` setter, null self-gen.
      - `commission` (object, nullable): Commission rate `{amount, unit, tiered, effective_date}`, plus `custom_field_id` when `unit` is `custom_field`. Null when not set.
      - `milestones` (array of object): Milestone payments `{name, amount, unit, trigger, effective_date}` in effect today.

```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"
    },
    "current_page": 1,
    "per_page": 25,
    "total": 1,
    "last_page": 1,
    "filters": {
      "product_id": 7
    },
    "redlines": [
      {
        "role": "self_gen",
        "core_position_id": null,
        "amount": 2.5,
        "unit": "per_watt",
        "redline_type": "Fixed",
        "effective_date": "2026-01-01"
      }
    ],
    "commissions": [
      {
        "product": {
          "id": 7,
          "product_id": "FIBER-500",
          "name": "Fiber 500"
        },
        "overrides": {
          "direct": {
            "amount": 1,
            "unit": "percent",
            "tiered": false,
            "effective_date": "2026-06-16"
          },
          "indirect": {
            "amount": 0.5,
            "unit": "percent",
            "tiered": false,
            "effective_date": "2026-06-16"
          },
          "office": null,
          "manager": null
        },
        "withheld": null,
        "roles": [
          {
            "role": "closer",
            "core_position_id": 2,
            "commission": {
              "amount": 85,
              "unit": "per_sale",
              "tiered": false,
              "effective_date": "2026-06-16"
            },
            "milestones": [
              {
                "name": "Milestone 1",
                "amount": 0,
                "unit": "percent",
                "trigger": "Install",
                "effective_date": "2026-06-16"
              },
              {
                "name": "Milestone 2",
                "amount": 85,
                "unit": "percent",
                "trigger": "Activation",
                "effective_date": "2026-06-16"
              }
            ]
          }
        ]
      }
    ]
  }
}
```

### 400: Invalid user id, query parameter, role, or paging value

Example (invalid_params): Unknown query parameter

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