Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

List vector store files in a batch

client.vectorStores.fileBatches.listFiles(stringbatchID, FileBatchListFilesParams { vector_store_id, after, before, 3 more } params, RequestOptionsoptions?): CursorPage<VectorStoreFile { id, created_at, last_error, 6 more } >
GET/vector_stores/{vector_store_id}/file_batches/{batch_id}/files

Returns a list of vector store files in a batch.

ParametersExpand Collapse
batchID: string
params: FileBatchListFilesParams { vector_store_id, after, before, 3 more }
ReturnsExpand Collapse
VectorStoreFile { id, created_at, last_error, 6 more }

A list of files attached to a vector store.

id: string

The identifier, which can be referenced in API endpoints.

created_at: number

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

formatunixtime
last_error: LastError | null

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

object: "vector_store.file"

The object type, which is always vector_store.file.

status: "in_progress" | "completed" | "cancelled" | "failed"

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.

usage_bytes: number

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

vector_store_id: string

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

attributes?: Record<string, string | number | boolean> | 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.

chunking_strategy?: FileChunkingStrategy

The strategy used to chunk the file.

List vector store files in a batch

import OpenAI from "openai";
const openai = new OpenAI();

async function main() {
  const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles(
    "vsfb_abc123",
    { vector_store_id: "vs_abc123" }
  );
  console.log(vectorStoreFiles);
}

main();
{
  "object": "list",
  "data": [
    {
      "id": "file-abc123",
      "object": "vector_store.file",
      "created_at": 1699061776,
      "vector_store_id": "vs_abc123"
    },
    {
      "id": "file-abc456",
      "object": "vector_store.file",
      "created_at": 1699061776,
      "vector_store_id": "vs_abc123"
    }
  ],
  "first_id": "file-abc123",
  "last_id": "file-abc456",
  "has_more": false
}
Returns Examples
{
  "object": "list",
  "data": [
    {
      "id": "file-abc123",
      "object": "vector_store.file",
      "created_at": 1699061776,
      "vector_store_id": "vs_abc123"
    },
    {
      "id": "file-abc456",
      "object": "vector_store.file",
      "created_at": 1699061776,
      "vector_store_id": "vs_abc123"
    }
  ],
  "first_id": "file-abc123",
  "last_id": "file-abc456",
  "has_more": false
}