Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: OpenAI Vector stores API
description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
version: 2.3.0
termsOfService: https://openai.com/policies/terms-of-use
contact:
name: OpenAI Support
url: https://help.openai.com/
license:
name: MIT
url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
- url: https://api.openai.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Vector stores
paths:
/vector_stores:
get:
operationId: listVectorStores
tags:
- Vector stores
summary: Returns a list of vector stores.
parameters:
- name: limit
in: query
description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
'
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: 'Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
'
schema:
type: string
default: desc
enum:
- asc
- desc
- name: after
in: query
description: '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.
'
schema:
type: string
- name: before
in: query
description: '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.
'
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ListVectorStoresResponse'
x-oaiMeta:
name: List vector stores
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.list()\npage = page.data[0]\nprint(page.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStores = await openai.vectorStores.list();\n console.log(vectorStores);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const vectorStore of client.vectorStores.list()) {\n console.log(vectorStore.id);\n}"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStoreListPage;\nimport com.openai.models.vectorstores.VectorStoreListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreListPage page = client.vectorStores().list();\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.vector_stores.list
puts(page)'
response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"description\": null,\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n"
post:
operationId: createVectorStore
tags:
- Vector stores
summary: Create a vector store.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateVectorStoreRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreObject'
x-oaiMeta:
name: Create vector store
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"name\": \"Support FAQ\"\n }'\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.create()\nprint(vector_store.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.create({\n name: \"Support FAQ\"\n });\n console.log(vectorStore);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.create();\n\nconsole.log(vectorStore.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().create();\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store = openai.vector_stores.create
puts(vector_store)'
response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n"
/vector_stores/{vector_store_id}:
get:
operationId: getVectorStore
tags:
- Vector stores
summary: Retrieves a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to retrieve.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreObject'
x-oaiMeta:
name: Retrieve vector store
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.retrieve(\n \"vector_store_id\",\n)\nprint(vector_store.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.retrieve(\n \"vs_abc123\"\n );\n console.log(vectorStore);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.retrieve('vector_store_id');\n\nconsole.log(vectorStore.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().retrieve(\"vector_store_id\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store = openai.vector_stores.retrieve("vector_store_id")
puts(vector_store)'
response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776\n}\n"
post:
operationId: modifyVectorStore
tags:
- Vector stores
summary: Modifies a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to modify.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateVectorStoreRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreObject'
x-oaiMeta:
name: Modify vector store
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.update(\n vector_store_id=\"vector_store_id\",\n)\nprint(vector_store.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.update(\n \"vs_abc123\",\n {\n name: \"Support FAQ\"\n }\n );\n console.log(vectorStore);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.update('vector_store_id');\n\nconsole.log(vectorStore.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().update(\"vector_store_id\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store = openai.vector_stores.update("vector_store_id")
puts(vector_store)'
response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n"
delete:
operationId: deleteVectorStore
tags:
- Vector stores
summary: Delete a vector store.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store to delete.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteVectorStoreResponse'
x-oaiMeta:
name: Delete vector store
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_deleted = client.vector_stores.delete(\n \"vector_store_id\",\n)\nprint(vector_store_deleted.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStore = await openai.vectorStores.delete(\n \"vs_abc123\"\n );\n console.log(deletedVectorStore);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreDeleted = await client.vectorStores.delete('vector_store_id');\n\nconsole.log(vectorStoreDeleted.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStoreDeleteParams;\nimport com.openai.models.vectorstores.VectorStoreDeleted;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete(\"vector_store_id\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store_deleted = openai.vector_stores.delete("vector_store_id")
puts(vector_store_deleted)'
response: "{\n id: \"vs_abc123\",\n object: \"vector_store.deleted\",\n deleted: true\n}\n"
/vector_stores/{vector_store_id}/file_batches:
post:
operationId: createVectorStoreFileBatch
tags:
- Vector stores
summary: Create a vector store file batch.
description: 'The maximum number of files in a single batch request is 2000.
Vector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`).
For ingesting multiple files into the same vector store, this batch endpoint is recommended.
'
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: 'The ID of the vector store for which to create a File Batch.
'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateVectorStoreFileBatchRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileBatchObject'
x-oaiMeta:
name: Create vector store file batch
group: vector_stores
description: 'Attaches multiple files to a vector store in one request. This is the recommended approach for multi-file ingestion, especially because per-vector-store file attach writes are rate-limited (300 requests/minute shared with `/vector_stores/{vector_store_id}/files`).
'
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"files\": [\n {\n \"file_id\": \"file-abc123\",\n \"attributes\": {\"category\": \"finance\"}\n },\n {\n \"file_id\": \"file-abc456\",\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"max_chunk_size_tokens\": 1200,\n \"chunk_overlap_tokens\": 200\n }\n }\n ]\n }'\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.create(\n vector_store_id=\"vs_abc123\",\n)\nprint(vector_store_file_batch.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create(\n \"vs_abc123\",\n {\n files: [\n {\n file_id: \"file-abc123\",\n attributes: { category: \"finance\" },\n },\n {\n file_id: \"file-abc456\",\n chunking_strategy: {\n type: \"static\",\n max_chunk_size_tokens: 1200,\n chunk_overlap_tokens: 200,\n },\n },\n ]\n }\n );\n console.log(myVectorStoreFileBatch);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.create('vs_abc123');\n\nconsole.log(vectorStoreFileBatch.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchCreateParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create(\"vs_abc123\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store_file_batch = openai.vector_stores.file_batches.create("vs_abc123")
puts(vector_store_file_batch)'
response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n"
/vector_stores/{vector_store_id}/file_batches/{batch_id}:
get:
operationId: getVectorStoreFileBatch
tags:
- Vector stores
summary: Retrieves a vector store file batch.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
example: vs_abc123
description: The ID of the vector store that the file batch belongs to.
- in: path
name: batch_id
required: true
schema:
type: string
example: vsfb_abc123
description: The ID of the file batch being retrieved.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileBatchObject'
x-oaiMeta:
name: Retrieve vector store file batch
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.retrieve(\n batch_id=\"vsfb_abc123\",\n vector_store_id=\"vs_abc123\",\n)\nprint(vector_store_file_batch.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFileBatch);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.retrieve('vsfb_abc123', {\n vector_store_id: 'vs_abc123',\n});\n\nconsole.log(vectorStoreFileBatch.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileBatchRetrieveParams params = FileBatchRetrieveParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .batchId(\"vsfb_abc123\")\n .build();\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store_file_batch = openai.vector_stores.file_batches.retrieve("vsfb_abc123", vector_store_id: "vs_abc123")
puts(vector_store_file_batch)'
response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n"
/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel:
post:
operationId: cancelVectorStoreFileBatch
tags:
- Vector stores
summary: Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
parameters:
- in: path
name: vector_store_id
required: true
schema:
type: string
description: The ID of the vector store that the file batch belongs to.
- in: path
name: batch_id
required: true
schema:
type: string
description: The ID of the file batch to cancel.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileBatchObject'
x-oaiMeta:
name: Cancel vector store file batch
group: vector_stores
examples:
request:
curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.cancel(\n batch_id=\"batch_id\",\n vector_store_id=\"vector_store_id\",\n)\nprint(vector_store_file_batch.id)"
javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(deletedVectorStoreFileBatch);\n}\n\nmain();\n"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.cancel('batch_id', {\n vector_store_id: 'vector_store_id',\n});\n\nconsole.log(vectorStoreFileBatch.id);"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchCancelParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileBatchCancelParams params = FileBatchCancelParams.builder()\n .vectorStoreId(\"vector_store_id\")\n .batchId(\"batch_id\")\n .build();\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
vector_store_file_batch = openai.vector_stores.file_batches.cancel("batch_id", vector_store_id: "vector_store_id")
puts(vector_store_file_batch)'
response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15,\n }\n}\n"
/vector_stores/{vector_store_id}/file_batches/{batch_id}/files:
get:
operationId: listFilesInVectorStoreBatch
tags:
- Vector stores
summary: Returns a list of vector store files in a batch.
parameters:
- name: vector_store_id
in: path
description: The ID of the vector store that the files belong to.
required: true
schema:
type: string
- name: batch_id
in: path
description: The ID of the file batch that the files belong to.
required: true
schema:
type: string
- name: limit
in: query
description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
'
required: false
schema:
type: integer
default: 20
- name: order
in: query
description: 'Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
'
schema:
type: string
default: desc
enum:
- asc
- desc
- name: after
in: query
description: '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 object
# --- truncated at 32 KB (111 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-vector-stores-api-openapi.yml