Skip to content
Skip to Content
Docs
ApiOrg

Create Org Search Token

Mints one short-lived, independently-scoped Typesense search token per collection the caller is authorized to search. Combine the returned host/port/protocol with each entries[name]'s token/collection/query to query Typesense directly from the client — no per-keystroke request to this API.

POST
/org/search-token

Request Body

application/json
  1. body

Optional mint-request body — every field is optional and defaults apply.

Everything except market derives from the authenticated context; this model exists only to carry market, which cannot be derived server-side (unlike org_id/member_id).

market?|

Market to scope ingredient search to, mirroring searchIngredients' market parameter (ADR 0007's approved_markets gate). If the caller is entitled to ingredient search but omits this, the response degrades to whatever else the caller is entitled to rather than including an incorrectly-scoped ingredients grant. An empty string is rejected as a 422 (not a valid CountryCode value), not treated as an omitted field.

Response Body

Successful Response

application/json
  1. response

Per-caller org search tokens, one independent entry per searchable collection.

entries carries a key only for each collection the caller is entitled to search — the client must not attempt to query a collection missing from this map; each entry's own token will reject such a request even if the client tries.

host*Host

Typesense host to connect to directly.

port*Port

Typesense port to connect to directly.

protocol*Protocol

Typesense connection protocol (e.g. 'https').

entries*

One entry per collection the caller is entitled to search — keys are a subset of {'recipes', 'ingredients', 'ingredients_library', 'usda_ingredients', 'usda_bf_products'}. 'ingredients' and 'ingredients_library' mint against the same collection; only 'ingredients' excludes draft/archived status.

routing_fields?array<string>

Keys that may appear inside query but must NOT be forwarded to Typesense. They select between other keys rather than being query parameters, so sending one is a rejected search. A client that reads this needs no release when the set changes.

Example Request
curl -X POST 'https://api.bettermenu.live/org/search-token' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "host": "string",  "port": 0,  "protocol": "string",  "entries": {    "property1": {      "token": "string",      "collection": "string",      "expires_at": 0,      "query": {        "query_by": "string",        "sort_by": "string",        "num_typos": 0,        "prefix": true,        "per_page": 0,        "query_by_weights": "string",        "include_fields": "string",        "highlight_fields": "string",        "prioritize_exact_match": true,        "drop_tokens_mode": "string",        "single_token_sort_by": "string",        "single_token_num_typos": 0      }    },    "property2": {      "token": "string",      "collection": "string",      "expires_at": 0,      "query": {        "query_by": "string",        "sort_by": "string",        "num_typos": 0,        "prefix": true,        "per_page": 0,        "query_by_weights": "string",        "include_fields": "string",        "highlight_fields": "string",        "prioritize_exact_match": true,        "drop_tokens_mode": "string",        "single_token_sort_by": "string",        "single_token_num_typos": 0      }    }  },  "routing_fields": [    "string"  ]}

Recipe in, FDA-format Nutrition Facts out, with every version kept.

Start freeNo card needed.