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

# Upload Media (File)

> Upload a media file directly to the CMS library

Uploads a file directly to the media library as `multipart/form-data`.

<Warning>
  `filename` must include a file extension, and it must match the file you send in `media` — e.g. `hero-image.jpg` for a JPEG.
</Warning>

<Info>
  To register an existing external URL instead of uploading a file, see [Register Media (URL)](/dxp/api-reference/content-management/media/register-media-url). Both pages document the same endpoint — pick whichever example below matches how you're sending the request.
</Info>

#### Example Request

```bash theme={null}
curl -X POST \
  'https://cms.thepublive.com/publisher/123/media-library/' \
  -H 'Authorization: Basic <BASE64_AUTH_TOKEN>' \
  -H 'Content-Type: multipart/form-data' \
  -F 'filename=hero-image.jpg' \
  -F 'media=@/path/to/hero-image.jpg' \
  -F 'alt_text=Hero banner image' \
  -F 'source=Staff Photographer'
```


## OpenAPI

````yaml openapi/media-upload-file.json POST /publisher/{publisher_id}/media-library/
openapi: 3.1.0
info:
  title: Publive Media Library — Upload File
  version: 1.0.0
  description: >-
    Companion spec for the Upload Media (File) documentation page. Documents the
    same real endpoint as openapi/media-register-url.json and the Media
    Library's other endpoints in openapi/content-management.json, scoped to just
    its multipart/form-data request variant so each documentation page shows
    only its own content type.
servers:
  - url: https://cms.thepublive.com
security:
  - basicAuth: []
paths:
  /publisher/{publisher_id}/media-library/:
    post:
      tags:
        - Media Library
      summary: Upload Media (File)
      description: >-
        Uploads a file directly to the CMS media library.


        <Note>To register an existing external URL instead of uploading a file,
        see [Register Media
        (URL)](/dxp/api-reference/content-management/media/register-media-url).</Note>
      operationId: uploadMediaFile
      parameters:
        - $ref: '#/components/parameters/PublisherId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                filename:
                  type: string
                  description: >-
                    Must include a file extension matching the file sent in
                    `media`.
                  example: hero-image.jpg
                media:
                  type: string
                  format: binary
                  description: Immutable after creation. The file to upload.
                alt_text:
                  type: string
                caption:
                  type: string
                source:
                  type: string
                type:
                  type: string
                  enum:
                    - Image
                    - Video
                    - File
                  description: Immutable after creation.
                meta_data:
                  type: object
              required:
                - filename
                - media
      responses:
        '200':
          description: Created
          content:
            application/json:
              example:
                status: success
                message: Created Successfully
                data:
                  id: 1000
                  filename: hero-image.jpg
                  alt_text: Hero banner image
                  caption: ''
                  path: https://cdn.publive.com/images/hero-image.jpg
                  source: Staff Photographer
                  type: Image
                  meta_data: {}
                  date: '2026-02-12'
                  member: admin
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    PublisherId:
      name: publisher_id
      in: path
      required: true
      schema:
        type: string
      description: Your Publisher ID
  responses:
    Unauthorized:
      description: Invalid or missing credentials
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
          example:
            detail: Invalid Auth Credentials
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic Auth using your Publive API key pair, base64-encoded.

````