Skip to main content
After you extract fields such as counterparties, renewal dates, and contract values from thousands of documents, store the results as metadata on each file in Box. The values stay attached to the document they came from, and you can search and filter them later with the Box Query API or in a no-code Box Apps view. Box Apps is available on Box Enterprise Advanced plans. This guide uses a contract example. You create a metadata template, extract fields into it with Box AI, write the values to each file, and then filter the files by renewal date and contract value.

Why store extracted fields as metadata

  • You don’t need a separate table that maps results to file IDs since you apply a metadata instance to a specific file.
  • You can filter by date ranges and numeric thresholds as template fields can be string, float, date, enum, multiSelect, or taxonomy. See .
  • Access follows Box permissions. Collaborators who can view an item can view its metadata, and collaborators with upload permission can edit the values. See Using metadata on Box Support.
  • Box search indexes the values. People can also filter search results by template in the Box web app.
  • Box AI fills the same template. When you pass a metadata template to Box AI, it returns values under the template’s field keys.

Before you start

You need:
  • A Box app with the Read and write all files and folders stored in Box and Manage AI scopes. See .
  • Admin permission to create the metadata template. Only admins, and co-admins with rights to create and edit metadata templates, can create templates.
  • The ID of the folder that holds your documents.

Create a metadata template for the fields

Use date for dates and float for amounts so you can filter by range. Use enum for fields with a fixed set of values.
Box creates the template in your enterprise scope, enterprise_<ENTERPRISE_ID>. The query examples in this guide write it as enterprise_${ENTERPRISE_ID}. To find your scope, . Admins can also create templates in the Admin Console. See Customizing metadata templates.

Extract the fields with the template

Call with the template instead of a list of fields. The answer object in the response holds the values under the template’s field keys. The response also includes ai_agent_info, created_at, and completion_reason. Box AI leaves out fields it can’t find, and returns an empty answer when the file contains none of them.
To process thousands of files, call the endpoint once per file. A request with several files returns one combined answer. See and .
To extract and store fields without code, use a Custom Extract Agent in Box Extract. The agent processes files in its assigned folders and saves the values as metadata. Custom Extract Agents are available on Enterprise Advanced plans. See Using Box Extract.

Write the values to the file

Send the answer object to . Box returns 201 Created with the new metadata instance.
Metadata date fields store RFC 3339 timestamps. Box AI returns dates in this format when you extract with a template, so you can write them without conversion.
If the file already has an instance of the template, for example when you extract a file again, Box returns 409 Conflict. Update the instance with and a JSON Patch body. The add operation sets each value whether or not the field already has one.
For Python and TypeScript code that runs this create-or-update pattern on every upload, see .

Filter the files with the Box Query API

Call the to find files by their metadata values. This request finds contracts in a folder and its subfolders that renew in the first quarter of 2027 and are worth at least 100,000, sorted by renewal date.
Each entry includes the file id, which you can use to or show it in .
  • In predicate, reference template fields as <scope>:<templateKey>:<fieldKey> and item fields as box:item:<field>. For operators, see .
  • Each value in params must match its field type. Use a number for a float field and an RFC 3339 timestamp for a date field.
  • limit can be up to 100. When next_marker isn’t null, pass it as marker in the next request and keep the other parameters the same.
Matches on string fields are case sensitive. Use ILIKE to ignore case, and add % wildcards to match part of a value. Values for enum fields must match an option key exactly. To find files where Box AI didn’t return a value, use EXISTS(:template) AND enterprise_${ENTERPRISE_ID}:contract:contractValue IS NULL with "template": "enterprise_${ENTERPRISE_ID}:contract" in params.

Get totals with the Box Query Insights API

To get totals instead of a list of files, send a predicate to . This request sums the value of contracts that renew in the first quarter of 2027.
For totals per group, such as per contract type, see .

Choose an API for finding files by metadata

Give your team a filterable view in Box Apps

If the people who work with the contracts don’t write code, build a Box App on the same template. Box Apps is a no-code builder for apps based on metadata. A View block is a saved search based on one template, and the template’s fields become the view’s filters and columns. Box Apps is available on Box Enterprise Advanced plans.
  1. A Box Admin enables Box Apps in Admin Console > Enterprise Settings > Content & Sharing, and chooses who can use Box Apps and who can manage apps. See Enabling Box Apps.
  2. In Box Apps, select New App and name the app.
  3. Add a View block, enter a view name, and choose the template, for example Contract. You can’t change the template after you create the view. See Creating an app.
  4. Open the view and select Edit. On the Filters tab, choose the fields people can filter by, such as Renewal date and Contract value. On the Columns tab, choose the columns to show, then select Save. See Configuring View in Box Apps.
  5. Share the app with your team. People with Viewer access can’t change the app.
In the view, people can sort by columns that support sorting and export the metadata to a CSV file of up to 100,000 items. If an admin enables Box AI for files, they can also filter the results with a Box AI prompt. They can also correct values Box AI got wrong. Inline editing works when the app allows it, and Box Apps Managers can edit several files at once. See Managing metadata in Box Apps. To show a total, such as the combined value of the contracts in a view, add a Metric block. It calculates the sum, average, maximum, minimum, or item count of a numeric field for the items in a linked view. App permissions control what people can do with the app. The files and metadata they see in it respect the permissions they already have in Box. See Box Apps permissions.

Embed a metadata view in your own app

To show a filterable list of files and their metadata in your own web app, use the Content Explorer metadata view. It takes a Metadata Query API definition and gives each template field filter and edit controls for its type. See .

Limits to plan for

  • The Box Query API returns 403 Forbidden when a query matches too many items, or too many items the user can’t access. Narrow the query with ancestors and a more specific predicate.
  • The Box Query API returns 429 Too Many Requests when your enterprise exceeds the allowed request rate. Wait and retry. See .
Last modified on December 3, 2026