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

# Upload Face Source File

> Create a compile document or thread from an uploaded file.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/faces/{face_id}/upload
openapi: 3.1.0
info:
  title: faces
  version: 0.101.0
servers: []
security: []
paths:
  /v1/faces/{face_id}/upload:
    post:
      tags:
        - Faces
      summary: Upload Face Source File
      description: Create a compile document or thread from an uploaded file.
      operationId: upload_face_source_file_v1_faces__face_id__upload_post
      parameters:
        - name: face_id
          in: path
          required: true
          schema:
            type: string
            title: Face Id
        - name: type
          in: query
          required: false
          schema:
            type: string
            pattern: ^(document|thread|thread_json|email_jsonl|jsonl)$
            description: >-
              What the file is: document, thread, thread_json or email_jsonl.
              Each line of an email_jsonl file is a JSON object with author
              ("self" if the face wrote it, else "other"), sender, date
              (ISO-8601) and the message text in plaintextBody (or htmlBody or
              snippet; body and text are accepted for plaintextBody), plus
              optional kind (the medium, e.g. "email"), subject, toRecipients,
              ccRecipients, id and prior_message. Any other field is refused,
              and an invalid line's error lists everything wrong with it.
            default: document
            title: Type
          description: >-
            What the file is: document, thread, thread_json or email_jsonl. Each
            line of an email_jsonl file is a JSON object with author ("self" if
            the face wrote it, else "other"), sender, date (ISO-8601) and the
            message text in plaintextBody (or htmlBody or snippet; body and text
            are accepted for plaintextBody), plus optional kind (the medium,
            e.g. "email"), subject, toRecipients, ccRecipients, id and
            prior_message. Any other field is refused, and an invalid line's
            error lists everything wrong with it.
        - name: perspective
          in: query
          required: false
          schema:
            type: string
            pattern: ^(first-person|third-person)$
            default: third-person
            title: Perspective
        - name: face_speaker
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Face Speaker
        - name: emails_per_thread
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            default: 50
            title: Emails Per Thread
        - name: per_thread
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 1000
                minimum: 1
              - type: 'null'
            description: >-
              Messages per thread. The neutral spelling of `emails_per_thread`;
              wins when both are sent.
            title: Per Thread
          description: >-
            Messages per thread. The neutral spelling of `emails_per_thread`;
            wins when both are sent.
        - name: strict
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              corpus uploads: all-or-nothing (422 on any invalid message)
              instead of the default skip-and-report
            default: false
            title: Strict
          description: >-
            corpus uploads: all-or-nothing (422 on any invalid message) instead
            of the default skip-and-report
        - name: medium
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              type=document only: what the uploaded file IS (email, essay,
              conversation,...)
            title: Medium
          description: >-
            type=document only: what the uploaded file IS (email, essay,
            conversation,...)
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_upload_face_source_file_v1_faces__face_id__upload_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/UploadDocumentResult'
                  - $ref: '#/components/schemas/UploadThreadResult'
                title: >-
                  Response Upload Face Source File V1 Faces  Face Id  Upload
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_upload_face_source_file_v1_faces__face_id__upload_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
      type: object
      required:
        - file
      title: Body_upload_face_source_file_v1_faces__face_id__upload_post
    UploadDocumentResult:
      properties:
        rush_premium_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Rush Premium Usd
          description: >-
            While this compile is queued for its scheduled start: what a rush
            would cost you now, in USD, paid from credit (the difference from
            the standard rate when your plan covers the compile, the whole rush
            price when it is paid as you go). Null once it has started, when it
            is already a rush, or when there is no scheduled start.
        document_id:
          type: string
          title: Document Id
        alias:
          type: string
          title: Alias
        label:
          type: string
          title: Label
        source:
          type: string
          title: Source
        version:
          type: integer
          title: Version
        content:
          type: string
          title: Content
        token_count:
          type: integer
          title: Token Count
        tokens_used:
          type: integer
          title: Tokens Used
        tokens_limit:
          type: integer
          title: Tokens Limit
        synced:
          type: boolean
          title: Synced
        synced_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Synced Version
          description: >-
            Which revision the compile ran on. Null means this source has never
            been compiled. Lower than `version` means the text has been edited
            since.
        synced_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Synced At
          description: >-
            When this document was last compiled. Null means never, or compiled
            before the instant was recorded.
        read_only:
          type: boolean
          title: Read Only
          default: false
        perspective:
          type: string
          title: Perspective
          default: first-person
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        medium:
          anyOf:
            - type: string
            - type: 'null'
          title: Medium
        warnings:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Warnings
          description: >-
            Advice about the text just saved, as `{code, message}` entries.
            Empty when there is nothing to report.
        stall_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Stall Reason
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
        finishing:
          type: boolean
          title: Finishing
          default: false
        current_counts:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Current Counts
        compilable:
          type: boolean
          title: Compilable
          default: true
        compile_blocked_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Compile Blocked Reason
        word_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Word Count
        compile_min_words:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compile Min Words
        style:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Style
        type:
          type: string
          title: Type
          default: document
        status:
          type: string
          title: Status
          description: >-
            One of `not_compiled`, `transcribing`, `queued`, `compiling`,
            `compiled`,

            `paused`, `failed`.
          readOnly: true
        progress:
          type: number
          title: Progress
          description: How far the compile has got, from 0 to 1. 1 only when `compiled`.
          readOnly: true
        starts_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Starts At
          description: >-
            The compile's scheduled start, ISO 8601 UTC, or when it started.
            Null when it

            starts at once.
          readOnly: true
        rush:
          type: boolean
          title: Rush
          description: >-
            True when this compile was queued as a rush: it starts now, at the
            rush rate.
          readOnly: true
      type: object
      required:
        - document_id
        - alias
        - label
        - source
        - version
        - content
        - token_count
        - tokens_used
        - tokens_limit
        - synced
        - created_at
        - updated_at
        - status
        - progress
        - starts_at
        - rush
      title: UploadDocumentResult
    UploadThreadResult:
      properties:
        rush_premium_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Rush Premium Usd
          description: >-
            While this compile is queued for its scheduled start: what a rush
            would cost you now, in USD, paid from credit (the difference from
            the standard rate when your plan covers the compile, the whole rush
            price when it is paid as you go). Null once it has started, when it
            is already a rush, or when there is no scheduled start.
        thread_id:
          type: string
          title: Thread Id
        label:
          type: string
          title: Label
        alias:
          type: string
          title: Alias
        source:
          type: string
          title: Source
        messages:
          items:
            $ref: '#/components/schemas/CompileMessageObject'
          type: array
          title: Messages
        message_count:
          type: integer
          title: Message Count
        messages_archived:
          type: integer
          title: Messages Archived
        synced:
          type: boolean
          title: Synced
        synced_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Synced At
          description: >-
            When this thread was last compiled. Null means never. A message
            whose `timestamp` is later than this is one the compile has not
            read.
        version:
          type: integer
          title: Version
          description: >-
            The thread's current revision. Changes when the messages change,
            including a reorder; a label edit does not move it.
          default: 1
        synced_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Synced Version
          description: >-
            The revision the compile read. Lower than `version` means the
            messages have changed since. Null with a non-null `synced_at` means
            the thread was compiled before this was recorded: unknown, not
            stale.
        token_count:
          type: integer
          title: Token Count
        tokens_used:
          type: integer
          title: Tokens Used
        tokens_limit:
          type: integer
          title: Tokens Limit
        interviewer_billing_source:
          anyOf:
            - type: string
            - type: 'null'
          title: Interviewer Billing Source
        read_only:
          type: boolean
          title: Read Only
          default: false
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        corpus_medium:
          anyOf:
            - type: string
            - type: 'null'
          title: Corpus Medium
        medium:
          anyOf:
            - type: string
            - type: 'null'
          title: Medium
        stall_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Stall Reason
        finishing:
          type: boolean
          title: Finishing
          default: false
        current_counts:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Current Counts
        compilable:
          type: boolean
          title: Compilable
          default: true
        compile_blocked_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Compile Blocked Reason
        type:
          type: string
          title: Type
          default: thread
        warning_count:
          type: integer
          title: Warning Count
          default: 0
        warnings:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Warnings
          default: []
        status:
          type: string
          title: Status
          description: >-
            One of `not_compiled`, `transcribing`, `queued`, `compiling`,
            `compiled`,

            `paused`, `failed`.
          readOnly: true
        progress:
          type: number
          title: Progress
          description: How far the compile has got, from 0 to 1. 1 only when `compiled`.
          readOnly: true
        starts_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Starts At
          description: >-
            The compile's scheduled start, ISO 8601 UTC, or when it started.
            Null when it

            starts at once.
          readOnly: true
        rush:
          type: boolean
          title: Rush
          description: >-
            True when this compile was queued as a rush: it starts now, at the
            rush rate.
          readOnly: true
      type: object
      required:
        - thread_id
        - label
        - alias
        - source
        - messages
        - message_count
        - messages_archived
        - synced
        - token_count
        - tokens_used
        - tokens_limit
        - created_at
        - updated_at
        - status
        - progress
        - starts_at
        - rush
      title: UploadThreadResult
      description: Result of a `type=thread` transcript upload.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CompileMessageObject:
      properties:
        role:
          type: string
          title: Role
        content:
          type: string
          title: Content
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Speaker label. Null when the message has no speaker attribution.
        timestamp:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Timestamp
          description: >-
            When this message was last written: created, or edited in place.
            Compare it against the thread's `synced_at` to tell whether this
            particular message has been compiled. Null means the instant is not
            recorded, which is not the same as edited.
      type: object
      required:
        - role
        - content
      title: CompileMessageObject
      description: One message being read back from a thread.
    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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.