OpenAI API

Retrieves a vector store file batch.

get
https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}

Path Parameters

vector_store_idstringrequired

The ID of the vector store that the file batch belongs to.

Example:vs_abc123

batch_idstringrequired

The ID of the file batch being retrieved.

Example:vsfb_abc123

Response

200 application/json

OK

Vector store file batch

A batch of files attached to a vector store.

idstringrequired

The identifier, which can be referenced in API endpoints.

objectstringrequired

The object type, which is always vector_store.file_batch.

Allowed values: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 that the File is attached to.

statusstringrequired

The status of the vector store files batch, which can be either in_progress, completed, cancelled or failed.

Allowed values:in_progresscompletedcancelledfailed

file_countsobjectrequired
Show Child Parameters
get/vector_stores/{vector_store_id}/file_batches/{batch_id}
 
200 application/json

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

post
https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel

Path Parameters

vector_store_idstringrequired

The ID of the vector store that the file batch belongs to.

batch_idstringrequired

The ID of the file batch to cancel.

Response

200 application/json

OK

Vector store file batch

A batch of files attached to a vector store.

idstringrequired

The identifier, which can be referenced in API endpoints.

objectstringrequired

The object type, which is always vector_store.file_batch.

Allowed values: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 that the File is attached to.

statusstringrequired

The status of the vector store files batch, which can be either in_progress, completed, cancelled or failed.

Allowed values:in_progresscompletedcancelledfailed

file_countsobjectrequired
Show Child Parameters
post/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
 
200 application/json

Returns a list of vector store files in a batch.

get
https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files

Query Parameters

limitinteger

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Default:20

orderstring

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

Allowed values:ascdesc

Default:desc

afterstring

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

beforestring

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

filterstring

Filter by file status. One of in_progress, completed, failed, cancelled.

Allowed values:in_progresscompletedfailedcancelled

Path Parameters

vector_store_idstringrequired

The ID of the vector store that the files belong to.

batch_idstringrequired

The ID of the file batch that the files belong to.

Response

200 application/json

OK

ListVectorStoreFilesResponse

objectstringrequired

Example:list

dataarray[object]required

A list of files attached to a vector store.

Show Child Parameters
first_idstringrequired

Example:file-abc123

last_idstringrequired

Example:file-abc456

has_morebooleanrequired

Example:false

get/vector_stores/{vector_store_id}/file_batches/{batch_id}/files
 
200 application/json

Returns a list of vector store files.

get
https://api.openai.com/v1/vector_stores/{vector_store_id}/files

Query Parameters

limitinteger

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Default:20

orderstring

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

Allowed values:ascdesc

Default:desc

afterstring

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

beforestring

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

filterstring

Filter by file status. One of in_progress, completed, failed, cancelled.

Allowed values:in_progresscompletedfailedcancelled

Path Parameters

vector_store_idstringrequired

The ID of the vector store that the files belong to.

Response

200 application/json

OK

ListVectorStoreFilesResponse

objectstringrequired

Example:list

dataarray[object]required

A list of files attached to a vector store.

Show Child Parameters
first_idstringrequired

Example:file-abc123

last_idstringrequired

Example:file-abc456

has_morebooleanrequired

Example:false

get/vector_stores/{vector_store_id}/files
 
200 application/json

Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).

post
https://api.openai.com/v1/vector_stores/{vector_store_id}/files

Path Parameters

vector_store_idstringrequired

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

Example:vs_abc123

Body

application/json

CreateVectorStoreFileRequest

* Additional properties are NOT allowed.
file_idstringrequired

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

chunking_strategyOne Of
object

The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.

Auto Chunking Strategyobject

The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

* Additional properties are NOT allowed.
Show Child Parameters

Response

200 application/json

OK

Vector store files

A list of files attached to a vector store.

idstringrequired

The identifier, which can be referenced in API endpoints.

objectstringrequired

The object type, which is always vector_store.file.

Allowed values:vector_store.file

usage_bytesintegerrequired

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

created_atintegerrequired

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

vector_store_idstringrequired

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

statusstringrequired

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.

Allowed values:in_progresscompletedcancelledfailed

last_errorobject | nullrequired

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

Show Child Parameters
chunking_strategyOne Of
object

The strategy used to chunk the file.

Static Chunking Strategyobject
* Additional properties are NOT allowed.
Show Child Parameters
post/vector_stores/{vector_store_id}/files

Body

{ "file_id": "file_id" }
 
200 application/json