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

# List worker documents

`GET https://{apiId}.execute-api.us-west-1.amazonaws.com/{stage}/v1/documents`

Module: Documents · operationId: `listDocuments` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequipay.com/#/api/list-documents

Returns the authenticated company's worker-document records, paginated, grouped by worker then by document type. Filter by `employee_id` to get one worker's documents. Returns document METADATA only — never the document files, the tax/withholding election detail, or the signer's IP, and never owner KYC identity documents. Soft-deleted documents are never returned.

Requires the `documents:read` scope.

## Query parameters

- `employee_id` (integer (int64)): Exact match on the employee id. Minimum: 1. Example: `1024`.
- `document_type` (string): Exact match on the document type. Example: `w4`.
- `completed` (boolean): Filter by completion. Truthy values (`1`, `true`, `yes`) return only completed documents; falsy values return only incomplete ones. Example: `true`.
- `page` (integer): 1-based page number. Default: `1`. Minimum: 1.
- `per_page` (integer): Page size (max 200). Default: `20`. Minimum: 1. Maximum: 200.

## Example request

```bash
curl -X GET "https://{apiId}.execute-api.us-west-1.amazonaws.com/{stage}/v1/documents" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN"
```

## Responses

### 200: A page of worker documents.

- `status` (integer) Example: `200`.
- `message` (string) Example: `success`.
- `data` (object)
  - `documents` (array of object)
    - `id` (integer (int64)) Example: `1`.
    - `employee_id` (integer (int64)) Example: `1024`.
    - `document_type` (string) Example: `w4`.
    - `document_version` (string) Example: `2024`.
    - `signer_name` (string, nullable) Example: `Jane Doe`.
    - `completed` (boolean) Example: `true`.
    - `completed_at` (string (date-time), nullable) Example: `2024-01-20T12:00:00.000Z`.
    - `created_at` (string (date-time), nullable) Example: `2024-01-20T12:00:00.000Z`.
    - `updated_at` (string (date-time), nullable) Example: `2024-01-20T12:00:00.000Z`.
  - `current_page` (integer) Example: `1`.
  - `per_page` (integer) Example: `20`.
  - `total` (integer) Example: `3`.
  - `last_page` (integer) Example: `1`.
  - `filters` (object): Echoes the filters actually applied.

### 401: Missing, invalid, expired, or revoked token (from the authorizer).

### 403: The token lacks the required scope.

```json
{
  "error": "insufficient_scope",
  "required": "users:read"
}
```

### 500: An infrastructure or data error. The endpoint fails closed — a 500, never a partial or empty-looking result.

```json
{
  "status": 500,
  "message": "internal error",
  "data": null
}
```
