> ## Documentation Index
> Fetch the complete documentation index at: https://openai-hd4n6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a vector store.



## OpenAPI

````yaml api-definition.yaml post /vector_stores
openapi: 3.0.0
info:
  title: OpenAI 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: Assistants
    description: Build Assistants that can call models and use tools.
  - name: Audio
    description: Turn audio into text or text into audio.
  - name: Chat
    description: >-
      Given a list of messages comprising a conversation, the model will return
      a response.
  - name: Completions
    description: >-
      Given a prompt, the model will return one or more predicted completions,
      and can also return the probabilities of alternative tokens at each
      position.
  - name: Embeddings
    description: >-
      Get a vector representation of a given input that can be easily consumed
      by machine learning models and algorithms.
  - name: Evals
    description: Manage and run evals in the OpenAI platform.
  - name: Fine-tuning
    description: Manage fine-tuning jobs to tailor a model to your specific training data.
  - name: Batch
    description: Create large batches of API requests to run asynchronously.
  - name: Files
    description: >-
      Files are used to upload documents that can be used with features like
      Assistants and Fine-tuning.
  - name: Uploads
    description: Use Uploads to upload large files in multiple parts.
  - name: Images
    description: Given a prompt and/or an input image, the model will generate a new image.
  - name: Models
    description: List and describe the various models available in the API.
  - name: Moderations
    description: >-
      Given text and/or image inputs, classifies if those inputs are potentially
      harmful.
  - name: Audit Logs
    description: List user actions and configuration changes within this organization.
paths:
  /vector_stores:
    post:
      tags:
        - Vector stores
      summary: Create a vector store.
      operationId: createVectorStore
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVectorStoreRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VectorStoreObject'
components:
  schemas:
    CreateVectorStoreRequest:
      type: object
      additionalProperties: false
      properties:
        file_ids:
          description: >-
            A list of [File](/docs/api-reference/files) IDs that the vector
            store should use. Useful for tools like `file_search` that can
            access files.
          type: array
          maxItems: 500
          items:
            type: string
        name:
          description: The name of the vector store.
          type: string
        expires_after:
          $ref: '#/components/schemas/VectorStoreExpirationAfter'
        chunking_strategy:
          type: object
          description: >-
            The chunking strategy used to chunk the file(s). If not set, will
            use the `auto` strategy. Only applicable if `file_ids` is non-empty.
          oneOf:
            - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam'
            - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam'
          x-oaiExpandable: true
        metadata:
          $ref: '#/components/schemas/Metadata'
    VectorStoreObject:
      type: object
      title: Vector store
      description: >-
        A vector store is a collection of processed files can be used by the
        `file_search` tool.
      properties:
        id:
          description: The identifier, which can be referenced in API endpoints.
          type: string
        object:
          description: The object type, which is always `vector_store`.
          type: string
          enum:
            - vector_store
          x-stainless-const: true
        created_at:
          description: >-
            The Unix timestamp (in seconds) for when the vector store was
            created.
          type: integer
        name:
          description: The name of the vector store.
          type: string
        usage_bytes:
          description: The total number of bytes used by the files in the vector store.
          type: integer
        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 successfully processed.
              type: integer
            failed:
              description: The number of files that have failed to process.
              type: integer
            cancelled:
              description: The number of files that were cancelled.
              type: integer
            total:
              description: The total number of files.
              type: integer
          required:
            - in_progress
            - completed
            - failed
            - cancelled
            - total
        status:
          description: >-
            The status of the vector store, which can be either `expired`,
            `in_progress`, or `completed`. A status of `completed` indicates
            that the vector store is ready for use.
          type: string
          enum:
            - expired
            - in_progress
            - completed
        expires_after:
          $ref: '#/components/schemas/VectorStoreExpirationAfter'
        expires_at:
          description: >-
            The Unix timestamp (in seconds) for when the vector store will
            expire.
          type: integer
          nullable: true
        last_active_at:
          description: >-
            The Unix timestamp (in seconds) for when the vector store was last
            active.
          type: integer
          nullable: true
        metadata:
          $ref: '#/components/schemas/Metadata'
      required:
        - id
        - object
        - usage_bytes
        - created_at
        - status
        - last_active_at
        - name
        - file_counts
        - metadata
      x-oaiMeta:
        name: The vector store object
        example: |
          {
            "id": "vs_123",
            "object": "vector_store",
            "created_at": 1698107661,
            "usage_bytes": 123456,
            "last_active_at": 1698107661,
            "name": "my_vector_store",
            "status": "completed",
            "file_counts": {
              "in_progress": 0,
              "completed": 100,
              "cancelled": 0,
              "failed": 0,
              "total": 100
            },
            "last_used_at": 1698107661
          }
    VectorStoreExpirationAfter:
      type: object
      title: Vector store expiration policy
      description: The expiration policy for a vector store.
      properties:
        anchor:
          description: >-
            Anchor timestamp after which the expiration policy applies.
            Supported anchors: `last_active_at`.
          type: string
          enum:
            - last_active_at
          x-stainless-const: true
        days:
          description: >-
            The number of days after the anchor time that the vector store will
            expire.
          type: integer
          minimum: 1
          maximum: 365
      required:
        - anchor
        - days
    AutoChunkingStrategyRequestParam:
      type: object
      title: Auto Chunking Strategy
      description: >-
        The default strategy. This strategy currently uses a
        `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
      additionalProperties: false
      properties:
        type:
          type: string
          description: Always `auto`.
          enum:
            - auto
          x-stainless-const: true
      required:
        - type
    StaticChunkingStrategyRequestParam:
      type: object
      title: Static Chunking Strategy
      description: >-
        Customize your own chunking strategy by setting chunk size and chunk
        overlap.
      additionalProperties: false
      properties:
        type:
          type: string
          description: Always `static`.
          enum:
            - static
          x-stainless-const: true
        static:
          $ref: '#/components/schemas/StaticChunkingStrategy'
      required:
        - type
        - static
    Metadata:
      type: object
      description: >
        Set of 16 key-value pairs that can be attached to an object. This can be

        useful for storing additional information about the object in a
        structured

        format, and querying for objects via API or the dashboard. 


        Keys are strings with a maximum length of 64 characters. Values are
        strings

        with a maximum length of 512 characters.
      additionalProperties:
        type: string
      x-oaiTypeLabel: map
      nullable: true
    StaticChunkingStrategy:
      type: object
      additionalProperties: false
      properties:
        max_chunk_size_tokens:
          type: integer
          minimum: 100
          maximum: 4096
          description: >-
            The maximum number of tokens in each chunk. The default value is
            `800`. The minimum value is `100` and the maximum value is `4096`.
        chunk_overlap_tokens:
          type: integer
          description: >
            The number of tokens that overlap between chunks. The default value
            is `400`.


            Note that the overlap must not exceed half of
            `max_chunk_size_tokens`.
      required:
        - max_chunk_size_tokens
        - chunk_overlap_tokens
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````