POST
/
vector_stores
/
{vector_store_id}
/
files
Create vector store file
curl --request POST \
  --url https://api.openai.com/v1/vector_stores/{vector_store_id}/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_id": "<string>",
  "chunking_strategy": {
    "type": "auto"
  },
  "attributes": {}
}'
{
  "id": "<string>",
  "object": "vector_store.file",
  "usage_bytes": 123,
  "created_at": 123,
  "vector_store_id": "<string>",
  "status": "in_progress",
  "last_error": {
    "code": "server_error",
    "message": "<string>"
  },
  "chunking_strategy": {
    "type": "static",
    "static": {
      "max_chunk_size_tokens": 2098,
      "chunk_overlap_tokens": 123
    }
  },
  "attributes": {}
}

Authorizations

Authorization
string
header
required

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

Path Parameters

vector_store_id
string
required

The ID of the vector store for which to create a File.

Example:

"vs_abc123"

Body

application/json
file_id
string
required

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

chunking_strategy
object

The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

attributes
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, booleans, or numbers.

Response

200 - application/json

OK

A list of files attached to a vector store.

id
string
required

The identifier, which can be referenced in API endpoints.

object
enum<string>
required

The object type, which is always vector_store.file.

Available options:
vector_store.file
usage_bytes
integer
required

The total vector store usage in bytes. Note that this may be different from the original file size.

created_at
integer
required

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

vector_store_id
string
required

The ID of the vector store that the File is attached to.

status
enum<string>
required

The status of the vector store file, which can be either in_progress, completed, cancelled, or failed. The status completed indicates that the vector store file is ready for use.

Available options:
in_progress,
completed,
cancelled,
failed
last_error
object | null
required

The last error associated with this vector store file. Will be null if there are no errors.

chunking_strategy
object

The strategy used to chunk the file.

attributes
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, booleans, or numbers.