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

# Upload a photo or video for a post

> Fetches a photo (JPEG or PNG, up to 30 MB, ratio 4:5 to 1.91:1) or a video (MP4 or MOV, H.264 or HEVC with AAC audio, 3 seconds to 15 minutes, up to 300 MB, moov before mdat) from a public HTTPS url and stores it for a post. Use media.id in media_ids. purpose cover stores an image as a Reel's cover. A file Instagram would refuse is refused with its issues. Unused files are deleted after 2 days.

Needs an API key with write access.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace_id}/post-media
openapi: 3.1.0
info:
  title: Replier API
  version: '1'
servers:
  - url: https://api.usereplier.com
security:
  - apiKey: []
paths:
  /v1/workspaces/{workspace_id}/post-media:
    post:
      tags:
        - Publishing
      summary: Upload a photo or video for a post
      description: >-
        Fetches a photo (JPEG or PNG, up to 30 MB, ratio 4:5 to 1.91:1) or a
        video (MP4 or MOV, H.264 or HEVC with AAC audio, 3 seconds to 15
        minutes, up to 300 MB, moov before mdat) from a public HTTPS url and
        stores it for a post. Use media.id in media_ids. purpose cover stores an
        image as a Reel's cover. A file Instagram would refuse is refused with
        its issues. Unused files are deleted after 2 days.


        Needs an API key with write access.
      operationId: upload_post_media
      parameters:
        - name: workspace_id
          in: path
          required: true
          description: Workspace ID returned by `GET /v1/workspaces`
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Send the same key when you retry, and the request runs once. Without
            one, every request runs.
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  type: object
                  properties:
                    download_url:
                      type: string
                      format: uri
                    file_id:
                      type: string
                      minLength: 1
                    mime_type:
                      type: string
                    file_name:
                      type: string
                  required:
                    - download_url
                    - file_id
                url:
                  description: Public HTTPS URL of the photo or video.
                  type: string
                  format: uri
                  pattern: ^https:\/\/.*
                purpose:
                  default: post
                  type: string
                  enum:
                    - post
                    - cover
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  workspace:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      name:
                        type: string
                      kind:
                        type: string
                        enum:
                          - personal
                          - agency
                      role:
                        type: string
                        enum:
                          - owner
                          - admin
                          - member
                    required:
                      - id
                      - name
                      - kind
                      - role
                  media:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      kind:
                        type: string
                        enum:
                          - image
                          - video
                      url:
                        type: string
                        format: uri
                      width:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      height:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      bytes:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      duration_ms:
                        anyOf:
                          - type: integer
                            minimum: -9007199254740991
                            maximum: 9007199254740991
                          - type: 'null'
                      cover_image_id:
                        description: >-
                          A Reel's cover image; null shows the frame a second
                          in.
                        type:
                          - string
                          - 'null'
                    required:
                      - id
                      - kind
                      - url
                      - width
                      - height
                      - bytes
                      - duration_ms
                      - cover_image_id
                required:
                  - workspace
                  - media
        default:
          $ref: '#/components/responses/Error'
components:
  responses:
    Error:
      description: Refused
      content:
        application/json:
          schema:
            type: object
            required:
              - error
            properties:
              error:
                type: object
                required:
                  - code
                  - message
                properties:
                  code:
                    type: string
                    description: >-
                      Why the request was refused, such as AUTOMATION_NOT_FOUND
                      or VERSION_CONFLICT. Other fields beside it give details.
                  message:
                    type: string
                    description: The same reason, in English.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: A Replier API key (rpl_...).

````

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