Cloudflare Vectorize API

Cloudflare Vectorize is a globally distributed vector database for building AI-powered applications. The API allows developers to create indexes, insert and upsert vectors, and perform similarity queries for semantic search, recommendations, and classification tasks.

OpenAPI Specification

cloudflare-vectorize-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Cloudflare Vectorize API
  description: >-
    Cloudflare Vectorize is a globally distributed vector database for building
    AI-powered applications. The API allows developers to create and manage
    indexes, insert and upsert vectors, and perform similarity queries for
    semantic search, recommendations, and classification tasks.
  version: '4.0'
  contact:
    name: Cloudflare Support
    url: https://support.cloudflare.com/
  termsOfService: https://www.cloudflare.com/terms/
externalDocs:
  description: Cloudflare Vectorize Documentation
  url: https://developers.cloudflare.com/vectorize/
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4 Production Server
tags:
- name: Indexes
  description: >-
    Create, list, update, and delete vector indexes.
- name: Vectors
  description: >-
    Insert, upsert, query, get, and delete vectors within an index.
security:
- bearerAuth: []
paths:
  /accounts/{account_id}/vectorize/v2/indexes:
    get:
      operationId: listVectorizeIndexes
      summary: Cloudflare List Vectorize Indexes
      description: >-
        Returns all Vectorize indexes for the account.
      tags:
      - Indexes
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: List of indexes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexListResponse'
              examples:
                Listvectorizeindexes200Example:
                  summary: Default listVectorizeIndexes 200 response
                  x-microcks-default: true
                  value:
                    result:
                    - name: Example Title
                      description: A sample description.
                      config: {}
                      created_on: '2026-01-15T10:30:00Z'
                      modified_on: '2026-01-15T10:30:00Z'
                    success: true
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createVectorizeIndex
      summary: Cloudflare Create Vectorize Index
      description: >-
        Create a new vector index with the specified dimensions and distance
        metric.
      tags:
      - Indexes
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexInput'
            examples:
              CreatevectorizeindexRequestExample:
                summary: Default createVectorizeIndex request
                x-microcks-default: true
                value:
                  name: Example Title
                  description: A sample description.
                  config:
                    dimensions: 10
                    metric: cosine
      responses:
        '200':
          description: Index created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexResponse'
              examples:
                Createvectorizeindex200Example:
                  summary: Default createVectorizeIndex 200 response
                  x-microcks-default: true
                  value:
                    result:
                      name: Example Title
                      description: A sample description.
                      config:
                        dimensions: 10
                        metric: cosine
                      created_on: '2026-01-15T10:30:00Z'
                      modified_on: '2026-01-15T10:30:00Z'
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}:
    get:
      operationId: getVectorizeIndex
      summary: Cloudflare Get Vectorize Index
      description: >-
        Retrieve details of a specific Vectorize index.
      tags:
      - Indexes
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      responses:
        '200':
          description: Index details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexResponse'
              examples:
                Getvectorizeindex200Example:
                  summary: Default getVectorizeIndex 200 response
                  x-microcks-default: true
                  value:
                    result:
                      name: Example Title
                      description: A sample description.
                      config:
                        dimensions: 10
                        metric: cosine
                      created_on: '2026-01-15T10:30:00Z'
                      modified_on: '2026-01-15T10:30:00Z'
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '401':
          description: Unauthorized.
        '404':
          description: Index not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: updateVectorizeIndex
      summary: Cloudflare Update Vectorize Index
      description: >-
        Update the configuration of a Vectorize index.
      tags:
      - Indexes
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                description:
                  type: string
                  description: Updated description for the index.
            examples:
              UpdatevectorizeindexRequestExample:
                summary: Default updateVectorizeIndex request
                x-microcks-default: true
                value:
                  description: A sample description.
      responses:
        '200':
          description: Index updated successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deleteVectorizeIndex
      summary: Cloudflare Delete Vectorize Index
      description: >-
        Delete a Vectorize index and all its vectors.
      tags:
      - Indexes
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      responses:
        '200':
          description: Index deleted successfully.
        '401':
          description: Unauthorized.
        '404':
          description: Index not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}/insert:
    post:
      operationId: insertVectors
      summary: Cloudflare Insert Vectors
      description: >-
        Insert new vectors into the index. If a vector with the same ID
        already exists, the request will fail.
      tags:
      - Vectors
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/x-ndjson:
            schema:
              type: string
              description: Newline-delimited JSON vectors.
            examples:
              InsertvectorsRequestExample:
                summary: Default insertVectors request
                x-microcks-default: true
                value: example_value
      responses:
        '200':
          description: Vectors inserted successfully.
        '400':
          description: Bad request or duplicate IDs.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}/upsert:
    post:
      operationId: upsertVectors
      summary: Cloudflare Upsert Vectors
      description: >-
        Insert or update vectors in the index. If a vector with the same ID
        exists, it will be replaced.
      tags:
      - Vectors
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/x-ndjson:
            schema:
              type: string
              description: Newline-delimited JSON vectors.
            examples:
              UpsertvectorsRequestExample:
                summary: Default upsertVectors request
                x-microcks-default: true
                value: example_value
      responses:
        '200':
          description: Vectors upserted successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}/query:
    post:
      operationId: queryVectors
      summary: Cloudflare Query Vectors
      description: >-
        Perform a similarity search against the index. Returns the nearest
        vectors to the provided query vector.
      tags:
      - Vectors
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - vector
              properties:
                vector:
                  type: array
                  items:
                    type: number
                  description: The query vector.
                topK:
                  type: integer
                  description: Number of nearest neighbors to return.
                  default: 10
                returnValues:
                  type: boolean
                  description: Whether to return vector values.
                returnMetadata:
                  type: string
                  description: Whether to return vector metadata.
                  enum:
                  - none
                  - indexed
                  - all
                filter:
                  type: object
                  description: Metadata filter for the query.
            examples:
              QueryvectorsRequestExample:
                summary: Default queryVectors request
                x-microcks-default: true
                value:
                  vector:
                  - 42.5
                  topK: 10
                  returnValues: true
                  returnMetadata: none
                  filter: example_value
      responses:
        '200':
          description: Query results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
              examples:
                Queryvectors200Example:
                  summary: Default queryVectors 200 response
                  x-microcks-default: true
                  value:
                    result:
                      count: 10
                      matches:
                      - id: abc123
                        score: 42.5
                        values: {}
                        metadata: example_value
                    success: true
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}/get_by_ids:
    post:
      operationId: getVectorsByIds
      summary: Cloudflare Get Vectors by Ids
      description: >-
        Retrieve specific vectors by their IDs.
      tags:
      - Vectors
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - ids
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Vector IDs to retrieve.
            examples:
              GetvectorsbyidsRequestExample:
                summary: Default getVectorsByIds request
                x-microcks-default: true
                value:
                  ids:
                  - example_value
      responses:
        '200':
          description: Vectors retrieved.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/vectorize/v2/indexes/{index_name}/delete_by_ids:
    post:
      operationId: deleteVectorsByIds
      summary: Cloudflare Delete Vectors by Ids
      description: >-
        Delete specific vectors from the index by their IDs.
      tags:
      - Vectors
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/IndexName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - ids
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Vector IDs to delete.
            examples:
              DeletevectorsbyidsRequestExample:
                summary: Default deleteVectorsByIds request
                x-microcks-default: true
                value:
                  ids:
                  - example_value
      responses:
        '200':
          description: Vectors deleted.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API token with Vectorize permissions.
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string
    IndexName:
      name: index_name
      in: path
      required: true
      description: The name of the Vectorize index.
      schema:
        type: string
  schemas:
    VectorizeIndex:
      type: object
      properties:
        name:
          type: string
          description: The name of the index.
          example: Example Title
        description:
          type: string
          description: Description of the index.
          example: A sample description.
        config:
          type: object
          properties:
            dimensions:
              type: integer
              description: Number of dimensions for each vector.
            metric:
              type: string
              enum:
              - cosine
              - euclidean
              - dot-product
              description: Distance metric used for similarity.
          example: example_value
        created_on:
          type: string
          format: date-time
          example: '2026-01-15T10:30:00Z'
        modified_on:
          type: string
          format: date-time
          example: '2026-01-15T10:30:00Z'
    IndexInput:
      type: object
      required:
      - name
      - config
      properties:
        name:
          type: string
          description: The name of the index.
          example: Example Title
        description:
          type: string
          description: Description of the index.
          example: A sample description.
        config:
          type: object
          required:
          - dimensions
          - metric
          properties:
            dimensions:
              type: integer
              description: Number of dimensions.
            metric:
              type: string
              enum:
              - cosine
              - euclidean
              - dot-product
          example: example_value
    IndexResponse:
      type: object
      properties:
        result:
          $ref: '#/components/schemas/VectorizeIndex'
        success:
          type: boolean
          example: true
        errors:
          type: array
          items:
            type: object
          example: []
        messages:
          type: array
          items:
            type: object
          example: []
    IndexListResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/VectorizeIndex'
          example: []
        success:
          type: boolean
          example: true
    QueryResponse:
      type: object
      properties:
        result:
          type: object
          properties:
            count:
              type: integer
              description: Number of results returned.
            matches:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The vector ID.
                  score:
                    type: number
                    description: Similarity score.
                  values:
                    type: array
                    items:
                      type: number
                  metadata:
                    type: object
          example: example_value
        success:
          type: boolean
          example: true