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

# Upload Media

> Upload an image or video once and reuse it in every message by its `media_id`. Send the file as `multipart/form-data`, or send JSON with a `url` for Oliver to copy once. Files never expire.

Accepted: jpeg, png, gif and mp4, at most 5 MB (the MMS limit: an image message reaches phones without RCS as an MMS). The type is read from the file itself.



## OpenAPI

````yaml POST /services/core/open_api/v1/media
openapi: 3.1.0
info:
  title: Oliver Partner API
  description: API for partners to interact with Oliver
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://partner-api.getoliver.com
security:
  - bearerAuth: []
paths:
  /services/core/open_api/v1/media:
    post:
      summary: Upload media
      description: >-
        Upload an image or video once and reuse it in every message by its
        `media_id`. Send the file as `multipart/form-data`, or send JSON with a
        `url` for Oliver to copy once. Files never expire.


        Accepted: jpeg, png, gif and mp4, at most 5 MB (the MMS limit: an image
        message reaches phones without RCS as an MMS). The type is read from the
        file itself.
      parameters:
        - name: X-Client-Id
          in: header
          required: false
          description: >-
            Optional. Files belong to your API account, not a practice, and work
            at every practice you can send to.
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/MediaUpload'
          application/json:
            schema:
              $ref: '#/components/schemas/MediaImport'
      responses:
        '200':
          description: An existing file returned for a repeated `reference_id`
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Media'
                  message:
                    type: string
                    nullable: true
        '201':
          description: Uploaded
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Media'
                  message:
                    type: string
                    nullable: true
        '400':
          description: >-
            Bad Request: a missing, unsupported or oversized file, a URL that
            couldn't be downloaded, or both `file` and `url`. `data.errors`
            names the field (`file` or `url`) and says what was detected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralError'
        '429':
          description: 'Too Many Requests: more than 30 uploads and replaces a minute'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneralError'
components:
  schemas:
    MediaUpload:
      type: object
      required:
        - file
      properties:
        file:
          type: string
          format: binary
          description: A jpeg, png, gif or mp4 file, at most 5 MB.
        reference_id:
          type: string
          description: >-
            Optional, unique per API account. Uploading again with the same
            `reference_id` returns the existing file instead of storing a copy,
            even if the file is different, so a retry is safe. You can also use
            it in place of `media_id` in the media endpoints' URLs.
    MediaImport:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: >-
            An https URL that serves the file directly (redirects aren't
            followed). Oliver downloads it once and never fetches it again.
          example: https://partner.example.com/images/rabies-reminder.png
        reference_id:
          type: string
          description: As for a file upload.
    Media:
      type: object
      properties:
        media_id:
          type: string
          description: Pass this as `media_id` in message and AI Outbound content.
          example: 6f1c2b9e-3d4a-4c7e-9b1a-2e5f8d7c6a10
        url:
          type: string
          format: uri
          description: >-
            The file's public URL on Oliver's CDN. A replace gives the file a
            new URL.
          example: >-
            https://cdn.getoliver.com/m/0d3c9a52-8f1e-4b7a-a6c4-5e2f1b9d8c37/image.png
        content_type:
          type: string
          enum:
            - image/jpeg
            - image/png
            - image/gif
            - video/mp4
          description: >-
            Detected from the file itself, not from the upload's headers or file
            name.
        size_bytes:
          type: integer
          example: 182344
        file_name:
          type: string
          nullable: true
          description: The uploaded file's name, or the last part of the imported URL.
          example: rabies-reminder.png
        reference_id:
          type: string
          nullable: true
          example: rabies-reminder
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          description: When the file was last uploaded or replaced.
    ValidationError:
      type: object
      required:
        - success
        - message
        - data
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: The first error.
          example: content.card.buttons must have at most 4 items
        data:
          type: object
          properties:
            message:
              type: string
            errors:
              type: array
              description: Every offending field.
              items:
                type: object
                properties:
                  field:
                    type: string
                    example: content.card.buttons
                    nullable: true
                    description: >-
                      The offending field, or null for a request-level error
                      such as sending outside the practice's sending hours.
                  message:
                    type: string
                    example: must have at most 4 items
    GeneralError:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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