---
title: "Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible."
url: "https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1/operations/cancelVectorStoreFileBatch"
---

> Full API specification: https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1.md

# Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

`POST` `/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel`

Operation ID: `cancelVectorStoreFileBatch`

## Path parameters

- `vector_store_id` (string, required) - The ID of the vector store that the file batch belongs to.
- `batch_id` (string, required) - The ID of the file batch to cancel.

## Responses

- `200` - OK

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: OpenAI API
  version: 2.3.0
servers:
  - url: https://api.openai.com/v1
paths:
  /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
        beta: true
        returns: The modified vector store file batch object.
        examples:
          request:
            curl: |
              curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \
                -H "Authorization: Bearer $OPENAI_API_KEY" \
                -H "Content-Type: application/json" \
                -H "OpenAI-Beta: assistants=v2" \
                -X POST
            python: >
              from openai import OpenAI

              client = OpenAI()


              deleted_vector_store_file_batch =
              client.beta.vector_stores.file_batches.cancel(
                  vector_store_id="vs_abc123",
                  file_batch_id="vsfb_abc123"
              )

              print(deleted_vector_store_file_batch)
            node.js: >
              import OpenAI from "openai";

              const openai = new OpenAI();


              async function main() {
                const deletedVectorStoreFileBatch = await openai.vector_stores.fileBatches.cancel(
                  "vs_abc123",
                  "vsfb_abc123"
                );
                console.log(deletedVectorStoreFileBatch);
              }


              main();
          response: |
            {
              "id": "vsfb_abc123",
              "object": "vector_store.file_batch",
              "created_at": 1699061776,
              "vector_store_id": "vs_abc123",
              "status": "in_progress",
              "file_counts": {
                "in_progress": 12,
                "completed": 3,
                "failed": 0,
                "cancelled": 0,
                "total": 15,
              }
            }
security:
  - ApiKeyAuth: []
components:
  schemas:
    VectorStoreFileBatchObject:
      type: object
      title: Vector store file batch
      description: A batch of files attached to a vector store.
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `vector_store.file_batch`.
          type: string
          enum:
            - vector_store.files_batch
          x-stainless-const: true
        created_at:
          description: The Unix timestamp (in seconds) for when the vector store files
            batch was created.
          type: integer
        vector_store_id:
          description: The ID of the [vector
            store](/docs/api-reference/vector-stores/object) that the
            [File](/docs/api-reference/files) is attached to.
          type: string
        status:
          description: The status of the vector store files batch, which can be either
            `in_progress`, `completed`, `cancelled` or `failed`.
          type: string
          enum:
            - in_progress
            - completed
            - cancelled
            - failed
        file_counts:
          type: object
          properties:
            in_progress:
              description: The number of files that are currently being processed.
              type: integer
            completed:
              description: The number of files that have been processed.
              type: integer
            failed:
              description: The number of files that have failed to process.
              type: integer
            cancelled:
              description: The number of files that where cancelled.
              type: integer
            total:
              description: The total number of files.
              type: integer
          required:
            - in_progress
            - completed
            - cancelled
            - failed
            - total
      required:
        - id
        - object
        - created_at
        - vector_store_id
        - status
        - file_counts
      x-oaiMeta:
        name: The vector store files batch object
        beta: true
        example: |
          {
            "id": "vsfb_123",
            "object": "vector_store.files_batch",
            "created_at": 1698107661,
            "vector_store_id": "vs_abc123",
            "status": "completed",
            "file_counts": {
              "in_progress": 0,
              "completed": 100,
              "failed": 0,
              "cancelled": 0,
              "total": 100
            }
          }
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
```
