Create vector store file
POSThttps:/api.openai.com/v1/vector_stores/{vector_store_id}/files
Create a vector store file by attaching a File to a vector store.
Path parameters
vector_store_idstringRequired
The ID of the vector store for which to create a File.
Request body
file_idstringRequired
A File ID that the vector store should use. Useful for tools like
file_searchthat can access files.chunking_strategyobject
The chunking strategy used to chunk the file(s). If not set, will use the
autostrategy.Auto Chunking Strategyobject
The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.typestringRequired
Always
auto.autostring
Static Chunking Strategyobject
Customize your own chunking strategy by setting chunk size and chunk overlap.typestringRequired
Always
static.staticstring
staticobjectRequired
max_chunk_size_tokensintegerRequired
The maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.chunk_overlap_tokensintegerRequired
The number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens.
attributesobject or 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, booleans, or numbers.
Response
A vector store file object.
Example request
1 curl https://api.openai.com/v1/vector_stores/vs_abc123/files \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -H "Content-Type: application/json" \4 -H "OpenAI-Beta: assistants=v2" \5 -d '{6 "file_id": "file-abc123"7 }'
Example response
1 {2 "id": "file-abc123",3 "object": "vector_store.file",4 "created_at": 1699061776,5 "usage_bytes": 1234,6 "vector_store_id": "vs_abcd",7 "status": "completed",8 "last_error": null9 }
Built with