Sample - OpenAI API
POST/vector_stores

Create a vector store

Creates a vector store for files that can be processed and used by the file_search tool. Supply file IDs, optional expiration settings, naming information, and processing configuration as needed.

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

6 body fields

Vector store configuration, including optional files, expiration policy, chunking strategy, name, description, and metadata.

file_idsarray<string>optional
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.
namestringoptional
The name of the vector store.
descriptionstringoptional
A description for the vector store. Can be used to describe the vector store's purpose.
expires_afterobjectoptional
The expiration policy for a vector store.
chunking_strategyobjectoptional
The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty.
metadataobjectoptional
Optional key-value metadata attached to the vector store; values are strings and the metadata can contain up to 16 entries.

2 status codes
200Returns the created vector store, including its identifier, creation timestamp, usage totals, file counts, status, expiration details, and metadata.
idstringrequired
The identifier, which can be referenced in API endpoints.
objectstringrequired
The object type, which is always `vector_store`.
Allowed:vector_store
created_atintegerrequired
The Unix timestamp (in seconds) for when the vector store was created.
namestringrequired
The name of the vector store.
usage_bytesintegerrequired
The total number of bytes used by the files in the vector store.
file_countsobjectrequired
statusstringrequired
The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use.
Allowed:expiredin_progresscompleted
expires_afterobjectoptional
The expiration policy for a vector store.
expires_atintegeroptional
The Unix timestamp (in seconds) for when the vector store will expire.
last_active_atintegerrequired
The Unix timestamp (in seconds) for when the vector store was last active.
metadataobjectrequired
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
429Returned when the request was rejected because a rate limit was exceeded.
errorobjectrequired

Error handling

If provided, expires_after must include anchor set to last_active_at and days between 1 and 365. file_ids can contain at most 500 file IDs, and chunking_strategy must use one of the supported automatic or static strategies. A 429 is returned when the request exceeds the applicable rate limit.