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

> ## Agent Instructions
> PostQueen's hosted API is https://api.postqueen.ai. The public API base is https://api.postqueen.ai/public/v1 and takes the raw API key in the Authorization header, with no Bearer prefix.
> The MCP server for posting is https://api.postqueen.ai/mcp/YOUR_API_KEY (or /mcp with Authorization: Bearer YOUR_API_KEY). docs.postqueen.ai/mcp only searches these docs and cannot post.
> The API key is under Connections > API key in the app, and only workspace admins can see it.

# Update post attachments

> Replace the media of a draft or a scheduled post without touching its text, settings or date.

Send the full list the post should have. Anything you leave out is removed, and an empty list removes all of the post's media. For example, to give a scheduled post one picture:

```json theme={"dark"}
{ "attachments": [{ "id": "YOUR_MEDIA_ID", "path": "https://cdn.example.com/a1b2c3d4e5.png" }] }
```

* A new file has to be in your media library first: [upload it](https://docs.postqueen.ai/public-api/uploads/upload-file.md) and pass the `id` and `path` the upload returns. Files the post already carries can be passed back as they are.
* Only the main post's media change. The media of its comments or thread items stay.
* A video's cover and alt text go in the same objects, as in [Create a post](https://docs.postqueen.ai/public-api/posts/create.md).
* A repeating post keeps repeating.


## OpenAPI

````yaml PUT /posts/{id}/attachments
openapi: 3.1.0
info:
  title: PostQueen Public API
  version: 1.0.0
  license:
    name: MIT
    identifier: MIT
  description: >-
    Schedule posts, upload media, read analytics and manage the channels of your
    PostQueen workspace.


    ## Authentication


    Send your API key in the `Authorization` header exactly as it is, with no
    prefix:


    ```

    Authorization: YOUR_API_KEY

    ```


    The key is under **Connections > API key** in the app. Only a workspace
    Admin or Super Admin can reveal or rotate it. An app your users sign in to
    with OAuth sends its `pos_` access token in the same header, also with no
    prefix. The workspace needs a subscription, and the free trial counts.


    ## Rate limits


    A workspace can send 30 `POST /posts` requests an hour. A request refused
    with `400` or `422` during validation gets its slot back; one refused once
    the posts are being created counts. `POST /upload` and `POST
    /upload-from-url` allow 300 requests an hour each, per workspace. Nothing
    else is limited. A limited endpoint answers with `X-RateLimit-Limit`,
    `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers, and over the limit
    with `429` and `Retry-After` (seconds).


    ## Terminology


    The app says channel, the API says integration. They are the same thing: a
    connected account on a network.
servers:
  - url: https://api.postqueen.ai/public/v1
    description: PostQueen
security:
  - ApiKeyAuth: []
tags:
  - name: Channels
    description: Connected channels. The API calls them integrations.
  - name: Posts
    description: Create, list, change and delete posts
  - name: Media
    description: Upload files to the media library
  - name: Clipping
    description: >-
      Turn a YouTube video into short vertical clips. Not available on PostQueen
      yet
  - name: AI video
    description: Generate a video with AI into the media library
  - name: Analytics
    description: Channel and post metrics
  - name: Notifications
    description: The workspace's notifications
  - name: OAuth
    description: Sign-in for apps that act for other PostQueen workspaces
paths:
  /posts/{id}/attachments:
    put:
      tags:
        - Posts
      summary: Update post attachments
      description: >-
        Replaces the media of a post that has not been published yet. The list
        you pass becomes the post's media: anything you leave out is removed,
        and an empty list removes all of it. The content, the settings, the
        publish date and the post ids stay as they are, and a repeating post
        keeps repeating.


        Works on a draft, or on a scheduled post (`QUEUE`) whose publish time is
        still ahead. Only the main post's media change: the media of its
        comments or thread items stay. Pass the id of the main post, not of a
        comment in its thread.


        New media must be in your workspace's media library, so upload it first
        and pass its `id` and `path`. The post's current media can be passed
        back as they are. The post then goes through the same validation as
        creating one, except on a draft, where only the empty-content check
        runs.
      operationId: updatePostAttachments
      parameters:
        - name: id
          in: path
          required: true
          description: The post's id
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - attachments
              properties:
                attachments:
                  type: array
                  items:
                    $ref: '#/components/schemas/Media'
                  description: >-
                    The full new list of the post's media. An empty list removes
                    all of it
            example:
              attachments:
                - id: YOUR_MEDIA_ID
                  path: https://cdn.example.com/a1b2c3d4e5.png
                  alt: The new calendar view
      responses:
        '200':
          description: Post attachments updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  postId:
                    type: string
                  publishDate:
                    type: string
              example:
                postId: cmg1p0s7k0001qz0h4yq2a8r1
                publishDate: '2026-12-01T09:00:00'
        '400':
          description: >-
            The id belongs to a comment (pass the main post's id), the post was
            already published or failed, its publish time has passed, a new file
            is not in your media library, or the post with its new media failed
            validation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NestError'
              examples:
                notInLibrary:
                  summary: A file that is not in your media library
                  value:
                    message: >-
                      Media not found: https://example.com/picture.png. Upload
                      it to the media library first.
                    error: Bad Request
                    statusCode: 400
                published:
                  summary: A post that already went out
                  value:
                    message: >-
                      Only scheduled posts that were not published yet (or
                      drafts) can be updated
                    error: Bad Request
                    statusCode: 400
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: '`Post not found`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NestError'
              example:
                message: Post not found
                error: Not Found
                statusCode: 404
components:
  schemas:
    Media:
      type: object
      required:
        - id
        - path
      properties:
        id:
          type: string
          description: The media id from the upload response
        path:
          type: string
          description: >-
            The file's URL, normally the `path` from the upload response. It
            must end in .png, .jpg, .jpeg, .gif, .webp or .mp4 (a query string
            is ignored)
        alt:
          type: string
          maxLength: 1000
          description: Alt text, on networks that take it. Up to 1000 characters
        thumbnail:
          type: string
          format: uri
          description: Cover image URL for a video, on networks that take one
    NestError:
      type: object
      description: >-
        The standard error shape: validation errors, not-found errors and rate
        limits
      properties:
        statusCode:
          type: integer
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        error:
          type: string
    MessageError:
      type: object
      description: The error shape of most checks written into the public API itself
      properties:
        msg:
          type: string
  responses:
    Unauthorized:
      description: >-
        `No API Key found`, `Invalid API key`, `Invalid OAuth token`, or `No
        subscription found` when the workspace has no subscription
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageError'
          example:
            msg: Invalid API key
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your API key from Connections > API key, or an OAuth access token
        (`pos_...`). Send it as it is, with no `Bearer` prefix.

````

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