# Create post

Source: https://docs.recoupable.dev/api-reference/publishing/create

Publish a video with its copy to one connected social account, now or at a set time.

## POST /api/posts

Full OpenAPI specification: https://docs.recoupable.dev/spec/social.json

## Authentication

This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification.

[Authentication guide](https://docs.recoupable.dev/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Social",
    "description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "paths": {
    "/api/posts": {
      "post": {
        "operationId": "postPosts",
        "summary": "Create post",
        "description": "Publish a video with its copy to **one** connected social account, now or at a set time. Send one request per target account; to post the same video to several platforms, call this once per platform.\n\nWithout `publish_at` the post starts publishing immediately and is returned as `publishing`. With `publish_at` (a time in the future) it is returned as `scheduled`, starts publishing at that time, and can be cancelled until then with [Cancel Post](/api-reference/publishing/cancel). Either way this returns **202** right away: poll [Get Post](/api-reference/publishing/get) until `status` is `posted`, `failed` or `cancelled`.\n\nThe platform must already be connected for the artist in `artist_account_id`, or for the account itself when it is omitted (see [Authorize Connector](/api-reference/connectors/authorize)). Copy uses one shape for every platform. Which fields each platform uses, and their limits:\n\n| Platform | `title` | `description` | `cover_url` | `privacy`, `tags` |\n|---|---|---|---|---|\n| `youtube` | **required**, video title, max 100 characters | video description, max 5,000 characters | not used (YouTube picks the frame) | used |\n| `instagram` | not used | **required**, Reel caption, max 2,200 characters | Reel cover image | not used |\n| `x` | not used | **required**, post text, max 280 weighted characters (URLs count as 23) | not used | not used |\n| `linkedin` | video title shown on the post | **required**, post commentary, max 3,000 characters | video thumbnail | not used |\n\nLimits are checked here, so an over-length body fails with 400 instead of at publish time.\n\nRecoup applies no rate limit of its own to this endpoint. Each platform enforces its own caps, and a post over one ends `failed` with the platform's message in `error_message`:\n\n| Platform | Cap |\n|---|---|\n| `instagram` | 100 API-published posts per account per 24 hours |\n| `x` | the X API's per-app and per-user posting limits |\n| `youtube` | the daily YouTube Data API upload quota of the connected Google project |\n| `linkedin` | LinkedIn's daily per-member and per-organization API limits |\n\nEach post costs **$0.01**, charged to the account the post is made in (`account_id`, or the calling account when omitted), never to the artist. The balance is checked here, so an account without enough credits gets **402** and no post is created. The charge is made only when the post reaches `posted`: a post that ends `failed` or `cancelled` is never charged. A scheduled post is checked against the balance when it is created and charged when it goes live.",
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePostRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Post accepted: publishing now, or scheduled for `publish_at`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePostResponse"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "URL of the created post."
              }
            }
          },
          "400": {
            "description": "Validation failed: a missing or unknown field, a field the platform requires (YouTube `title`; Instagram, X and LinkedIn `description`), a body over the platform's limit, a `publish_at` that is not a date-time with a timezone or is not in the future, or an `account_id` that is an artist (pass it as `artist_account_id`). `missing_fields` names the first offending field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. Provide exactly one of `x-api-key` or `Authorization: Bearer`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits: the account has less than the $0.01 a post costs. No post is created and nothing is sent to the platform.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SocialInsufficientCreditsResponse"
                }
              }
            }
          },
          "403": {
            "description": "Access denied to the specified `account_id`, or the account has no access to the `artist_account_id`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The `platform` is not connected for the artist in `artist_account_id` (or for the account when it is omitted). Authorize it via [Authorize Connector](/api-reference/connectors/authorize) before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreatePostRequest": {
        "type": "object",
        "required": [
          "platform",
          "video_url"
        ],
        "description": "One post to one connected account. Copy uses the same fields for every platform; see the operation description for which fields each platform uses and their limits.",
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional. The account the post is made in and charged to. Defaults to the calling account; org admins can pass another account in their organization. Must not be an artist: pass the artist as `artist_account_id`."
          },
          "artist_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Optional. The artist, within the account, whose connected social account posts. The account must have access to the artist. Defaults to the account's own connection. The artist is never charged."
          },
          "platform": {
            "$ref": "#/components/schemas/PostPlatform"
          },
          "sub_account_id": {
            "type": "string",
            "description": "Optional, LinkedIn only. Organization URN to post as a Page (e.g. `urn:li:organization:101127186`) instead of as the connected member. The connected member must be an admin of that Page."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "description": "Publicly reachable URL of the video file (MP4). It is fetched at publish time, so it must still resolve then."
          },
          "cover_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional. Publicly reachable image URL used as the cover or thumbnail where the platform supports one (see the table in the description)."
          },
          "title": {
            "type": "string",
            "description": "Title. Required for `youtube`; see the table in the description."
          },
          "description": {
            "type": "string",
            "description": "Body text: caption, post text or description, depending on the platform. Required for `instagram`, `x` and `linkedin`."
          },
          "privacy": {
            "type": "string",
            "enum": [
              "public",
              "unlisted",
              "private"
            ],
            "default": "public",
            "description": "Optional, YouTube only. Visibility after upload."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional, YouTube only. Video tags."
          },
          "publish_at": {
            "type": "string",
            "format": "date-time",
            "description": "Optional. ISO 8601 time to publish, with a timezone (`Z` or an offset), in the future. Omit to publish now."
          }
        }
      },
      "CreatePostResponse": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "description": "The post's id and current status.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The post's id. Poll [Get Post](/api-reference/publishing/get) with this."
          },
          "status": {
            "$ref": "#/components/schemas/PostStatus"
          }
        }
      },
      "PostErrorResponse": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ],
            "description": "Always `error`"
          },
          "missing_fields": {
            "type": "array",
            "description": "JSON path segments to the first field that failed validation, e.g. `[\"description\"]`",
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            }
          },
          "error": {
            "type": "string",
            "description": "Human-readable error message"
          }
        }
      },
      "SocialInsufficientCreditsResponse": {
        "type": "object",
        "description": "Returned (402) when the account lacks credits for the request. Nothing is charged and no Stripe object is created. Credits must be bought explicitly via [`POST /api/credits/sessions`](/api-reference/credits/sessions-create). Examples: a scrape of one profile with posts=20 requires $0.25; one post through Create Post requires $0.01.",
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "insufficient_credits"
            ]
          },
          "remaining_credits": {
            "type": "integer",
            "example": 0
          },
          "required_credits": {
            "type": "integer",
            "example": 250000
          },
          "billingUrl": {
            "type": "string",
            "description": "Static link to the Recoup app, where a human can save a card and buy credits. It is a constant, not a freshly minted Stripe Checkout Session, so a credit-gated endpoint that keeps returning 402 creates nothing. To buy credits programmatically, call [`POST /api/credits/sessions`](/api-reference/credits/sessions-create).",
            "example": "https://app.recoupable.dev"
          }
        },
        "required": [
          "error",
          "remaining_credits",
          "required_credits",
          "billingUrl"
        ]
      },
      "PostPlatform": {
        "type": "string",
        "enum": [
          "instagram",
          "x",
          "linkedin",
          "youtube"
        ],
        "description": "Target platform. The account must have this platform connected."
      },
      "PostStatus": {
        "type": "string",
        "enum": [
          "scheduled",
          "publishing",
          "posted",
          "failed",
          "cancelled"
        ],
        "description": "Lifecycle phase. `scheduled` until `publish_at`, `publishing` while the platform upload runs, then `posted` or `failed`. `cancelled` only from `scheduled`."
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your Recoup API key. [Learn more](/quickstart#api-keys)."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
```
