POST
/
vector_stores
Create a vector store.
curl --request POST \
  --url https://api.openai.com/v1/vector_stores \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_ids": [
    "<string>"
  ],
  "name": "<string>",
  "expires_after": {
    "anchor": "last_active_at",
    "days": 183
  },
  "chunking_strategy": {
    "type": "auto"
  },
  "metadata": {}
}'
{
  "id": "<string>",
  "object": "vector_store",
  "created_at": 123,
  "name": "<string>",
  "usage_bytes": 123,
  "file_counts": {
    "in_progress": 123,
    "completed": 123,
    "failed": 123,
    "cancelled": 123,
    "total": 123
  },
  "status": "expired",
  "expires_after": {
    "anchor": "last_active_at",
    "days": 183
  },
  "expires_at": 123,
  "last_active_at": 123,
  "metadata": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
file_ids
string[]

A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.

Maximum length: 500
name
string

The name of the vector store.

expires_after
object

The expiration policy for a vector store.

chunking_strategy
object

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. The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

metadata
object | null

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.

Response

200 - application/json

OK

A vector store is a collection of processed files can be used by the file_search tool.

id
string
required

The identifier, which can be referenced in API endpoints.

object
enum<string>
required

The object type, which is always vector_store.

Available options:
vector_store
created_at
integer
required

The Unix timestamp (in seconds) for when the vector store was created.

name
string
required

The name of the vector store.

usage_bytes
integer
required

The total number of bytes used by the files in the vector store.

file_counts
object
required
status
enum<string>
required

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.

Available options:
expired,
in_progress,
completed
last_active_at
integer | null
required

The Unix timestamp (in seconds) for when the vector store was last active.

metadata
object | null
required

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.

expires_after
object

The expiration policy for a vector store.

expires_at
integer | null

The Unix timestamp (in seconds) for when the vector store will expire.