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

# Add media from a URL

> Download a file from a public https link into the media library.



## OpenAPI

````yaml /openapi.json post /media
openapi: 3.1.0
info:
  title: Postbase API
  version: 1.0.0
  description: >-
    Schedule and manage social posts on X, LinkedIn, Bluesky, Mastodon and
    YouTube. Authenticate with an API key from Postbase → Developers, sent as
    `Authorization: Bearer pb_live_…`.
  contact:
    url: https://www.postbase.so
  license:
    name: AGPL-3.0
    identifier: AGPL-3.0-only
servers:
  - url: https://www.postbase.so/api/v1
security:
  - bearerAuth: []
tags:
  - name: Posts
  - name: Media
  - name: Analytics
  - name: Webhooks
  - name: Channels
  - name: Account
paths:
  /media:
    post:
      tags:
        - Media
      summary: Add media from a URL
      description: Download a file from a public https link into the media library.
      operationId: addMedia
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                name:
                  type: string
              required:
                - url
            example:
              url: https://example.com/launch.png
      responses:
        '201':
          description: Added
          content:
            application/json:
              schema:
                type: object
                properties:
                  media:
                    $ref: '#/components/schemas/Media'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Media:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        type:
          type: string
          description: MIME type
        size_bytes:
          type: integer
        url:
          type: string
          format: uri
        created_at:
          type: string
          format: date-time
      required:
        - id
        - url
        - type
    Error:
      type: object
      properties:
        error:
          type: string
          description: A readable message
        code:
          type: string
          description: A stable code, e.g. not_found
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A pb_live_ API key

````

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