Skip to main content

Vector store files

Vector store files are the documents indexed in a store. The gateway serves the OpenAI vector store files API, so you upload a file once with /v1/files, attach it to a store, and the backend chunks and embeds it. The endpoints also report indexing status and let you read the chunked content back, which is how you check that a document was split the way you expect.

Scenario​

The people operations team updates the leave policy every year. Their script uploads the new PDF, attaches it to the handbook store with a year attribute, waits until the file's status is completed, and removes last year's file. Searches filtered on year then return only the current policy.

Steps​

  1. Upload the file and attach it to the store.

    curl -X POST http://localhost:4000/v1/files \
    -H "Authorization: Bearer $SPANWAY_API_KEY" \
    -F "purpose=assistants" \
    -F "file=@leave-policy.pdf"

    curl -X POST http://localhost:4000/v1/vector_stores/vs_hr_policies/files \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"file_id": "file-abc123", "attributes": {"department": "people-ops"}, "chunking_strategy": {"type": "static", "static": {"max_chunk_size_tokens": 800, "chunk_overlap_tokens": 200}}}'
  2. Wait for indexing. Poll GET /v1/vector_stores/vs_hr_policies/files/file-abc123 until status is completed.

  3. Check the chunks and remove an old file when needed.

    curl http://localhost:4000/v1/vector_stores/vs_hr_policies/files -H "Authorization: Bearer $SPANWAY_API_KEY"
    curl http://localhost:4000/v1/vector_stores/vs_hr_policies/files/file-abc123/content -H "Authorization: Bearer $SPANWAY_API_KEY"
    curl -X DELETE http://localhost:4000/v1/vector_stores/vs_hr_policies/files/file-old789 -H "Authorization: Bearer $SPANWAY_API_KEY"
  4. Confirm in the Admin UI. Open Vector Stores (/ui/vector-stores), click the Test Vector Store tab, pick the store and search for a sentence from the new document. To add documents from the browser instead of the API, use the Create Vector Store tab, which ingests uploaded files through RAG ingest.

Expected result​

{"id": "file-abc123", "object": "vector_store.file", "vector_store_id": "vs_hr_policies", "status": "in_progress", "created_at": 1760441234, "usage_bytes": 0, "attributes": {"department": "people-ops"}, "chunking_strategy": {"type": "static", "static": {"max_chunk_size_tokens": 800, "chunk_overlap_tokens": 200}}}

status moves from in_progress to completed or failed, with last_error when indexing failed. The /content endpoint returns the chunks as the backend stored them.

Endpoints​

{{ops:^/v1/vector_stores/{vector_store_id}/files}}

attributes become metadata you can filter on in searches, and POST /v1/vector_stores/{vector_store_id}/files/{file_id} replaces them. chunking_strategy controls chunk size on backends that accept it.

Managed files​

With managed files on, a file uploaded through the gateway gets a gateway file id that maps to the provider file behind it, and only the key that uploaded it, its team or a proxy admin can attach, read or delete it. Vector store files created by the enterprise managed vector stores feature are tracked the same way. See managed files.

Errors​

StatusWhat it meansFix
400 BadRequestErrorfile_id is missing, or chunking_strategy is malformed.Send the id returned by /v1/files, and use {"type": "auto"} or the static shape above.
403 PermissionDeniedErrorThe store belongs to another team, or with managed files the key does not own the file.Use a store of your team, and upload with the same key. A missing grant on the store is the 401 below.
404 NotFoundErrorThe store or file id is unknown to the provider.Use ids returned through the gateway.
status failed with last_errorThe backend could not parse or embed the file, for example an unsupported file type.Read last_error, convert the file and attach it again.
401 AuthenticationErrorThe key is missing, wrong or expired.Use a live key.
401 key_vector_store_access_denied (or team_ or user_)The key, its team or its user lists vector stores and leaves this one out, or vector_store_deny_by_default is on and none of them grants it.Grant the store on the key and its team.

Audit​

Attaching, updating and detaching a file write an audit row with table_name Spanway_ManagedObjectTable, an object_id of vector_store_file:<vector store id>/<file id>, who made the change and the operation (attach, update or detach). Reads write no row, and the file content is never stored. See audit logs.

Logs​

These calls write no operator log lines of their own. A failed call is logged like any other provider call, and the request shows in Logs (/ui/logs) with the error.

Providers​

The gateway's endpoint support matrix marks 1 provider integration as supporting this endpoint:

OpenAI.