Manage Store Files
Once files are uploaded to your Store, you can manage them using these core operations. All operations work with either the file ID or the file's external ID (if provided during upload).
File Identifiers: You can reference files using either their UUID
(file_id) or their external ID. External IDs support slashes, making it easy
to use file paths as identifiers (e.g., docs/api/authentication.md).
Retrieve Store File
Get detailed information about a specific file using either its ID or external ID:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
file = mxbai.stores.files.retrieve(
store_identifier="my-knowledge-base",
file_identifier="f47ac10b-58cc-4372-a567-0e02b2c3d479",
)
print(file)The response includes comprehensive file information including processing status, metadata, usage statistics, and error details if applicable.
For complete details on all file object properties, see Data Models.
List Store Files
View all files in your Store. The list operation uses cursor-based pagination:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
response = mxbai.stores.files.list("my-knowledge-base", limit=20)
for file in response.data:
print(file)Pagination Details: For complete information about cursor-based pagination including parameters, response format, and advanced usage patterns, see the Pagination Reference.
Metadata Filtering
Filter Store Files based on their metadata.
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
response = mxbai.stores.files.list(
store_identifier="my-knowledge-base",
limit=10,
metadata_filter={
"key": "category",
"value": "documentation",
"operator": "eq",
},
)
for file in response.data:
print(file)Complete Filtering Guide: For detailed information about filter operators, logical operations, data types, and advanced patterns, see Metadata Filtering.
Paginate and Filter Files
List all available files and filter them by status. This operation combines cursor-based pagination with the status filter to retrieve only the subsets of files you care about. For a complete explanation of cursor-based pagination options, see the Pagination Reference.
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
all_files = []
files = mxbai.stores.files.list(
store_identifier="my-knowledge-base",
limit=100,
# change status to get different subsets
statuses=["failed"],
)
all_files += files.data
while files.pagination.has_more:
files = mxbai.stores.files.list(
store_identifier="my-knowledge-base",
limit=100,
after=files.pagination.last_cursor,
statuses=["failed"],
)
all_files += files.data
print(len(all_files), "files matched")Delete Store File
Remove files from your Store:
from mixedbread import Mixedbread
mxbai = Mixedbread(api_key="YOUR_API_KEY")
response = mxbai.stores.files.delete(
store_identifier="my-knowledge-base",
file_identifier="f47ac10b-58cc-4372-a567-0e02b2c3d479",
)
print(response)Important: Deleting a file permanently removes:
- The original file from storage
- All generated chunks and embeddings
- Associated metadata and search indexes
- Processing history and logs