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

# List positions

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

Module: Positions · operationId: `listPositions` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/list-positions

Returns your company's active positions in id order (oldest first), with each position's department, permission group, pay frequency and child positions. Use it to map position names to the `position_id` that onboarding and position changes take. Inactive positions and built-in system positions are never returned, so a `position_id` or `sub_position_id` on a user may not appear here.

**Filtering and paging:**

- All filters are optional and combine with AND. Any other query parameter returns `400`.
- `position_name` is a case-insensitive "contains" match. `%` and `_` act as wildcards.
- `frequency_type_id` returns positions paid on that pay frequency (ids from `GET /v1/pay-frequency`).
- `department_id` and `group_id` match the position's department and permission group ids.
- `reconciliation` returns positions with at least one reconciliation setting whose override settlement equals the text you send, for example `Reconciliation`. Not case-sensitive.
- Filter values are not validated. A value that matches nothing (including a non-numeric id) returns `200` with an empty list.
- `per_page` defaults to 50 and has no upper limit. A value that is not a positive number is quietly replaced by 50.
- `page` starts at 1. `0` or a non-number is read as 1. A negative `page` returns `500`, so always send a positive whole number.
- Results are ordered by `id`, oldest first (the opposite of users and locations). A page past the end returns an empty `positions` array, and `last_page` is `0` when nothing matches. The response has no `filters` key.

**Formats:**

- `status` is always `1`, because only active positions are returned.
- `is_selfgen`: `0` none, `1` self-gen, `2` closer, `3` setter.
- `worker_type` is text such as `1099` or `w2`. Compare it case-insensitively.
- `peoples_count` counts users of every status assigned to the position, including terminated and dismissed users.
- From `pay_frequency`, use `frequency_type_id` and `frequency_type_name`. Its other fields are internal schedule settings; read pay schedules from `GET /v1/pay-frequency` instead.
- `deduction_limit` and `reconciliation` hold one setting or `null`. A position can have several (per product or per date), but only one is returned and which one is not defined, so do not rely on them.
- Nested objects carry extra internal fields that are not listed here. Do not depend on them.
- The metadata key is `requested_by` (snake_case).

**Errors:**

- `400` `Invalid query parameter(s)`, with `invalid_params` and `allowed_params` in `data`.
- `401` when the token is missing, malformed, expired or revoked. It is rejected before the request is processed, so the body is only `{"message":"Unauthorized"}`, with no `status` or `data`.

**Related:**

- `GET /v1/positions/{id}` returns one position.
- `POST /v1/users/{id}/position` and `POST /v1/onboarding` take a `position_id` from this list.

## Query parameters

- `position_name` (string): Case-insensitive "contains" match on the position name. Example: `manager`.
- `frequency_type_id` (integer): Pay frequency id, from `GET /v1/pay-frequency`. Example: `1`.
- `department_id` (integer): Department id (`department.id` on a position). Example: `1`.
- `reconciliation` (string): Override settlement value of any of the position's reconciliation settings, for example `Reconciliation`. Not case-sensitive. Example: `Reconciliation`.
- `group_id` (integer): Permission group id (`group.id` on a position). Example: `2`.
- `per_page` (integer): Positions per page. No upper limit. Values that are not a positive number become 50. Default: `50`. Minimum: 1. Example: `50`.
- `page` (integer): Page number, starting at 1. Send a positive whole number; a negative value returns 500. Default: `1`. Minimum: 1. Example: `1`.

## Example request

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

## Responses

### 200: A page of active positions

- `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)
  - `requested_by` (string): Name of the API credential your token belongs to.
  - `current_page` (integer): The page returned.
  - `per_page` (integer): Page size used.
  - `total` (integer): Positions matching the filters, across all pages.
  - `last_page` (integer): Number of the last page. 0 when nothing matches.
  - `positions` (array of object): Positions on this page, oldest first.
    - `id` (integer): Position id. Use it as `position_id` or `sub_position_id` elsewhere.
    - `position_name` (string): Position name.
    - `parent_id` (integer, nullable): Id of the position this one sits under, or null.
    - `org_parent_id` (integer, nullable): Id of the position above this one in the org chart, or null.
    - `is_manager` (integer): 1 for a manager position.
    - `status` (integer): Always 1 (active).
    - `worker_type` (string, nullable): Worker type, such as `1099` or `w2`.
    - `is_selfgen` (integer): 0 none, 1 self-gen, 2 closer, 3 setter. One of: `0`, `1`, `2`, `3`.
    - `peoples_count` (integer): Users assigned to this position, counting every status.
    - `group` (object, nullable): Permission group.
      - `id` (integer): Group id. Filter with `group_id`.
      - `name` (string): Group name.
    - `department` (object, nullable): Department.
      - `id` (integer): Department id. Filter with `department_id`.
      - `name` (string): Department name.
    - `pay_frequency` (object, nullable): How often the position is paid. Use only the two fields below.
      - `frequency_type_id` (integer): Pay frequency id, as in `GET /v1/pay-frequency`.
      - `frequency_type_name` (string): Pay frequency name, for example `Weekly`.
    - `deduction_limit` (object, nullable): One deduction limit setting, or null. Not reliable when the position has several.
    - `reconciliation` (object, nullable): One reconciliation setting, or null. Not reliable when the position has several.
    - `child_positions` (array of object): Active positions whose `parent_id` is this position.
      - `id` (integer): Child position id.
      - `parent_id` (integer): This position's id.
      - `position_name` (string): Child position name.
      - `is_manager` (integer): 1 for a manager position.
      - `setup_status` (integer): Always 1 (active).
      - `group_id` (integer, nullable): Permission group id.

Example (positions): Active positions

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "requested_by": "acme",
    "current_page": 1,
    "per_page": 50,
    "total": 12,
    "last_page": 1,
    "positions": [
      {
        "id": 4,
        "parent_id": null,
        "org_parent_id": null,
        "position_name": "Sales Manager",
        "is_manager": 1,
        "status": 1,
        "worker_type": "1099",
        "is_selfgen": 0,
        "peoples_count": 5,
        "group": {
          "id": 2,
          "name": "Sales",
          "position_id": 4
        },
        "pay_frequency": {
          "frequency_type_id": 1,
          "frequency_type_name": "Weekly",
          "position_id": 4
        },
        "department": {
          "id": 1,
          "name": "Sales",
          "parent_id": null,
          "position_id": 4
        },
        "deduction_limit": null,
        "reconciliation": null,
        "child_positions": [
          {
            "id": 10,
            "parent_id": 4,
            "position_name": "Sales Rep",
            "is_manager": 0,
            "setup_status": 1,
            "group_id": 2
          }
        ]
      }
    ]
  }
}
```

Example (no_positions): Nothing matches the filters

```json
{
  "status": 200,
  "message": "success",
  "data": {
    "requested_by": "acme",
    "current_page": 1,
    "per_page": 50,
    "total": 0,
    "last_page": 0,
    "positions": []
  }
}
```

### 400: Unknown query parameter

```json
{
  "status": 400,
  "message": "Invalid query parameter(s)",
  "data": {
    "invalid_params": [
      "search"
    ],
    "allowed_params": [
      "position_name",
      "frequency_type_id",
      "department_id",
      "reconciliation",
      "group_id",
      "page",
      "per_page"
    ]
  }
}
```

### 401: Missing, malformed, expired or revoked token. Rejected before processing, so the body has only `message`.

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

### 500: Internal server error, including a negative `page`

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