> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add files to vector store

> Add parsed files to a vector store for indexing and search.
    
    This endpoint initiates an asynchronous process to add files to a vector store:
    1. Creates a background job to track the operation
    2. Starts a Temporal workflow to process the files
    3. Files are parsed, chunked, and embedded into the vector store
    4. Job status can be monitored via the jobs API
    
    **Authentication:**
    - Credentials can be provided either through project-level credentials or request-level credentials
    - For SGP Knowledge Base, SGP credentials are required
    
    **Process:**
    - The operation runs asynchronously in the background
    - Use the returned job entity to monitor progress
    - Files must be previously parsed (have parse_result_ids)
    
    **Returns:**
    - Job entity with ID, status, and metadata for tracking the operation progress
    
    **Example Request:**
    ```json
    {
        "parse_result_ids": ["parse_123", "parse_456"],
        "credentials": {
            "sgp": {
                "api_key": "your-api-key",
                "account_id": "your-account-id"
            }
        }
    }
    ```
    
    **Example Response:**
    ```json
    {
        "id": "job_123456789",
        "operation": "VECTOR_STORE",
        "status": "PENDING",
        "parameters": {
            "parse_result_ids": ["parse_123", "parse_456"]
        },
        "source_id": null,
        "project_id": "proj_987654321",
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z"
    }
    ```



## OpenAPI

````yaml https://dex.sgp.scale.com/openapi.json post /v1/projects/{project_id}/vector-stores/{vector_store_id}/files
openapi: 3.1.0
info:
  title: Document Understanding API
  description: API for uploading and processing documents
  version: 0.4.5
servers: []
security:
  - ApiKey: []
    AccountId: []
tags:
  - name: Projects
    description: Operations related to project creation and management
  - name: Files
    description: Operations related to file upload and access
  - name: Parse
    description: Operations related to starting parse jobs and accessing their results
  - name: Vector Stores
    description: Operations related to vector store creation and management
  - name: Extract
    description: Operations related to starting extract jobs and accessing their results
  - name: Research
    description: Dex Research agent kickoff and results.
  - name: Jobs
    description: Operations related to monitoring jobs and their status
paths:
  /v1/projects/{project_id}/vector-stores/{vector_store_id}/files:
    post:
      tags:
        - Vector Stores
      summary: Add files to vector store
      description: |-
        Add parsed files to a vector store for indexing and search.
            
            This endpoint initiates an asynchronous process to add files to a vector store:
            1. Creates a background job to track the operation
            2. Starts a Temporal workflow to process the files
            3. Files are parsed, chunked, and embedded into the vector store
            4. Job status can be monitored via the jobs API
            
            **Authentication:**
            - Credentials can be provided either through project-level credentials or request-level credentials
            - For SGP Knowledge Base, SGP credentials are required
            
            **Process:**
            - The operation runs asynchronously in the background
            - Use the returned job entity to monitor progress
            - Files must be previously parsed (have parse_result_ids)
            
            **Returns:**
            - Job entity with ID, status, and metadata for tracking the operation progress
            
            **Example Request:**
            ```json
            {
                "parse_result_ids": ["parse_123", "parse_456"],
                "credentials": {
                    "sgp": {
                        "api_key": "your-api-key",
                        "account_id": "your-account-id"
                    }
                }
            }
            ```
            
            **Example Response:**
            ```json
            {
                "id": "job_123456789",
                "operation": "VECTOR_STORE",
                "status": "PENDING",
                "parameters": {
                    "parse_result_ids": ["parse_123", "parse_456"]
                },
                "source_id": null,
                "project_id": "proj_987654321",
                "created_at": "2024-01-15T10:30:00Z",
                "updated_at": "2024-01-15T10:30:00Z"
            }
            ```
      operationId: >-
        add_files_to_vector_store_v1_projects__project_id__vector_stores__vector_store_id__files_post
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
        - name: vector_store_id
          in: path
          required: true
          schema:
            type: string
            title: Vector Store Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddParseResultsToVectorStoreRequest'
      responses:
        '200':
          description: >-
            Files added to vector store successfully. Job entity returned for
            tracking progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobEntity'
        '400':
          description: >-
            Bad request - Invalid credentials, missing parse results, or invalid
            vector store
        '404':
          description: Project or vector store not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error - Failed to start processing workflow
components:
  schemas:
    AddParseResultsToVectorStoreRequest:
      properties:
        parse_result_ids:
          items:
            type: string
          type: array
          title: Parse Result Ids
          description: IDs of the parse results
      type: object
      required:
        - parse_result_ids
      title: AddParseResultsToVectorStoreRequest
    JobEntity:
      properties:
        id:
          type: string
          title: Id
          description: ID of the entity
        project_id:
          type: string
          title: Project Id
          description: ID of the project
        object:
          type: string
          const: job
          title: Object
          default: job
        operation:
          $ref: '#/components/schemas/JobOperationType'
          description: Operation type (e.g., 'parse')
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Current job status
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Id
          description: Source document/file ID
        correlation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Correlation Id
          description: Request correlation ID for tracing
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the job was created
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
          description: When the job started processing
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: When the job completed
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Result
          description: Job result payload when completed
        progress:
          anyOf:
            - $ref: '#/components/schemas/BatchParseProgress'
            - type: 'null'
          description: Live progress payload (used by batch jobs)
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if job failed
        history:
          anyOf:
            - items:
                $ref: '#/components/schemas/JobHistoryEvent'
              type: array
            - type: 'null'
          title: History
          description: Timeline of job execution events
      type: object
      required:
        - id
        - project_id
        - operation
        - status
        - created_at
      title: JobEntity
      description: Job response model representing an asynchronous operation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    JobOperationType:
      type: string
      enum:
        - parse
        - batch_parse
        - extract
        - research
        - vector_store
        - chunk
        - summarization
        - create_index
        - update_index
      title: JobOperationType
      description: Enum for job operation values.
    JobStatus:
      type: string
      enum:
        - pending
        - running
        - succeeded
        - partially_succeeded
        - failed
        - cancelled
      title: JobStatus
      description: Enum for job status values.
    BatchParseProgress:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of files in the batch
        succeeded:
          type: integer
          title: Succeeded
          description: Number of successfully parsed files
        failed:
          type: integer
          title: Failed
          description: Number of files that failed to parse
        cancelled:
          type: integer
          title: Cancelled
          description: Number of cancelled child jobs
        pending:
          type: integer
          title: Pending
          description: Number of files still pending (0 when job is terminal)
        child_jobs:
          items:
            $ref: '#/components/schemas/BatchChildJobInfo'
          type: array
          title: Child Jobs
          description: Per-child job status
      type: object
      required:
        - total
        - succeeded
        - failed
        - cancelled
        - pending
        - child_jobs
      title: BatchParseProgress
      description: Live progress tracking for a batch parse job.
    JobHistoryEvent:
      properties:
        step:
          type: string
          title: Step
          description: Human-readable step name
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: When this event occurred
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
          description: Duration in milliseconds (for completed steps)
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Event status (e.g., 'completed', 'failed')
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Additional event details
      type: object
      required:
        - step
        - timestamp
      title: JobHistoryEvent
      description: A single event in the job execution timeline.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    BatchChildJobInfo:
      properties:
        source_document_id:
          type: string
          title: Source Document Id
          description: Source document ID
        job_id:
          type: string
          title: Job Id
          description: Child job ID
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Status of the child job
        parse_result_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parse Result Id
          description: Parse result ID if succeeded
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if failed
      type: object
      required:
        - source_document_id
        - job_id
        - status
      title: BatchChildJobInfo
      description: Status of a single child job within a batch.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication
    AccountId:
      type: apiKey
      in: header
      name: x-selected-account-id
      description: Selected Account ID

````