Sample - OpenAI API
POST/vector_stores/{vector_store_id}/file_batches

Create a vector store file batch

Creates a batch of files for processing in a vector store. Provide either file_ids for shared batch settings or files when individual files need their own attributes or chunking strategy.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 4 body fields
vector_store_idstringrequired
The identifier of the vector store for which to create the file batch.

File batch configuration using either a list of file IDs or per-file configuration objects, with optional shared processing settings.

file_idsarray<string>required
A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`.
filesarray<object>optional
A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`.
chunking_strategyobjectoptional
The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
attributesobjectoptional
Shared attributes for the batch, with no more than 16 entries. Per-file attributes take precedence when `files` is used.

2 status codes
200Returns the created vector store file batch, including its identifier, creation time, vector store ID, processing status, and file counts.
idstringrequired
The identifier, which can be referenced in API endpoints.
objectstringrequired
The object type, which is always `vector_store.file_batch`.
Allowed:vector_store.files_batch
created_atintegerrequired
The Unix timestamp (in seconds) for when the vector store files batch was created.
vector_store_idstringrequired
The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to.
statusstringrequired
The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`.
Allowed:in_progresscompletedcancelledfailed
file_countsobjectrequired
429Returned when the request was rejected because a rate limit was exceeded.
errorobjectrequired

Error handling

Provide either file_ids or files, and include between 1 and 2,000 entries in the selected array. Each object in files must include file_id; a 429 is returned when the request exceeds the applicable rate limit.