Repository Public
1<!-- source: https://docs.x.ai/developers/files/collections (from https://docs.x.ai/llms-full.txt, retrieved 2026-09-19T05:28:55Z) -->2#### Files & Collections34# Collections56Collections offers xAI API users a robust set of tools and methods to seamlessly integrate their enterprise requirements and internal knowledge bases with the xAI API. Whether you're building a RAG application or need to search across large document sets, Collections provides the infrastructure to manage and query your content.78> [!NOTE]9>10> **Looking for Files?** If you want to attach files directly to chat messages for conversation context, see [Files](/developers/files). Collections are different—they provide persistent document storage with semantic search across many documents.1112## Core Concepts1314There are two entities that users can create within the Collections service:1516* **File** — A single entity of a user-uploaded file.17* **Collection** — A group of files linked together, with an embedding index for efficient retrieval.18 * When you create a collection you have the option to automatically generate embeddings for any files uploaded to that collection. You can then perform semantic search across files in multiple collections.19 * A single file can belong to multiple collections.2021## What You Can Do2223With Collections, you can:2425* **Create collections** to organize your documents26* **Upload documents** in various formats (HTML, PDF, text, etc.)27* **Search semantically** across your documents using natural language queries28* **Configure chunking and embeddings** to optimize retrieval29* **Manage documents** by listing, updating, and deleting them3031## Getting Started3233Choose how you want to work with Collections:3435* [Using the Console →](/console/collections) - Create collections and upload documents through the xAI Console interface36* [Using the API →](/developers/files/collections/api) - Programmatically manage collections with the SDK and REST API3738## Metadata Fields3940Collections support **metadata fields** — structured attributes you can attach to documents for enhanced retrieval and data integrity:4142* **Filtered retrieval** — Narrow search results to documents matching specific criteria (e.g., `author="Sandra Kim"`)43* **Contextual embeddings** — Inject metadata into chunks to improve retrieval accuracy (e.g., prepending document title to each chunk)44* **Data integrity constraints** — Enforce required fields or uniqueness across documents4546When creating a collection, define metadata fields with options like `required`, `unique`, and `inject_into_chunk` to control how metadata is validated and used during search.4748[Learn more about metadata fields →](/developers/files/collections/metadata)4950## Usage Limits5152To be able to upload files and add to a collection you must have credits in your account.5354**Maximum file size**: 100MB5556Please [contact us](https://x.ai/contact) to increase any of these limits.5758## Data Privacy5960We do not use user data stored on Collections for model training purposes.6162## Supported MIME Types6364While we support any `UTF-8` encoded text file, we also have special file conversion and chunking techniques for certain MIME types.6566The following would be a non-exhaustive list for the MIME types that we support:6768* application/csv69* application/dart70* application/ecmascript71* application/epub72* application/epub+zip73* application/json74* application/ms-java75* application/msword76* application/pdf77* application/typescript78* application/vnd.adobe.pdf79* application/vnd.curl80* application/vnd.dart81* application/vnd.jupyter82* application/vnd.ms-excel83* application/vnd.ms-outlook84* application/vnd.oasis.opendocument.text85* application/vnd.openxmlformats-officedocument.presentationml.presentation86* application/vnd.openxmlformats-officedocument.presentationml.slide87* application/vnd.openxmlformats-officedocument.presentationml.slideshow88* application/vnd.openxmlformats-officedocument.presentationml.template89* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet90* application/vnd.openxmlformats-officedocument.spreadsheetml.template91* application/vnd.openxmlformats-officedocument.wordprocessingml.document92* application/x-csh93* application/x-epub+zip94* application/x-hwp95* application/x-hwp-v596* application/x-latex97* application/x-pdf98* application/x-php99* application/x-powershell100* application/x-sh101* application/x-shellscript102* application/x-tex103* application/x-zsh104* application/xhtml105* application/xml106* application/zip107* text/cache-manifest108* text/calendar109* text/css110* text/csv111* text/html112* text/javascript113* text/jsx114* text/markdown115* text/n3116* text/php117* text/plain118* text/rtf119* text/tab-separated-values120* text/troff121* text/tsv122* text/tsx123* text/turtle124* text/uri-list125* text/vcard126* text/vtt127* text/x-asm128* text/x-bibtex129* text/x-c130* text/x-c++hdr131* text/x-c++src132* text/x-chdr133* text/x-coffeescript134* text/x-csh135* text/x-csharp136* text/x-csrc137* text/x-d138* text/x-diff139* text/x-emacs-lisp140* text/x-erlang141* text/x-go142* text/x-haskell143* text/x-java144* text/x-java-properties145* text/x-java-source146* text/x-kotlin147* text/x-lisp148* text/x-lua149* text/x-objcsrc150* text/x-pascal151* text/x-perl152* text/x-perl-script153* text/x-python154* text/x-python-script155* text/x-r-markdown156* text/x-rst157* text/x-ruby-script158* text/x-rust159* text/x-sass160* text/x-scala161* text/x-scheme162* text/x-script.python163* text/x-scss164* text/x-sh165* text/x-sql166* text/x-swift167* text/x-tcl168* text/x-tex169* text/x-vbasic170* text/x-vcalendar171* text/xml172* text/xml-dtd173* text/yaml174