search.similar
Messages similar to one message.
'More like this': the message's own embedding is the query. The message must already be embedded (semantic search on, and the backfill has reached it) — otherwise 409 not_embedded with the current floor, which is the prompt to lower it (PATCH /identities/:id { semanticFloor }). The read path never embeds inline.
openemail.search.similar(
mailboxId: string,
messageId: string,
options?: SearchSimilarOptions,
): ApiPromise<SimilarMessagesResult>It calls GET /mailboxes/{mailboxId}/messages/{messageId}/similar: Messages similar to one message in the API reference.
Example
const similarMessagesResult = await openemail.search.similar(mailboxId, messageId)Arguments
| Argument | Type | Description |
|---|---|---|
mailboxId | string | Mailbox ULID identifier. The path's {mailboxId}. |
messageId | string | Message ULID. The path's {messageId}. |
Options
The last argument, options, a SearchSimilarOptions, takes:
| Option | Type | Sent as | Description |
|---|---|---|---|
limit | number | query limit | Maximum messages to return (default 10, max 50) |
since | number | query since | Only mail received at or after this epoch second |
before | number | query before | Only mail received before this epoch second |
Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
Awaited, it is the API's JSON, SimilarMessagesResult. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.
Errors
| Status | What it means |
|---|---|
400 | validation_failed — a malformed limit, since or before |
401 | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge |
404 | Mailbox or message not found, or not accessible to this principal |
409 | semantic_not_enabled — the mailbox has not opted in, or its account lacks the plan gate; or not_embedded — the index holds no vector for the message (below the floor, the backfill has not reached it, or its upsert has not landed); the body carries semanticFloor |
429 | rate_limited |
503 | semantic_unavailable (transient, with Retry-After) or semantic_misconfigured (permanent, without). Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.
Types
It names these types of the API, each on a page of its own: SimilarMessagesResult.