Learning resourcesReviewed · xAI

xAI Collections: Metadata Fields

Metadata Fields is xAI's guide for developers organizing and searching document collections, but it contradicts itself about how combined search conditions are grouped. It explains required and unique fields, adding metadata to embedding chunks, and filtering document searches. Explicit parentheses avoid relying on the conflicting guidance; actual API behavior and retrieval improvements were not assessed.

Researched 24 Nov 2026

In short.

Metadata Fields is an xAI guide for developers adding attributes to searchable document collections, but conflicting filter guidance requires care when combining conditions. It documents collection-level field rules, metadata uploads, contextual information for embedding chunks and filtered searches. The examples distinguish management credentials from search credentials. Two practical cautions matter: the sample makes year unique, allowing only one document per year under the documented rule, and the page gives contradictory statements about AND and OR precedence. No API requests were executed, and pricing, retrieval quality and production reliability remain unknown.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete page at [https://docs.x.ai/developers/files/collections/metadata.md]: field definitions, upload and search examples, operator tables, quoting examples, warnings and quick reference. It includes both conflicting precedence statements and the sample year uniqueness constraint. Linked pages are excluded. Pricing, service terms, account configuration and undocumented API semantics remain unknown. No commands or API requests were executed, so runtime behavior, retrieval quality and operational reliability were not assessed.

The overview

Identity

Metadata Fields is a documentation page in xAI's Files & Collections material at [https://docs.x.ai/developers/files/collections/metadata.md]. It teaches a specific API feature: attaching structured attributes to collection documents and using those attributes during retrieval. It is a learning resource for an existing service.

Assessment

The page offers useful implementation detail for three connected tasks: declaring metadata rules, supplying document values and restricting search results. Its request examples and operator reference give developers a concrete starting point. However, its conflicting precedence guidance and unexplained numeric-versus-string comparison behavior leave important details unresolved. The claimed retrieval benefit from contextual metadata has no supporting measurements on this page.

Users

The guide fits developers building document search that needs restrictions such as author, year, department or status. It also helps developers whose document chunks need contextual information, such as a title. Beginners receive a create-upload-search sequence, but the page assumes familiarity with HTTP requests, JSON, credentials and local file uploads. Experienced developers will need additional documentation for operational limits and detailed field semantics.

Capabilities

Collection field definitions support required values, uniqueness across documents and prepending a field's value to every embedding chunk. All three options default to false. Uploads supply metadata through a JSON object in the fields parameter.

Search filters use AIP-160 syntax with equality, inequality, comparison operators, AND, OR and parentheses. The examples cover ranges and nested conditions. Strings containing spaces can use single or double quotes; simple values appear without quotes in some examples.

Using it

Requirements

The examples use curl, JSON requests and multipart uploads. Reproducing the upload example also requires a readable local PDF. Collection creation and document upload use XAI_MANAGEMENT_API_KEY with management-api.x.ai; document search uses XAI_API_KEY with api.x.ai. Search requires the collection identifier. Credential provisioning, permission scopes and account eligibility are not explained.

Mechanism

The field_definitions array declares collection-level metadata rules. A required field must accompany document uploads, while a unique field permits only one document with a given value. The inject_into_chunk option prepends the metadata value to each embedding chunk, giving the embedded text additional context.

Filtered search sends a query, collection identifiers and a filter string to [https://api.x.ai/v1/documents/search]. The filter restricts eligible documents through metadata conditions. Chunk injection and filtering serve different purposes: one adds context to embedded content, while the other constrains which documents can match. Their internal execution details are not described.

Setup

Create a collection through [https://management-api.x.ai/v1/collections], supplying a collection_name and field_definitions. Upload documents through [https://management-api.x.ai/v1/collections/{collection_id}/documents], including the document name, file, content type and metadata fields. Then submit a search using the collection identifier and a filter.

Choose constraints to match the intended documents before copying the example. Its unique setting on year would prevent multiple documents from sharing a year under the documented rule. Use parentheses in mixed AND and OR expressions, and keep uploaded metadata keys consistent with the collection definitions. Response handling and a complete credential setup procedure are not provided.

Example

The page creates a research_papers collection with author and year required, year unique and title injected into chunks. It uploads paper.pdf with author Sandra Kim, year stored as the JSON string "2024", and title Q3 Revenue Analysis. Its search example asks for revenue growth with the filter author="Sandra Kim" AND year>=2020. These are documentation examples; no successful responses or search results are supplied, and nothing was executed.

Assessment & evidence

Limitations

Wildcard matching is unsupported, and string comparisons are exact. The page warns that filtering on fields absent from documents returns no results. It does not explain case sensitivity, missing-value behavior inside compound expressions, field types or numeric coercion. That last gap matters because year is uploaded as a string but compared with an unquoted number.

The precedence instructions conflict: a note says AND has higher precedence than OR, while a later example comment says OR has higher precedence than AND. Explicit parentheses make intended grouping clear, but actual parser behavior remains unverified. Field-count limits, metadata size limits, schema changes and error responses are not covered.

Reasoning

The documented features address separate needs. Filters express restrictions such as an author or date range. Metadata injection can add context that an isolated chunk would otherwise lack. Required fields support completeness, and uniqueness should be reserved for values that genuinely must identify only one document. The one-document-per-year consequence follows from applying the documented uniqueness rule to the sample schema; it was not observed in a live request.

Alternatives

Within the documented feature set, developers can use filters, metadata injection or both, depending on whether they need document restrictions, additional chunk context or both. The options are independently configurable. The page provides no comparison with another retrieval service or library, so relative performance, portability and cost are not assessed.

Evidence

The source is the complete Metadata Fields page at [https://docs.x.ai/developers/files/collections/metadata.md]. It contains API request examples, field-option descriptions, operator tables and explicit warnings. These establish the documented interface and its stated constraints. The page supplies no observed API responses, benchmarks, retrieval evaluations or reliability measurements.

Access & freshness

Costs

The page provides no prices, billing units, free allowance or quotas. Costs for collection storage, document processing, embeddings and searches are unknown. Whether injected metadata changes billed usage is also unknown, so this page does not support a budget estimate.

Rights

The page states no documentation license or redistribution permission. It also does not establish rights governing uploaded documents or terms for the service's use of their contents. Those permissions and terms remain unknown from this resource.

Freshness

The documentation capture is dated 2026-11-24T00:34:19.641Z. The page supplies no publication date, update date or change history. Its API examples use v1 routes, which does not establish a documentation release version. Changes after the capture and present service behavior are unknown.

Actions

Before implementation, choose metadata fields and constraints that fit the documents, especially whether values may repeat. Group mixed logical conditions explicitly. Confirm numeric-versus-string comparisons, absent-field behavior and constraint failures with a small controlled collection before depending on them in an application. If chunk injection is intended to improve retrieval, compare results with and without it on representative queries. Obtain pricing, credential guidance and applicable terms separately; none of these checks or experiments has been performed here.

Evidence for this report

selected-page.txtselected · checked 2026-11-24