Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Preflight Media API
version: 2026.10.24
summary: Schedule, validate and publish social media posts to twelve networks.
description: 'Preflight (preflight.social) is a social media scheduler that checks every post against each network''s real publishing rules before it leaves. This is its REST API: upload a file, create and schedule a post to YouTube, TikTok, Instagram, Facebook, Threads, LinkedIn, Pinterest, Bluesky, Mastodon, Telegram, Discord and Tumblr, read its figures, act on comments, edit or take it down. The same workspace is reachable by AI assistants over MCP at https://preflight.social/mcp. Prose documentation: https://preflight.social/documentation. API keys, webhooks and the MCP server come with every plan, Free included.'
termsOfService: https://preflight.social/terms
contact:
name: Preflight
url: https://preflight.social
email: info@preflight.social
servers:
- url: https://preflight.social/v1
security:
- apiKey: []
tags:
- name: Media
description: Files, uploaded straight to storage with signed URLs or fetched from a public URL.
paths:
/media:
get:
tags:
- Media
operationId: listMedia
summary: Files, newest first
parameters:
- name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 200
default: 50
responses:
'200':
description: Files, each with how many posts use it.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Media'
'401':
$ref: '#/components/responses/Unauthorized'
post:
tags:
- Media
operationId: createMedia
summary: Declare a file and get upload instructions
description: 'Either sizeBytes for a direct upload (signed URLs come back: one PUT, or one per part for files over 16 MB) or sourceUrl for the server to fetch. Scope media:write. Up to 60 a minute.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MediaInput'
responses:
'200':
description: 'Direct upload: the record and where to put the bytes.'
content:
application/json:
schema:
$ref: '#/components/schemas/UploadInstructions'
'202':
description: 'sourceUrl: the fetch is queued.'
content:
application/json:
schema:
$ref: '#/components/schemas/IngestAccepted'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'413':
description: 'file_too_large: over the server''s ceiling.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
$ref: '#/components/responses/TooMany'
/media/{id}:
parameters:
- $ref: '#/components/parameters/mediaId'
get:
tags:
- Media
operationId: getMedia
summary: A file's status, metadata and a preview link
responses:
'200':
description: The file.
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
delete:
tags:
- Media
operationId: deleteMedia
summary: Delete the file; the record stays as deleted
responses:
'200':
description: Deleted.
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
description: 'in_use: a post that has not finished going out still needs it.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/media/{id}/uploaded:
parameters:
- $ref: '#/components/parameters/mediaId'
post:
tags:
- Media
operationId: finishSingleUpload
summary: Finish a single-part upload
responses:
'200':
description: The file, now processing or ready.
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/media/{id}/complete:
parameters:
- $ref: '#/components/parameters/mediaId'
post:
tags:
- Media
operationId: finishMultipartUpload
summary: Finish a multipart upload
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- parts
properties:
parts:
type: array
minItems: 1
items:
type: object
required:
- partNumber
- etag
properties:
partNumber:
type: integer
etag:
type: string
responses:
'200':
description: The file, now processing or ready.
content:
application/json:
schema:
$ref: '#/components/schemas/Media'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/media/{id}/thumb:
parameters:
- $ref: '#/components/parameters/mediaId'
get:
tags:
- Media
operationId: mediaThumbnail
summary: A small WebP preview
responses:
'200':
description: The image.
content:
image/webp:
schema:
type: string
format: binary
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/media/{id}/posts:
parameters:
- $ref: '#/components/parameters/mediaId'
get:
tags:
- Media
operationId: mediaPosts
summary: The posts that use this file
responses:
'200':
description: Posts.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Post'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
components:
responses:
BadRequest:
description: The body did not validate (invalid_request; field says which).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
TooMany:
description: Rate limited; retry after the Retry-After header.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: No such post, file or account in this workspace.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Missing, expired or unrecognised key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
PaymentRequired:
description: 'The plan''s allowance: post_limit, upload_limit, file_too_large, channel_limit, api_not_on_plan, ai_limit, ai_daily_limit, ai_not_in_plan. Carries limit and upgradeTo.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Post:
type: object
properties:
id:
type: string
format: uuid
status:
type: string
enum:
- draft
- scheduled
- publishing
- done
- canceled
content:
type: string
linkUrl:
type:
- string
- 'null'
mediaIds:
type: array
items:
type: string
format: uuid
altTexts:
type: array
items:
type:
- string
- 'null'
scheduledAt:
type:
- string
- 'null'
format: date-time
approvalState:
type:
- string
- 'null'
description: pending, approved or changes when a client approval link exists.
repeat:
type:
- object
- 'null'
description: 'Null unless it repeats: everyDays, times, index (which time this is, from 0), variants (the wordings after this post''s own, in order) and seriesId (the first post of the series).'
tags:
type: array
items:
$ref: '#/components/schemas/Tag'
openNotes:
type: integer
description: Threads in the post's notes nobody has resolved.
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
targets:
type: array
items:
$ref: '#/components/schemas/Target'
IngestAccepted:
type: object
description: The server is fetching sourceUrl. Poll GET /media/{id} until status is ready or failed.
required:
- id
- status
properties:
id:
type: string
format: uuid
status:
type: string
const: ingesting
UploadInstructions:
type: object
description: Where to PUT the bytes. The file never passes through the API.
required:
- id
- status
- upload
properties:
id:
type: string
format: uuid
status:
type: string
const: awaiting_upload
upload:
oneOf:
- title: single
type: object
required:
- type
- url
- method
- headers
properties:
type:
const: single
description: Up to 16 MB.
url:
type: string
format: uri
description: PUT the whole file here, then POST /media/{id}/uploaded.
method:
const: PUT
headers:
type: object
additionalProperties:
type: string
description: Send these with the PUT; Content-Type above all.
- title: multipart
type: object
required:
- type
- partSize
- parts
- completeUrl
properties:
type:
const: multipart
description: Over 16 MB.
partSize:
type: integer
description: Bytes per part; the last is shorter.
parts:
type: array
items:
type: object
properties:
partNumber:
type: integer
url:
type: string
format: uri
description: PUT each part and keep its ETag response header.
completeUrl:
type: string
description: '/v1/media/{id}/complete, relative to the host: POST parts[{ partNumber, etag }] there once every part is in.'
ValidationIssue:
type: object
required:
- severity
- message
properties:
platform:
$ref: '#/components/schemas/Platform'
description: Absent for a problem with the post as a whole, such as a file.
severity:
type: string
enum:
- error
- warning
message:
type: string
code:
type: string
description: 'For a plan limit: post_limit, upload_limit or channel_limit.'
Tag:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
color:
type: string
pattern: ^#[0-9a-fA-F]{6}$
posts:
type: integer
description: How many posts carry it. Only in the list.
Platform:
type: string
enum:
- youtube
- tiktok
- instagram
- facebook
- threads
- twitter
- linkedin
- pinterest
- bluesky
- mastodon
- telegram
- discord
- tumblr
description: A network's name. twitter (X) is text-only and not offered to new accounts.
Error:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
description: 'Stable: invalid_request, unauthorized, forbidden, not_found, post_limit, upload_limit, file_too_large, channel_limit, api_not_on_plan, ai_limit, ai_daily_limit, ai_not_in_plan, account_not_connected, media_unusable, already_started, targets_locked, in_flight, nothing_to_retry, nothing_waiting, unsupported, not_published, in_use, video_on_youtube, payload_too_large, validation_failed, ai_declined, rate_limited, ai_unavailable.'
message:
type: string
description: Meant to be read by a person.
field:
type: string
description: 'For invalid_request: which field.'
limit:
type: integer
description: 'For a plan refusal: the allowance.'
upgradeTo:
type: string
description: 'For a plan refusal: the first plan that would allow it.'
issues:
type: array
items:
$ref: '#/components/schemas/ValidationIssue'
description: For validation_failed.
Target:
type: object
properties:
id:
type: string
format: uuid
platform:
$ref: '#/components/schemas/Platform'
accountId:
type: string
format: uuid
status:
type: string
enum:
- pending
- publishing
- published
- failed
- skipped
remoteId:
type:
- string
- 'null'
remoteUrl:
type:
- string
- 'null'
format: uri
publishedAt:
type:
- string
- 'null'
format: date-time
error:
type:
- string
- 'null'
errorCode:
type:
- string
- 'null'
errorPermanent:
type: boolean
description: Retrying cannot succeed without changing something.
attempts:
type: integer
nextAttemptAt:
type:
- string
- 'null'
format: date-time
canEditRemote:
type: boolean
canDeleteRemote:
type: boolean
options:
type: object
additionalProperties: true
boostState:
type:
- object
- 'null'
description: 'Where options.boost stands: checkedAt and likes as last read; doneAt once it ran, with replyId and reposted, or expired when the window passed first.'
metrics:
type:
- object
- 'null'
additionalProperties: true
description: The latest figures, with fetchedAt.
MediaInput:
type: object
required:
- kind
properties:
kind:
type: string
enum:
- image
- video
mimeType:
type: string
examples:
- video/mp4
- image/jpeg
sizeBytes:
type: integer
description: Exact size; required for a direct upload.
filename:
type: string
maxLength: 255
fileName:
type: string
maxLength: 255
deprecated: true
description: Also accepted, for clients built from an older copy of this file.
durationSeconds:
type: number
description: Measured by the client; lets a dry run warn about length limits.
fps:
type: number
width:
type: integer
height:
type: integer
sourceUrl:
type: string
format: uri
description: A public https URL the server fetches instead of an upload.
Media:
type: object
properties:
id:
type: string
format: uuid
kind:
type: string
enum:
- image
- video
status:
type: string
enum:
- awaiting_upload
- ingesting
- processing
- ready
- failed
- deleted
mimeType:
type:
- string
- 'null'
sizeBytes:
type:
- integer
- 'null'
durationSeconds:
type:
- number
- 'null'
width:
type:
- integer
- 'null'
height:
type:
- integer
- 'null'
fps:
type:
- number
- 'null'
filename:
type:
- string
- 'null'
url:
type:
- string
- 'null'
format: uri
description: A short-lived link to the file itself, once it is ready.
previewUrl:
type:
- string
- 'null'
format: uri
description: A short-lived link to a lighter copy of a video for previews; null means use url.
previewPending:
type: boolean
description: True while that lighter copy is still being made.
animated:
type:
- boolean
- 'null'
description: An animated GIF or WebP.
error:
type:
- string
- 'null'
createdAt:
type: string
format: date-time
parameters:
mediaId:
name: id
in: path
required: true
schema:
type: string
format: uuid
securitySchemes:
apiKey:
type: http
scheme: bearer
bearerFormat: sk_live_…
description: 'An API key from Settings → API keys (every plan). Scopes: posts:read, posts:write (drafts), posts:publish (anything that goes live), media:read, media:write, webhooks:read, webhooks:write, or * for everything. A missing scope answers 403 forbidden and names it.'
externalDocs:
description: Documentation
url: https://preflight.social/documentation