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

# Upload Contact File

> Upload a file to a contact.



## OpenAPI

````yaml https://api.useinvent.com/openapi.json post /orgs/{org_id}/contacts/{contact_id}/files
openapi: 3.1.0
info:
  version: 1.0.0
  title: Invent API
servers:
  - url: https://api.useinvent.com
security:
  - bearerAuth: []
paths:
  /orgs/{org_id}/contacts/{contact_id}/files:
    post:
      tags:
        - Orgs Contacts
      summary: Upload Contact File
      description: Upload a file to a contact.
      parameters:
        - schema:
            type: string
          required: true
          description: Org ID
          name: org_id
          in: path
        - schema:
            type: string
          required: true
          description: Contact ID
          name: contact_id
          in: path
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileSchema'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateFileSchema'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactFileSchema'
components:
  schemas:
    CreateFileSchema:
      type: object
      properties:
        file:
          anyOf:
            - type: string
              format: binary
            - $ref: '#/components/schemas/FileDataSchema'
            - type: string
          description: >-
            File to be uploaded. It can be a file object, a base64 encoded
            string, or a file data object containing base64 data, name, and
            type.
        file_url:
          type: string
          description: URL of the file to be uploaded
          example: https://example.com/files/document.pdf
        allowed_types:
          $ref: '#/components/schemas/FileAllowedTypesSchema'
    ContactFileSchema:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the file
        file_path:
          type: string
          maxLength: 2048
          description: Path to the file in the storage system
        file_filename:
          type: string
          maxLength: 255
          description: Name of the file
          example: document.pdf
        file_size:
          type: number
          description: Size of the file in bytes
          example: 1024
        file_mimetype:
          type: string
          maxLength: 255
          description: MIME type of the file
          example: application/pdf
        file_url:
          type: string
          maxLength: 2048
          description: URL to access the file
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp when the file was created
        source:
          $ref: '#/components/schemas/ContactFileSourceSchema'
        user:
          allOf:
            - $ref: '#/components/schemas/UserLimitedSchema'
            - description: >-
                Staff member who linked the file to the contact. Null when the
                file came from the contact themselves or was generated by the
                assistant.
      required:
        - id
        - file_path
        - file_filename
        - file_size
        - file_mimetype
        - file_url
        - created_at
        - source
      description: A file in a contact collection, with its origin metadata
    FileDataSchema:
      type: object
      properties:
        data:
          type: string
          description: URL, Raw or Base64 encoded file data.
          example: SGVsbG8sIHdvcmxkIQ==
        type:
          type: string
          maxLength: 128
          description: Mime type of the file, if not provided it will be inferred.
          example: application/pdf
        name:
          type: string
          minLength: 1
          description: Name of the file.
          example: document.pdf
        encoding:
          type: string
          enum:
            - base64
            - raw
          description: >-
            Encoding of the file data when it's a direct input, by default
            base64 is expected.
          example: base64
      required:
        - data
      description: Data payload for creating a file
    FileAllowedTypesSchema:
      type: array
      items:
        type: string
        maxLength: 255
      maxItems: 255
      default:
        - '*/*'
      description: >-
        The allowed mime types for the file field (e.g. image/*,
        application/pdf)
    ContactFileSourceSchema:
      type: string
      enum:
        - direct
        - comment
        - chat
      description: >-
        Where the file came from in the contact: a direct upload, attached to a
        comment, or sent in a chat
    UserLimitedSchema:
      type: object
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
        email:
          type: string
          format: email
        avatar:
          type:
            - string
            - 'null'
        seen_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - name
        - email
        - avatar
        - seen_at
      description: The assigned user for the conversation
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer token authentication using your API key

````