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

Retrieve vector store file content

vector_stores.files.content(strfile_id, FileContentParams**kwargs) -> SyncPage[FileContentResponse]
GET/vector_stores/{vector_store_id}/files/{file_id}/content

Retrieve the parsed contents of a vector store file.

ParametersExpand Collapse
vector_store_id: str
file_id: str
ReturnsExpand Collapse
class FileContentResponse: …
text: Optional[str]

The text content

type: Optional[str]

The content type (currently only "text")

Retrieve vector store file content

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.files.content(
    file_id="file-abc123",
    vector_store_id="vs_abc123",
)
page = page.data[0]
print(page.text)
{
  "file_id": "file-abc123",
  "filename": "example.txt",
  "attributes": {"key": "value"},
  "content": [
    {"type": "text", "text": "..."},
    ...
  ]
}
Returns Examples
{
  "file_id": "file-abc123",
  "filename": "example.txt",
  "attributes": {"key": "value"},
  "content": [
    {"type": "text", "text": "..."},
    ...
  ]
}