Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Vector stores

List files in vector store batch

GET /openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files

Lists files in vector store batch matching the request filters.

Path parameters

vector_store_id string required

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

batch_id string required

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

Query parameters

limit integer

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

order enum

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

ascdesc
after string

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.

before string

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.

filter enum

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

in_progresscompletedfailedcancelled

Responses

The request has succeeded.

Body

Content-Type: application/json
object string required
data OpenAI.VectorStoreFileObject[] required
first_id string required
last_id string required
has_more boolean required

Client error

Body

Content-Type: application/json
error OpenAI.Error required
code string | null required
message string required
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Any of the following:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string required

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Body

Content-Type: application/json
error OpenAI.Error required
code string | null required
message string required
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Any of the following:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string required

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Request

curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v2"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
page = client.vector_stores.file_batches.list_files(
    batch_id="batch_id",
    vector_store_id="vector_store_id",
)
page = page.data[0]
print(page.id)
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();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const vectorStoreFile of client.vectorStores.fileBatches.listFiles('batch_id', {
  vector_store_id: 'vector_store_id',
})) {
  console.log(vectorStoreFile.id);
}
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    page, err := client.VectorStores.FileBatches.ListFiles(
        context.TODO(),
        "vector_store_id",
        "batch_id",
        openai.VectorStoreFileBatchListFilesParams{},
    )
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", page)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.filebatches.FileBatchListFilesPage;
import com.openai.models.vectorstores.filebatches.FileBatchListFilesParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        FileBatchListFilesParams params = FileBatchListFilesParams.builder()
            .vectorStoreId("vector_store_id")
            .batchId("batch_id")
            .build();
        FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params);
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

page = openai.vector_stores.file_batches.list_files("batch_id", vector_store_id: "vector_store_id")

puts(page)

Response

{
  "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
}
en-us
Your Privacy Choices
  • AI Disclaimer
  • Previous Versions
  • Blog
  • Contribute
  • Privacy
  • Consumer Health Privacy
  • Terms of Use
  • Trademarks
  • © Microsoft 2026