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

# Upload Sources



## OpenAPI

````yaml /openapi.json post /v1/wikis/{wiki_id}/sources
openapi: 3.1.0
info:
  description: Versioned API for hosted Almanac wikis.
  title: Almanac V1 API
  version: 0.1.11
servers:
  - url: https://almanac-backend-83vc.onrender.com
security:
  - bearerAuth: []
paths:
  /v1/wikis/{wiki_id}/sources:
    post:
      summary: Upload Sources
      operationId: upload_sources_v1_wikis__wiki_id__sources_post
      parameters:
        - in: path
          name: wiki_id
          required: true
          schema:
            title: Wiki Id
            type: string
        - in: header
          name: authorization
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_upload_sources_v1_wikis__wiki_id__sources_post
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HostedSourceUploadDTO'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    Body_upload_sources_v1_wikis__wiki_id__sources_post:
      properties:
        files:
          items:
            contentMediaType: application/octet-stream
            type: string
          minItems: 1
          title: Files
          type: array
        instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: Instruction
        provider:
          default: codex
          title: Worker
          type: string
      required:
        - files
      title: Body_upload_sources_v1_wikis__wiki_id__sources_post
      type: object
    HostedSourceUploadDTO:
      additionalProperties: false
      properties:
        batch:
          $ref: '#/components/schemas/HostedSourceBatchDTO'
        job:
          $ref: '#/components/schemas/HostedJobDTO'
        sources:
          items:
            $ref: '#/components/schemas/HostedSourceDTO'
          title: Sources
          type: array
      required:
        - batch
        - sources
        - job
      title: HostedSourceUploadDTO
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HostedSourceBatchDTO:
      additionalProperties: false
      properties:
        batch_id:
          title: Batch Id
          type: string
        created_at:
          title: Created At
          type: string
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
        source_count:
          title: Source Count
          type: integer
        status:
          $ref: '#/components/schemas/HostedSourceBatchStatus'
        status_label:
          title: Status Label
          type: string
        status_state:
          enum:
            - ready
            - running
            - failed
            - unknown
          title: Status State
          type: string
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
        updated_at:
          title: Updated At
          type: string
        wiki_id:
          title: Wiki Id
          type: string
      required:
        - batch_id
        - wiki_id
        - status
        - status_state
        - status_label
        - source_count
        - summary
        - error
        - created_at
        - updated_at
        - finished_at
      title: HostedSourceBatchDTO
      type: object
    HostedJobDTO:
      additionalProperties: false
      properties:
        created_at:
          title: Created At
          type: string
        current_step:
          anyOf:
            - type: string
            - type: 'null'
          title: Current Step
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
        import_batch_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Import Batch Id
        job_id:
          title: Job Id
          type: string
        kind:
          $ref: '#/components/schemas/HostedJobKind'
        operation:
          title: Operation
          type: string
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Worker
        started_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Started At
        status:
          $ref: '#/components/schemas/HostedJobStatus'
        status_label:
          title: Status Label
          type: string
        status_state:
          enum:
            - queued
            - running
            - succeeded
            - failed
            - unknown
          title: Status State
          type: string
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
        updated_at:
          title: Updated At
          type: string
        wiki_id:
          title: Wiki Id
          type: string
      required:
        - job_id
        - wiki_id
        - import_batch_id
        - kind
        - operation
        - status
        - current_step
        - provider
        - summary
        - error
        - status_state
        - status_label
        - created_at
        - updated_at
        - started_at
        - finished_at
      title: HostedJobDTO
      type: object
    HostedSourceDTO:
      additionalProperties: false
      properties:
        area:
          title: Area
          type: string
        created_at:
          title: Created At
          type: string
        folder:
          title: Folder
          type: string
        import_batch_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Import Batch Id
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        name:
          title: Name
          type: string
        original_filename:
          title: Original Filename
          type: string
        path:
          title: Path
          type: string
        sha256:
          anyOf:
            - type: string
            - type: 'null'
          title: Sha256
        size_bytes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size Bytes
        source_id:
          title: Source Id
          type: string
        status:
          $ref: '#/components/schemas/HostedSourceStatus'
        status_label:
          title: Status Label
          type: string
        status_state:
          enum:
            - ready
            - running
            - failed
            - unknown
          title: Status State
          type: string
        updated_at:
          title: Updated At
          type: string
        wiki_id:
          title: Wiki Id
          type: string
      required:
        - source_id
        - wiki_id
        - import_batch_id
        - path
        - area
        - folder
        - name
        - original_filename
        - mime_type
        - size_bytes
        - sha256
        - status
        - status_state
        - status_label
        - created_at
        - updated_at
      title: HostedSourceDTO
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    HostedSourceBatchStatus:
      enum:
        - uploading
        - queued
        - completed
        - failed
      title: HostedSourceBatchStatus
      type: string
    HostedJobKind:
      enum:
        - ingest
        - garden
      title: HostedJobKind
      type: string
    HostedJobStatus:
      enum:
        - queued
        - running
        - succeeded
        - failed
      title: HostedJobStatus
      type: string
    HostedSourceStatus:
      enum:
        - uploaded
        - completed
        - failed
      title: HostedSourceStatus
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: Almanac access token or API key
      scheme: bearer
      type: http

````