API reference

API reference · API

Attach several files at once

POST/v1/vector_stores/{id}/file_batchesAPI key

file_ids with one set of attributes and one chunking strategy, or files each with its own; not both.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredstringThe vector store id, vs_ and 24 hex digits.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
file_idsarray of string
filesarray of object
files[].file_idrequiredstringA file uploaded with purpose assistants.
files[].attributesobject or nullAt most 16 pairs; keys up to 64 characters, values a string up to 512 characters, a number or a boolean.
files[].chunking_strategyobjectauto is 800 tokens overlapping by 400; static takes 100 to 4096 tokens and an overlap of at most half of that.
attributesobject or nullAt most 16 pairs; keys up to 64 characters, values a string up to 512 characters, a number or a boolean.
chunking_strategyobjectauto is 800 tokens overlapping by 400; static takes 100 to 4096 tokens and an overlap of at most half of that.

Example

{
  "file_ids": [
    "string"
  ],
  "files": [
    {
      "file_id": "string",
      "attributes": {},
      "chunking_strategy": {
        "type": "auto"
      }
    }
  ],
  "attributes": {},
  "chunking_strategy": {
    "type": "auto"
  }
}

Answer 200

The batch.

Fields of the 200 answer
FieldTypeWhat it is
idstring
object"vector_store.file_batch"
created_atinteger
vector_store_idstring
statusstringOne of "in_progress", "completed", "cancelled", "failed".
file_countsobject
file_counts.in_progressinteger
file_counts.completedinteger
file_counts.failedinteger
file_counts.cancelledinteger
file_counts.totalinteger

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 402OpenAI shaped error.
  • 403OpenAI shaped error.
  • 404OpenAI shaped error.
  • 429OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter