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

# Upload file

> Uploads a file to attach to messages.



## OpenAPI

````yaml /developers/openapi.yaml post /v1/files
openapi: 3.0.3
info:
  title: TalkToHumans Public API
  version: 1.0.0
  license:
    name: Proprietary
  description: >
    Read and organize the LinkedIn organization data your team already manages
    in TalkToHumans: accounts, contacts, signals, content, tags, notes, custom
    fields, sequence state, conversations, templates, and views.
servers:
  - url: https://api.talktohumans.app
    description: TalkToHumans API
security:
  - bearerAuth: []
tags:
  - name: Organization
    description: Organization details for the current API key.
  - name: LinkedIn
    description: LinkedIn accounts, contacts, companies, and conversations.
  - name: Activity
    description: Activity for organization reporting.
  - name: Enrich
    description: Profile enrichment for LinkedIn contacts and companies.
  - name: Views
    description: Saved TalkToHumans views.
  - name: Sequences
    description: Sequences of contacts and conversations.
  - name: Templates
    description: Message and sequence templates.
  - name: Custom fields
    description: Custom fields for contacts and companies.
  - name: Tags
    description: Tags for contacts and companies.
  - name: Content
    description: LinkedIn posts and comments, and the people who engage with them.
  - name: Agents
    description: Playbooks and feedback for AI agents, shared with the MCP.
paths:
  /v1/files:
    post:
      tags:
        - LinkedIn
      summary: Upload file
      description: Uploads a file to attach to messages.
      operationId: uploadFile
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadFileForm'
          application/json:
            schema:
              $ref: '#/components/schemas/UploadFileRequest'
            example:
              url: https://example.com/demo.gif
      responses:
        '201':
          description: >-
            File uploaded. Attach it by its `file_id`; files nothing uses are
            deleted after 30 days.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadFileEnvelope'
              example:
                data:
                  file:
                    file_id: file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e
                    kind: image
                    file_name: demo.gif
                    mime_type: image/gif
                    size_bytes: 482113
                    width: 480
                    height: 270
                    url: >-
                      https://d111111abcdef8.cloudfront.net/file_3f2b8c1d9a4e4b7c8d2e1f0a9b8c7d6e?Signature=abc
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    UploadFileForm:
      type: object
      additionalProperties: false
      description: The file itself, sent as `multipart/form-data`.
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: >-
            The file: an image (such as a GIF), a video, a PDF, or M4A audio, up
            to 20 MB.
    UploadFileRequest:
      type: object
      additionalProperties: false
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: >-
            Public https link to the file: an image (such as a GIF), a video, a
            PDF, or M4A audio, up to 20 MB.
    UploadFileEnvelope:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/UploadFileResponse'
    UploadFileResponse:
      type: object
      additionalProperties: false
      required:
        - file
      properties:
        file:
          $ref: '#/components/schemas/LinkedInFile'
    Error:
      type: object
      additionalProperties: false
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Machine-readable error code.
          enum:
            - unauthorized
            - forbidden
            - not_found
            - bad_request
            - internal_error
            - conflict
            - rate_limit_exceeded
            - account_shared_access_required
            - linkedin_not_connected
            - workspace_setup_required
            - billing_payment_failed
            - billing_subscription_incomplete
            - billing_subscription_expired
            - billing_grace_period
            - billing_feature_not_available
            - billing_insufficient_credits
            - billing_invalid
            - enrichment_failed
            - enrichment_in_progress
            - linkedin_profile_not_found
        message:
          type: string
          description: Human-readable error message.
        debug:
          type: string
          description: Development-only debug details.
    LinkedInFile:
      type: object
      additionalProperties: false
      description: An uploaded file. Writes read only `file_id`.
      required:
        - file_id
      properties:
        file_id:
          type: string
          description: File ID returned by `POST /v1/files`.
        kind:
          type: string
          description: '`file` is a PDF.'
          enum:
            - image
            - video
            - audio
            - file
        file_name:
          type: string
        mime_type:
          type: string
        size_bytes:
          type: integer
        duration_ms:
          type: integer
          description: Length of a video or audio file in milliseconds, when known.
        width:
          type: integer
        height:
          type: integer
        url:
          type: string
          format: uri
          description: Link to open the file, valid for an hour.
  responses:
    BadRequest:
      description: Invalid request. `message` explains what to fix.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: bad_request
            message: >-
              field "account_id" must be a string, got number; IDs are strings,
              e.g. "42"
    Unauthorized:
      description: >-
        Missing, malformed, invalid, or retired API key, or an invalid or
        expired login access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingAuthorization:
              value:
                code: unauthorized
                message: Authorization header is required
            invalidAuthorizationFormat:
              value:
                code: unauthorized
                message: Authorization header must use Bearer scheme
            invalidAPIKey:
              value:
                code: unauthorized
                message: Invalid API key
            invalidAccessToken:
              value:
                code: unauthorized
                message: Invalid or expired access token
    Forbidden:
      description: >-
        API access is not enabled for the organization, the API key cannot
        resolve to an active organization user, or the login has no workspace
        yet.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              value:
                code: forbidden
                message: you don't have access to this organization
            featureUnavailable:
              value:
                code: billing_feature_not_available
                message: >-
                  Feature 'TalkToHumansAPI' is not available in your current
                  plan
            insufficientCredits:
              value:
                code: billing_insufficient_credits
                message: Insufficient credits
            apiKeyPrincipalInvalid:
              value:
                code: forbidden
                message: >-
                  This API key is no longer linked to an active organization
                  user. Ask an organization admin to regenerate it
            workspaceSetupRequired:
              value:
                code: workspace_setup_required
                message: >-
                  This TalkToHumans sign-in has no workspace yet. Open
                  https://app.talktohumans.app, sign in with the same email to
                  finish setting up TalkToHumans, then try again.
    RateLimited:
      description: >-
        Rate limit exceeded. Public routes allow 50 requests per 10 seconds per
        IP and endpoint.
      headers:
        Retry-After:
          description: Seconds to wait before retrying the request.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: rate_limit_exceeded
            message: Rate limit exceeded
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: internal_error
            message: An internal error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Pass `Authorization: Bearer <credential>`, where the credential is
        either:

        - an API key (`sk_…`), generated by an organization admin in Settings,
        for scripts and automation;

        - an access token from `tth auth login` (the TalkToHumans CLI), which
        any member of the workspace can use.


        Both resolve to the same organization and user. A login token acts in
        the user's workspace: one with no workspace yet returns `403
        workspace_setup_required`, and one in several workspaces returns `403
        forbidden` (use an API key instead).

````

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