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

> ## Agent Instructions
> Postploy's MCP server for posting is https://api.postploy.com/mcp and signs in with OAuth. The REST API base URL is https://api.postploy.com/public/v1 and takes an API key as a Bearer token. The API calls channels accounts.

# Import media

> Copies an image or video from a public `https` URL into your team's media library. Attach it to posts by putting its `id` in `mediaIds`.

Importing a URL that's already in your library returns that file instead of a copy.




## OpenAPI

````yaml /openapi.yaml post /media
openapi: 3.1.0
info:
  title: Postploy API
  version: '1'
  description: Schedule and manage social media posts in your Postploy team.
  contact:
    name: Postploy support
    email: support@postploy.com
servers:
  - url: https://api.postploy.com/public/v1
security:
  - apiKey: []
tags:
  - name: Channels
  - name: Posts
  - name: Approvals
  - name: Media
  - name: Trash
  - name: Webhooks
paths:
  /media:
    post:
      tags:
        - Media
      summary: Import media
      description: >
        Copies an image or video from a public `https` URL into your team's
        media library. Attach it to posts by putting its `id` in `mediaIds`.


        Importing a URL that's already in your library returns that file instead
        of a copy.
      operationId: importMedia
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
                - fileName
              additionalProperties: false
              properties:
                url:
                  type: string
                  format: uri
                  description: Where to fetch the file. Must start with `https://`.
                fileName:
                  type: string
                  description: >-
                    The file's name. Its extension sets the type and must be one
                    of `jpg`, `jpeg`, `png`, `webp`, `gif`, `mp4` or `mov`.
                  minLength: 1
                  maxLength: 200
            example:
              url: https://example.com/spring-blend.jpg
              fileName: spring-blend.jpg
      responses:
        '201':
          description: The file in your media library.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Media'
              example:
                data:
                  id: 7a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d
                  type: image
                  fileName: spring-blend.jpg
                  url: https://cdn.example.com/spring-blend.jpg
                  thumbnailUrl: https://cdn.example.com/spring-blend.jpg
                  mimeType: image/jpeg
                  duration: null
                  altText: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    Media:
      type: object
      description: An image or video in your team's media library.
      required:
        - id
        - type
        - fileName
        - url
        - thumbnailUrl
        - mimeType
        - duration
        - altText
      properties:
        id:
          type: string
          format: uuid
          description: Put this in a post's `mediaIds`.
        type:
          type: string
          enum:
            - image
            - video
        fileName:
          type: string
        url:
          type: string
          format: uri
        thumbnailUrl:
          type: string
          format: uri
        mimeType:
          type:
            - string
            - 'null'
        duration:
          type:
            - number
            - 'null'
          description: A video's length in seconds.
        altText:
          type:
            - string
            - 'null'
    Error:
      type: object
      required:
        - statusCode
        - message
        - errors
        - timestamp
        - route
      properties:
        statusCode:
          type: integer
        message:
          type: string
          description: What went wrong, in plain words. Safe to show to people.
        errors:
          type:
            - array
            - 'null'
          description: Every problem, when there's more than one place to look.
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                description: Where the problem is, such as `["posts", 0, "scheduledAt"]`.
                items:
                  type:
                    - string
                    - integer
              cause:
                type: string
              code:
                type: string
                description: >-
                  On plan limits, `PLATFORM_LIMIT_REACHED` or
                  `TOTAL_LIMIT_REACHED`.
              platform:
                type: string
        timestamp:
          type: string
          format: date-time
        route:
          type: string
  responses:
    BadRequest:
      description: >-
        The request is invalid, or a post breaks its platform's rules. `message`
        gives the first problem, and `errors` lists every one with its `path`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            message: Scheduled date and time must be in the future
            errors:
              - message: Scheduled date and time must be in the future
                path:
                  - posts
                  - 0
                  - scheduledAt
                cause: custom
            timestamp: '2030-01-10T12:00:00.000Z'
            route: /public/v1/posts
    Unauthorized:
      description: The API key is missing, unknown or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Invalid API key
            errors: null
            timestamp: '2030-01-10T12:00:00.000Z'
            route: /public/v1/accounts
    Forbidden:
      description: Your role in the team doesn't allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: >-
        More than 120 requests a minute to this endpoint. All of a person's keys
        count together. Wait the number of seconds in `Retry-After-caller`, then
        try again.
      headers:
        Retry-After-caller:
          description: Seconds to wait before trying again.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An API key from **Settings › AI apps & API** in Postploy. Keys start
        with `ppk_`.

````

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