> ## 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.

# Create a post

> Save a draft, or schedule a post or thread. Send an Idempotency-Key so a retry can't post twice.



## OpenAPI

````yaml /openapi.json post /posts
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:
  /posts:
    post:
      tags:
        - Posts
      summary: Create a post
      description: >-
        Save a draft, or schedule a post or thread. Send an Idempotency-Key so a
        retry can't post twice.
      operationId: createPost
      parameters:
        - name: Idempotency-Key
          in: header
          schema:
            type: string
            maxLength: 255
          description: >-
            Repeat a request with the same key to get the first post back
            instead of a new one.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  description: The post text, for a single post.
                thread:
                  type: array
                  items:
                    type: string
                  description: >-
                    Several posts to publish as a thread, in order. Takes
                    precedence over body.
                channel_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Channels to publish to, from GET /channels.
                channel_bodies:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Text for particular channels instead of body, keyed by
                    channel id. Each is a single post.
                scheduled_at:
                  type:
                    - string
                    - 'null'
                  description: >-
                    When to publish: ISO 8601 with Z or an offset
                    (2026-10-01T09:00:00+01:00). Omit or null to save a draft.
                  format: date-time
                schedule_in_minutes:
                  type: number
                  description: >-
                    Publish this many minutes from now, on the server's clock.
                    Instead of scheduled_at.
                media_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Files from GET /media to attach, in order.
                media_urls:
                  type: array
                  items:
                    type: string
                    format: uri
                  description: >-
                    Public https links to images or a video, attached after
                    media_ids. Each is downloaded into the media library (up to
                    10 per request, 200 MB each).
                  maxItems: 10
                youtube:
                  type: object
                  properties:
                    title:
                      type: string
                      maxLength: 100
                    privacy:
                      type: string
                      enum:
                        - public
                        - unlisted
                        - private
                    made_for_kids:
                      type: boolean
                      description: Required to schedule to YouTube.
                idempotency_key:
                  type: string
                  maxLength: 255
                  description: Same as the Idempotency-Key header.
            example:
              body: Launching today 🚀
              channel_ids:
                - <channel-id>
              scheduled_at: '2026-10-01T09:00:00+01:00'
      responses:
        '200':
          description: A repeat of an earlier request (same idempotency key)
          content:
            application/json:
              schema:
                type: object
                properties:
                  post:
                    $ref: '#/components/schemas/CreatedPost'
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  post:
                    $ref: '#/components/schemas/CreatedPost'
        '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'
        '402':
          description: No active plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreatedPost:
      type: object
      properties:
        id:
          type: string
          format: uuid
        body:
          type: string
        scheduled_at:
          type:
            - string
            - 'null'
          format: date-time
        status:
          type: string
          enum:
            - draft
            - scheduled
            - publishing
            - published
            - failed
        media:
          type: integer
          description: How many files are attached
        warning:
          type: string
          description: Something to tell the user, such as X charging for links
        idempotent_replay:
          type: boolean
          description: >-
            True when this repeats an earlier request with the same idempotency
            key
      required:
        - id
        - status
    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.