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

# Upsert Ingestion Doc



## OpenAPI

````yaml POST /onyx-api/ingestion
openapi: 3.1.0
info:
  title: Onyx API
  description: Onyx API for AI-powered enterprise search and chat
  version: Development
servers:
  - url: https://cloud.onyx.app/api
security: []
paths:
  /onyx-api/ingestion:
    post:
      tags:
        - public
      summary: Upsert Ingestion Doc
      operationId: upsert_ingestion_doc
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestionDocument'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestionResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    IngestionDocument:
      properties:
        document:
          $ref: '#/components/schemas/DocumentBase'
        cc_pair_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cc Pair Id
      type: object
      required:
        - document
      title: IngestionDocument
    IngestionResult:
      properties:
        document_id:
          type: string
          title: Document Id
        already_existed:
          type: boolean
          title: Already Existed
      type: object
      required:
        - document_id
        - already_existed
      title: IngestionResult
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentBase:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        sections:
          items:
            anyOf:
              - $ref: '#/components/schemas/TextSection'
              - $ref: '#/components/schemas/ImageSection'
          type: array
          title: Sections
        source:
          anyOf:
            - $ref: '#/components/schemas/DocumentSource'
            - type: 'null'
        semantic_identifier:
          type: string
          title: Semantic Identifier
        metadata:
          additionalProperties:
            anyOf:
              - type: string
              - items:
                  type: string
                type: array
          type: object
          title: Metadata
        doc_updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Doc Updated At
        chunk_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Count
        primary_owners:
          anyOf:
            - items:
                $ref: '#/components/schemas/BasicExpertInfo'
              type: array
            - type: 'null'
          title: Primary Owners
        secondary_owners:
          anyOf:
            - items:
                $ref: '#/components/schemas/BasicExpertInfo'
              type: array
            - type: 'null'
          title: Secondary Owners
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        from_ingestion_api:
          type: boolean
          title: From Ingestion Api
          default: false
        additional_info:
          title: Additional Info
        external_access:
          anyOf:
            - $ref: '#/components/schemas/ExternalAccess'
            - type: 'null'
        doc_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Doc Metadata
      type: object
      required:
        - sections
        - semantic_identifier
        - metadata
      title: DocumentBase
      description: >-
        Used for Onyx ingestion api, the ID is inferred before use if not
        provided
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TextSection:
      properties:
        link:
          anyOf:
            - type: string
            - type: 'null'
          title: Link
        text:
          type: string
          title: Text
        image_file_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Image File Id
      type: object
      required:
        - text
      title: TextSection
      description: Section containing text content
    ImageSection:
      properties:
        link:
          anyOf:
            - type: string
            - type: 'null'
          title: Link
        text:
          anyOf:
            - type: string
            - type: 'null'
          title: Text
        image_file_id:
          type: string
          title: Image File Id
      type: object
      required:
        - image_file_id
      title: ImageSection
      description: Section containing an image reference
    DocumentSource:
      type: string
      enum:
        - ingestion_api
        - slack
        - web
        - google_drive
        - gmail
        - requesttracker
        - github
        - gitbook
        - gitlab
        - guru
        - bookstack
        - outline
        - confluence
        - jira
        - slab
        - productboard
        - file
        - coda
        - notion
        - zulip
        - linear
        - hubspot
        - document360
        - gong
        - google_sites
        - zendesk
        - loopio
        - dropbox
        - sharepoint
        - teams
        - salesforce
        - discourse
        - axero
        - clickup
        - mediawiki
        - wikipedia
        - asana
        - s3
        - r2
        - google_cloud_storage
        - oci_storage
        - xenforo
        - not_applicable
        - discord
        - freshdesk
        - fireflies
        - egnyte
        - airtable
        - highspot
        - drupal_wiki
        - imap
        - bitbucket
        - testrail
        - mock_connector
        - user_file
      title: DocumentSource
    BasicExpertInfo:
      properties:
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
        middle_initial:
          anyOf:
            - type: string
            - type: 'null'
          title: Middle Initial
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
      type: object
      title: BasicExpertInfo
      description: >-
        Basic Information for the owner of a document, any of the fields can be
        left as None

        Display fallback goes as follows:

        - first_name + (optional middle_initial) + last_name

        - display_name

        - email

        - first_name
    ExternalAccess:
      properties:
        external_user_emails:
          items:
            type: string
          type: array
          uniqueItems: true
          title: External User Emails
        external_user_group_ids:
          items:
            type: string
          type: array
          uniqueItems: true
          title: External User Group Ids
        is_public:
          type: boolean
          title: Is Public
      type: object
      required:
        - external_user_emails
        - external_user_group_ids
        - is_public
      title: ExternalAccess
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````