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

# Upload a file

> Uploads a media file. Send the file as `multipart/form-data`. The returned `id` can be referenced in `media_item_uuids` when sending a message.



## OpenAPI

````yaml /api-reference/openapi.json post /files
openapi: 3.1.0
info:
  title: Sotto API
  version: 1.0.0
  description: >-
    The Sotto API provides programmatic access to manage users, send messages,
    upload files, configure webhooks, and read your segments and custom data
    fields. All requests are authenticated with an HMAC-SHA256 signature. See
    the **Authentication** guide for signing details.
  contact:
    name: Sotto Support
    email: support@bigco.ai
servers:
  - url: https://api.bigco.ai/api/v1
    description: Production
security:
  - hmacSignature: []
tags:
  - name: Users
    description: Create, retrieve, update, and delete users.
  - name: Messages
    description: Send messages to a user.
  - name: Files
    description: Upload media files for use in messages.
  - name: Brand
    description: Retrieve information about your brand.
  - name: Webhooks
    description: Subscribe to and manage event callbacks.
  - name: Segments
    description: Read the audience segments configured for your brand.
  - name: Custom Data
    description: Read the custom data fields configured for your brand.
paths:
  /files:
    post:
      tags:
        - Files
      summary: Upload a file
      description: >-
        Uploads a media file. Send the file as `multipart/form-data`. The
        returned `id` can be referenced in `media_item_uuids` when sending a
        message.
      operationId: createFile
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: The binary file to upload.
              required:
                - file
      responses:
        '200':
          description: The uploaded file record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileExternalAPI'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    FileExternalAPI:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: >-
            The unique ID of the uploaded file. Reference this in
            `media_item_uuids`.
          example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        file_name:
          type: string
          example: my_image.jpeg
        mime_type:
          type:
            - string
            - 'null'
          example: image/jpeg
        uploaded_at:
          type: string
          format: date-time
          description: UTC timestamp when the file was uploaded.
          example: '2024-05-15T10:29:50Z'
      required:
        - id
        - file_name
        - uploaded_at
    Error:
      type: object
      properties:
        detail:
          type: object
          properties:
            type:
              type: string
              description: Machine-readable error type.
              example: not_authenticated
            msg:
              type: string
              description: Human-readable error message.
              example: HMAC signature verification failed
          required:
            - type
            - msg
      required:
        - detail
  responses:
    BadRequest:
      description: Bad request — the request was invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized — HMAC signature verification failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: not_authenticated
              msg: HMAC signature verification failed
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: UNCAUGHT_ERROR
              msg: Internal server error
  securitySchemes:
    hmacSignature:
      type: apiKey
      in: header
      name: x-bigco-hmac-sha256
      description: >-
        Base64-encoded HMAC-SHA256 signature of the request. Every request must
        also include the `x-bigco-hmac-username` and `x-date` headers, and
        POST/PUT requests must include `x-digest`. See the Authentication guide
        for the full signing procedure.

````