Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(search): document the bound on dateFrom and dateTo

Yudhi Armyndharis50b9aec061ba
diff --git a/docs/06-api-specification.md b/docs/06-api-specification.md
index 6053c8ba1..cc3703bf4 100644
--- a/docs/06-api-specification.md
+++ b/docs/06-api-specification.md
@@ -6523,8 +6523,8 @@ Search messages across sessions (active search provider).
| `direction` | enum (`incoming` \| `outgoing`) | No | — | Filter by message direction. |
| `type` | string | No | — | Filter by stored message `type` (e.g. `text`, `image`, `video`). Compared against `messages.type`; not an enum validation, any string is accepted and unmatched values simply return no hits. |
| `from` | string | No | — | Filter by sender; matches `from` or a group message's `author`. A phone also matches any lid that resolves to it. |
-| `dateFrom` | integer (epoch ms) | No | — | Inclusive lower bound on `timestamp`. A non-numeric value is rejected with `400`. |
-| `dateTo` | integer (epoch ms) | No | — | Inclusive upper bound on `timestamp`. A non-numeric value is rejected with `400`. |
+| `dateFrom` | integer (epoch ms) | No | — | Inclusive lower bound on `timestamp`. Must be between -9007199254740991 and 9007199254740991; a non-numeric or out-of-range value is rejected with `400`. |
+| `dateTo` | integer (epoch ms) | No | — | Inclusive upper bound on `timestamp`. Must be between -9007199254740991 and 9007199254740991; a non-numeric or out-of-range value is rejected with `400`. |
| `limit` | integer (≥ 1) | No | `50` | Max hits to return. Clamped to `SEARCH_LIMIT_MAX` (default `100`). A non-integer value is rejected with `400`. |
| `offset` | integer (≥ 0) | No | `0` | Pagination offset, at most `100000`. A non-integer or larger value is rejected with `400`. |
@@ -6563,7 +6563,7 @@ Search messages across sessions (active search provider).
scores are not comparable). The built-in provider on SQLite leaves it out for a key restricted to
selected sessions or chats, since it is computed over the whole index.
-**Errors:** `400` empty/whitespace `q`, a non-numeric `dateFrom`/`dateTo`/`limit`/`offset`, an `offset` above `100000`, or a malformed
+**Errors:** `400` empty/whitespace `q`, a non-numeric `dateFrom`/`dateTo`/`limit`/`offset`, a `dateFrom`/`dateTo` beyond 9007199254740991 in either direction, an `offset` above `100000`, or a malformed
SQLite FTS5 query (unbalanced quote/paren, bare operator) — Postgres's `websearch_to_tsquery` is
tolerant and has no equivalent · `401` missing/invalid `X-API-Key` · `403` key role below `OPERATOR`, or a chat-restricted key
that names a `chatId` outside its allowlist or uses a plugin provider ·
diff --git a/docs/26-global-search.md b/docs/26-global-search.md
index 399d4a3e5..7204f08d6 100644
--- a/docs/26-global-search.md
+++ b/docs/26-global-search.md
@@ -136,7 +136,8 @@ GET /api/search?q=<term>&sessionId=<id>&chatId=<id>&direction=<incoming|outgoing
- **`q`** is required and must be non-empty (whitespace-only is rejected with `400`, and so is one
longer than 1000 characters or with more than 32 words, punctuation separating words as whitespace does and a symbol or emoji that stands apart counting as one; a whitespace-separated word said again counts once). Numeric params
are coerced and validated; a non-numeric `limit`/`offset`/`dateFrom`/`dateTo` surfaces as `400`,
- never as a `NaN` SQL parameter.
+ never as a `NaN` SQL parameter, and so does a `dateFrom`/`dateTo` beyond 9007199254740991 in either direction
+ (no timestamp reaches it, and PostgreSQL would reject the bound as an overflow).
- **Auth scoping is authoritative.** The caller's API-key `allowedSessions` is injected by
`SearchService` — **never** accepted from the query — so a scoped key cannot broaden its reach. A
key with a non-empty `allowedSessions` searches only those sessions, whatever its role, even if it