Box search (GET /search): full-text and metadata search over names, descriptions, file content, comments and tags, with filters.

Rate limits. Box allows 6 searches per second and 60 per minute per user, and 12 per second per enterprise, on top of the general 1,000 calls per minute per user. A 429 comes back as an HttpError with retry-after; ::box::api/is-retryable is true for it. search-all makes one call per page, so cap it with a limit.

Indexing. New and changed files take a few minutes to appear in results (content is indexed after upload), and offset paging stops at 10,000 results.

Values

DEFAULT_LIMIT

DEFAULT_LIMIT: Int 100

MAX_LIMIT

MAX_LIMIT: Int 200

MAX_OFFSET

MAX_OFFSET: Int 10000

Functions

encode-mdfilters

fn (value: Any): Str?

The mdfilters query value (pure): a JSON array of filters. Accepts one filter Map or a Vec (Box allows exactly one).

Example

filter-map ::box::search/md-filter("enterprise", "contract", {status: "signed"})
length(from-json(::box::search/encode-mdfilters(filter-map)))  // 1
::box::search/encode-mdfilters(null)  // null

md-filter

fn (scope: Str, template-key: Str, filters: Map): Map

One metadata filter for mdfilters (pure): {scope, templateKey, filters}. scope is "enterprise" (or "enterprise_<id>") or "global"; filters maps template field keys to a value, a {gt, lt} range for numbers and dates, or a Vec for multi-select (any of).

::box::search/md-filter("enterprise", "contract", {status: "signed", amount: {gt: 10000}})
fn (query: Str): Map
fn (opts: Map): Map
fn (query: Str?, opts: Map): Map

GET /search - one page of results: {entries, total_count, offset, limit}. Pass a query Str, or an opts Map (with query and/or mdfilters), or both. Box needs a query or mdfilters.

page ::box::search/search("quarterly report", {
  file_extensions: ["pdf", "docx"],
  ancestor_folder_ids: ["12345"],
  content_types: ["name", "file_content"],
  updated_at_range: ["2026-01-01T00:00:00Z", ""],
  limit: 50
})
page.entries

search-all

fn (query: Str?, opts: Map): Vec
fn (query: Str?, opts: Map, limit: Int?): Vec

Every search result (offset paging, limit 200 per call), or at most limit, stopping at Box's 10,000-offset cap. Each page is one search call against the 6-per-second / 60-per-minute per-user limit, so pass a limit.

hits ::box::search/search-all("invoice", {type: "file", file_extensions: ["pdf"]}, 400)

search-params

fn (query: Str?, opts: Map): Map

The query parameters search sends (pure). query may be null when opts.mdfilters is set. Defaults: limit 100, fields = ::box/ITEM_FIELDS. Array filters take a Vec or a comma-separated Str: file_extensions (["pdf", "docx"], no dots), ancestor_folder_ids, content_types (name, description, file_content, comments, tags), owner_user_ids, created_at_range / updated_at_range ([from, to] RFC 3339; either may be ""), size_range ([min, max] bytes). Scalars: type (file, folder, web_link), scope (user_content; enterprise_content must be enabled by Box support), trash_content, sort (relevance, modified_at), direction, offset, include_recent_shared_links. mdfilters takes a md-filter Map.

Example

params ::box::search/search-params("invoice", {limit: 10, file_extensions: ["pdf"]})
params.query  // "invoice"
params.limit  // 10
params.file_extensions  // ["pdf"]