# Call Later

> Base URL: `https://pos.pages.fm/api/v1`. Authenticate with the `api_key` query parameter.

## List of call later and remind

`GET /shops/{SHOP_ID}/order_call_laters`

Get list of call later and remind

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |
| `page_number` | query | integer |  | Page number |
| `page_size` | query | integer |  | Page size |
| `key` | query | string |  | Quick filter: `today` (scheduled today), `upcoming` (scheduled after today), `overdue` (scheduled before now), `completed` (successfully processed). Omit this parameter to filter only by the time range. If provided, it is combined with the time filters (AND). Values: `today`, `upcoming`, `overdue`, `completed`. |
| `filter_by_time` | query | string |  | Time filter as a JSON-encoded object. Send as a single query parameter (URL-encode the JSON), not nested query parameters. - `type`: `inserted_at` (creation time, default), `called_at` (processed time; excludes unprocessed reminders), or `appointment_time` (scheduled call time, field `needs_call_at`). - `start_time`, `end_time`: integer Unix timestamps in seconds (UTC), both required for the filter to apply. Both bounds are inclusive. Convert the desired local date range to Unix timestamps before sending. - `editor_ids`: array of user IDs, required when filtering by time. Use `["-1"]` for all staff. Filters by the last editor for `called_at`, otherwise by the creator. Examples below cover October 15, 2026, 00:00:00–23:59:59 in UTC+7. |
| `start_needs_call` | query | integer (int64) |  | Inclusive start of the scheduled call time range (`needs_call_at`), as a Unix timestamp in seconds. Must be sent with `end_needs_call`. Combined with other filters (AND). |
| `end_needs_call` | query | integer (int64) |  | Inclusive end of the scheduled call time range (`needs_call_at`), as a Unix timestamp in seconds. Must be sent with `start_needs_call`. |
| `status` | query | integer |  | Status Values: `-1` All status, `0` No process, `3` Calling / Processing, `1` Processed, `2` Not listening / Unsuccessful, `7` Removed. |

### Responses

- `200` Success (object)

```json
{
  "success": true,
  "data": [
    {
      "called_at": "2024-01-30T01:54:17",
      "creator": {
        "avatar_url": null,
        "email": "vuson897654@gmail.com",
        "fb_id": "377936050731194",
        "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
        "name": "Vũ Sơn",
        "phone_number": null
      },
      "display_id": 70,
      "id": "1885d8d4-e210-4e56-bb32-683988a032f5",
      "need_notify_users": [
        "cee3c05e-5f85-43c4-b27e-889b99c50097"
      ],
      "needs_call_at": "2024-01-30T02:20:48",
      "notice_created": "Gọi lại cho khách",
      "order_display_id": "SOICUN-12943-02",
      "order_id": 106703,
      "status": 1,
      "type": "call"
    }
  ],
  "key": "today",
  "page_number": 1,
  "page_size": 30,
  "total_entries": 3,
  "total_pages": 1
}
```

## Create call later and remind

`POST /shops/{SHOP_ID}/order_call_laters`

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |

### Request body

Request body containing call later and remind information

- `order_call_later` (object, required): 
  - `status` (integer): Status
  - `need_notify_users` (string[]): Process staff
  - `notice_created` (string): Notice information
  - `needs_call_at` (string (date-time), required): Need call at
  - `phone_number` (string, required): Phone number
  - `order_ids` (string[]): Order IDs

```json
{
  "order_call_later": {
    "status": 0,
    "need_notify_users": [
      "cee3c05e-5f85-43c4-b27e-889b99c50097"
    ],
    "notice_created": "Gọi lại xác nhận",
    "needs_call_at": "2024-08-29T05:50:31.700Z",
    "phone_number": "0929911922",
    "order_ids": [
      "106703"
    ]
  }
}
```

### Responses

- `200` Success (object)

```json
{
  "success": true
}
```
