{
  "components": {
    "schemas": {
      "Approval": {
        "properties": {
          "approved_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/StateEnum"
          }
        },
        "required": [
          "approved_at",
          "source",
          "state"
        ],
        "type": "object"
      },
      "Brand": {
        "properties": {
          "id": {
            "type": "integer"
          },
          "languages": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "profession": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "languages",
          "name",
          "profession"
        ],
        "type": "object"
      },
      "BrandPage": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Brand"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "type": "object"
      },
      "Channel": {
        "properties": {
          "brand_id": {
            "type": "integer"
          },
          "capabilities": {
            "additionalProperties": {},
            "description": "Formats, media specs, limits and options with allowed values.",
            "type": "object"
          },
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "shared_caps": {
            "additionalProperties": {},
            "description": "Caps shared across customers: YouTube uploads left today (counted per attempt), and the posts this LinkedIn channel sent today (LinkedIn's call budget is not metered, so no number is left).",
            "type": "object"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "brand_id",
          "capabilities",
          "id",
          "name",
          "platform",
          "shared_caps",
          "status"
        ],
        "type": "object"
      },
      "ChannelOptions": {
        "properties": {
          "ai_generated_required": {
            "type": "boolean"
          },
          "audited": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "boards": {
            "description": "Channels that post to a board only: the account's boards now, as {id, name} (read at most once in five minutes). null when they could not be read, or for any other channel.",
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "boards_message": {
            "description": "Why the boards could not be read, else empty.",
            "type": [
              "string",
              "null"
            ]
          },
          "channel_id": {
            "type": "integer"
          },
          "creator_info": {
            "additionalProperties": {},
            "description": "TikTok only: the account's settings now.",
            "type": [
              "object",
              "null"
            ]
          },
          "creator_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "formats": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "limits": {
            "additionalProperties": {},
            "type": "object"
          },
          "media": {
            "additionalProperties": {},
            "type": "object"
          },
          "note": {
            "description": "A fact about the platform that the options do not say.",
            "type": [
              "string",
              "null"
            ]
          },
          "options": {
            "additionalProperties": {},
            "type": "object"
          },
          "platform": {
            "type": "string"
          },
          "preview": {
            "description": "True while this platform is open to a few workspaces only (a preview); null for a platform that is never gated.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "ai_generated_required",
          "audited",
          "boards",
          "boards_message",
          "channel_id",
          "creator_info",
          "creator_message",
          "formats",
          "limits",
          "media",
          "note",
          "options",
          "platform",
          "preview"
        ],
        "type": "object"
      },
      "ChannelPage": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Channel"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "type": "object"
      },
      "CreatedViaEnum": {
        "description": "* `web` - web\n* `api` - api\n* `mcp` - mcp",
        "enum": [
          "web",
          "api",
          "mcp"
        ],
        "type": "string"
      },
      "DeletePublished": {
        "properties": {
          "post": {
            "$ref": "#/components/schemas/Post"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/DeleteResult"
            },
            "type": "array"
          }
        },
        "required": [
          "post",
          "results"
        ],
        "type": "object"
      },
      "DeletePublishedRequestRequest": {
        "properties": {
          "confirm": {
            "description": "Must be true: taking a published post down is public and cannot be undone.",
            "type": "boolean"
          },
          "variant_ids": {
            "description": "Omit to take down every sent copy.",
            "items": {
              "type": "integer"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "DeleteResult": {
        "properties": {
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "$ref": "#/components/schemas/ResultEnum"
          },
          "variant_id": {
            "type": "integer"
          }
        },
        "required": [
          "message",
          "result",
          "variant_id"
        ],
        "type": "object"
      },
      "EventsEnum": {
        "description": "* `post.awaiting_approval` - post.awaiting_approval\n* `post.approved` - post.approved\n* `variant.sent` - variant.sent\n* `variant.failed` - variant.failed\n* `variant.needs_reconnect` - variant.needs_reconnect\n* `variant.deleted` - variant.deleted\n* `channel.needs_reconnect` - channel.needs_reconnect",
        "enum": [
          "post.awaiting_approval",
          "post.approved",
          "variant.sent",
          "variant.failed",
          "variant.needs_reconnect",
          "variant.deleted",
          "channel.needs_reconnect"
        ],
        "type": "string"
      },
      "Issue": {
        "properties": {
          "channel_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "code": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "channel_id",
          "code",
          "field",
          "message"
        ],
        "type": "object"
      },
      "Me": {
        "properties": {
          "credential": {
            "$ref": "#/components/schemas/MeCredential"
          },
          "limits": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object"
          },
          "plan": {
            "type": [
              "string",
              "null"
            ]
          },
          "remaining": {
            "$ref": "#/components/schemas/MeRemaining"
          },
          "role": {
            "$ref": "#/components/schemas/RoleEnum"
          },
          "scopes": {
            "items": {
              "$ref": "#/components/schemas/ScopesEnum"
            },
            "type": "array"
          },
          "user": {
            "$ref": "#/components/schemas/MeUser"
          },
          "workspace": {
            "$ref": "#/components/schemas/MeWorkspace"
          }
        },
        "required": [
          "credential",
          "limits",
          "plan",
          "remaining",
          "role",
          "scopes",
          "user",
          "workspace"
        ],
        "type": "object"
      },
      "MeCredential": {
        "properties": {
          "name": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/MeCredentialSourceEnum"
          }
        },
        "required": [
          "name",
          "source"
        ],
        "type": "object"
      },
      "MeCredentialSourceEnum": {
        "description": "* `api` - api\n* `mcp` - mcp",
        "enum": [
          "api",
          "mcp"
        ],
        "type": "string"
      },
      "MeRemaining": {
        "properties": {
          "posts_day": {
            "type": "integer"
          },
          "requests_day": {
            "type": "integer"
          },
          "requests_minute": {
            "type": "integer"
          }
        },
        "required": [
          "posts_day",
          "requests_day",
          "requests_minute"
        ],
        "type": "object"
      },
      "MeUser": {
        "properties": {
          "email": {
            "format": "email",
            "type": "string"
          },
          "id": {
            "type": "integer"
          }
        },
        "required": [
          "email",
          "id"
        ],
        "type": "object"
      },
      "MeWorkspace": {
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "type": "object"
      },
      "Media": {
        "properties": {
          "asset_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "brand_id": {
            "type": "integer"
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "duration_seconds": {
            "format": "double",
            "type": [
              "number",
              "null"
            ]
          },
          "error": {
            "additionalProperties": {},
            "description": "{'code', 'message'} when status is failed.",
            "type": [
              "object",
              "null"
            ]
          },
          "height": {
            "type": [
              "integer",
              "null"
            ]
          },
          "id": {
            "type": "integer"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "mime": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/MediaSourceEnum"
          },
          "status": {
            "$ref": "#/components/schemas/MediaStatusEnum"
          },
          "width": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "asset_id",
          "brand_id",
          "bytes",
          "created_at",
          "duration_seconds",
          "error",
          "height",
          "id",
          "kind",
          "mime",
          "source",
          "status",
          "width"
        ],
        "type": "object"
      },
      "MediaSourceEnum": {
        "description": "* `upload` - upload\n* `url` - url",
        "enum": [
          "upload",
          "url"
        ],
        "type": "string"
      },
      "MediaStatusEnum": {
        "description": "* `awaiting_upload` - awaiting_upload\n* `receiving` - receiving\n* `uploaded` - uploaded\n* `processing` - processing\n* `ready` - ready\n* `failed` - failed",
        "enum": [
          "awaiting_upload",
          "receiving",
          "uploaded",
          "processing",
          "ready",
          "failed"
        ],
        "type": "string"
      },
      "MediaUrlRequestRequest": {
        "properties": {
          "brand_id": {
            "minimum": 1,
            "type": "integer"
          },
          "rights_confirmed": {
            "description": "Must be true: the file is yours or you may publish it.",
            "type": "boolean"
          },
          "url": {
            "description": "A public https URL, fetched by a worker.",
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "brand_id",
          "rights_confirmed",
          "url"
        ],
        "type": "object"
      },
      "PatchedPostUpdateRequest": {
        "properties": {
          "ai_generated": {
            "description": "Required whenever channels, text or media_ids is sent: those replace every copy.",
            "type": "boolean"
          },
          "channels": {
            "items": {
              "$ref": "#/components/schemas/PostChannelRequest"
            },
            "type": "array"
          },
          "media_ids": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "scheduled_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "submit": {
            "type": "boolean"
          },
          "text": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Post": {
        "properties": {
          "approval_url": {
            "description": "Where a person approves it.",
            "format": "uri",
            "type": "string"
          },
          "brand_id": {
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "created_via": {
            "$ref": "#/components/schemas/CreatedViaEnum"
          },
          "id": {
            "type": "integer"
          },
          "scheduled_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "variants": {
            "items": {
              "$ref": "#/components/schemas/Variant"
            },
            "type": "array"
          }
        },
        "required": [
          "approval_url",
          "brand_id",
          "created_at",
          "created_by",
          "created_via",
          "id",
          "scheduled_at",
          "variants"
        ],
        "type": "object"
      },
      "PostChannelRequest": {
        "properties": {
          "channel_id": {
            "minimum": 1,
            "type": "integer"
          },
          "first_comment": {
            "minLength": 1,
            "type": "string"
          },
          "options": {
            "additionalProperties": {},
            "description": "The channel's options (see channel_options): privacy_level, title, link, ...",
            "type": "object"
          },
          "text": {
            "description": "This channel's own text, instead of the post text.",
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "channel_id"
        ],
        "type": "object"
      },
      "PostPage": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Post"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "type": "object"
      },
      "PostRequestRequest": {
        "properties": {
          "ai_generated": {
            "description": "Required, no default: is the content AI-generated or AI-altered.",
            "type": "boolean"
          },
          "brand_id": {
            "minimum": 1,
            "type": "integer"
          },
          "channels": {
            "items": {
              "$ref": "#/components/schemas/PostChannelRequest"
            },
            "type": "array"
          },
          "media_ids": {
            "description": "Media ids (get_media status ready), in order.",
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "scheduled_at": {
            "description": "RFC 3339 with an offset. Needed to submit.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "submit": {
            "default": false,
            "description": "Send for approval. A person still has to approve it.",
            "type": "boolean"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "ai_generated",
          "brand_id",
          "channels"
        ],
        "type": "object"
      },
      "ResultEnum": {
        "description": "* `deleted` - deleted\n* `already_removed` - already_removed\n* `failed` - failed",
        "enum": [
          "deleted",
          "already_removed",
          "failed"
        ],
        "type": "string"
      },
      "RoleEnum": {
        "description": "* `owner` - owner\n* `editor` - editor\n* `approver` - approver",
        "enum": [
          "owner",
          "editor",
          "approver"
        ],
        "type": "string"
      },
      "ScopesEnum": {
        "description": "* `read` - read\n* `write` - write",
        "enum": [
          "read",
          "write"
        ],
        "type": "string"
      },
      "StateEnum": {
        "description": "* `none` - none\n* `awaiting` - awaiting\n* `approved` - approved",
        "enum": [
          "none",
          "awaiting",
          "approved"
        ],
        "type": "string"
      },
      "Upload": {
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "media_id": {
            "type": "integer"
          },
          "upload_id": {
            "description": "The media id; pass it to complete. Not secret.",
            "type": "integer"
          },
          "upload_url": {
            "description": "PUT the raw bytes here (no Authorization header). Single use, 1 hour. Shown in the first answer only: a replay with the same Idempotency-Key holds null, so create a new upload.",
            "format": "uri",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "expires_at",
          "media_id",
          "upload_id",
          "upload_url"
        ],
        "type": "object"
      },
      "UploadRequestRequest": {
        "properties": {
          "brand_id": {
            "minimum": 1,
            "type": "integer"
          },
          "content_type": {
            "description": "image/jpeg, image/png, image/webp, video/mp4 or video/quicktime",
            "maxLength": 100,
            "minLength": 1,
            "type": "string"
          },
          "filename": {
            "maxLength": 255,
            "minLength": 1,
            "type": "string"
          },
          "rights_confirmed": {
            "description": "Must be true: the file is yours or you may publish it.",
            "type": "boolean"
          },
          "size": {
            "description": "The exact number of bytes you will PUT.",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "brand_id",
          "content_type",
          "filename",
          "rights_confirmed",
          "size"
        ],
        "type": "object"
      },
      "ValidationResult": {
        "properties": {
          "issues": {
            "items": {
              "$ref": "#/components/schemas/Issue"
            },
            "type": "array"
          },
          "valid": {
            "type": "boolean"
          }
        },
        "required": [
          "issues",
          "valid"
        ],
        "type": "object"
      },
      "Variant": {
        "properties": {
          "approval": {
            "$ref": "#/components/schemas/Approval"
          },
          "channel_id": {
            "type": "integer"
          },
          "external_url": {
            "type": "string"
          },
          "first_comment": {
            "type": "string"
          },
          "id": {
            "type": "integer"
          },
          "last_error": {
            "additionalProperties": {},
            "description": "{'class': ..., 'message': ...} of the last failure.",
            "type": [
              "object",
              "null"
            ]
          },
          "platform": {
            "type": "string"
          },
          "published_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "settings": {
            "additionalProperties": {},
            "type": "object"
          },
          "status": {
            "$ref": "#/components/schemas/VariantStatusEnum"
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "approval",
          "channel_id",
          "external_url",
          "id",
          "last_error",
          "platform",
          "published_at",
          "status"
        ],
        "type": "object"
      },
      "VariantStatusEnum": {
        "description": "* `draft` - draft\n* `awaiting_approval` - awaiting_approval\n* `needs_confirmation` - needs_confirmation\n* `approved` - approved\n* `scheduled` - scheduled\n* `publishing` - publishing\n* `sent` - sent\n* `failed` - failed\n* `expired` - expired\n* `needs_reconnect` - needs_reconnect\n* `deleted` - deleted",
        "enum": [
          "draft",
          "awaiting_approval",
          "needs_confirmation",
          "approved",
          "scheduled",
          "publishing",
          "sent",
          "failed",
          "expired",
          "needs_reconnect",
          "deleted"
        ],
        "type": "string"
      },
      "Webhook": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "disabled_at": {
            "description": "Set when 3 days of failures switched it off.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "failing_since": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "disabled_at",
          "events",
          "failing_since",
          "id",
          "url"
        ],
        "type": "object"
      },
      "WebhookCreated": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "disabled_at": {
            "description": "Set when 3 days of failures switched it off.",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "failing_since": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "integer"
          },
          "secret": {
            "description": "The signing secret, shown only in this answer (null in an idempotent replay).",
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "created_at",
          "disabled_at",
          "events",
          "failing_since",
          "id",
          "secret",
          "url"
        ],
        "type": "object"
      },
      "WebhookPage": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Webhook"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "type": "object"
      },
      "WebhookRequestRequest": {
        "properties": {
          "events": {
            "description": "Default: all events.",
            "items": {
              "$ref": "#/components/schemas/EventsEnum"
            },
            "type": "array"
          },
          "url": {
            "description": "https, port 443, a public host. Checked again at every delivery.",
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "description": "A workspace API key (pk_live_...) or an OAuth access token, sent as 'Authorization: Bearer <credential>'. Never in the URL.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Create, schedule and submit social media posts for approval. Approval stays with a person.",
    "title": "Postaki API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/brands": {
      "get": {
        "operationId": "list_brands",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandPage"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace's brands",
        "tags": [
          "brands"
        ]
      }
    },
    "/api/v1/brands/{brand_id}/channels": {
      "get": {
        "operationId": "list_channels",
        "parameters": [
          {
            "in": "path",
            "name": "brand_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelPage"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "A brand's channels with their capabilities and the shared caps left today",
        "tags": [
          "brands"
        ]
      }
    },
    "/api/v1/channels/{channel_id}/options": {
      "get": {
        "operationId": "channel_options",
        "parameters": [
          {
            "in": "path",
            "name": "channel_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChannelOptions"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The options of a channel (TikTok: the account's own settings, read now)",
        "tags": [
          "channels"
        ]
      }
    },
    "/api/v1/me": {
      "get": {
        "operationId": "me",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace, user, role, scopes and plan limits of this credential",
        "tags": [
          "me"
        ]
      }
    },
    "/api/v1/media": {
      "post": {
        "operationId": "add_media_from_url",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MediaUrlRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Media"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Add media from a public https URL (fetched by a worker; poll get_media)",
        "tags": [
          "media"
        ]
      }
    },
    "/api/v1/media/uploads": {
      "post": {
        "operationId": "create_media_upload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Announce a file and get a single-use URL to PUT its bytes to",
        "tags": [
          "media"
        ]
      }
    },
    "/api/v1/media/uploads/{upload_id}/complete": {
      "post": {
        "operationId": "complete_media_upload",
        "parameters": [
          {
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Media"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Say the bytes are uploaded; processing starts (poll get_media)",
        "tags": [
          "media"
        ]
      }
    },
    "/api/v1/media/{media_id}": {
      "get": {
        "operationId": "get_media",
        "parameters": [
          {
            "in": "path",
            "name": "media_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Media"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Processing status and facts of one media item",
        "tags": [
          "media"
        ]
      }
    },
    "/api/v1/posts": {
      "get": {
        "operationId": "list_posts",
        "parameters": [
          {
            "in": "query",
            "name": "brand_id",
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "* `draft` - draft\n* `awaiting_approval` - awaiting_approval\n* `needs_confirmation` - needs_confirmation\n* `approved` - approved\n* `scheduled` - scheduled\n* `publishing` - publishing\n* `sent` - sent\n* `failed` - failed\n* `expired` - expired\n* `needs_reconnect` - needs_reconnect\n* `deleted` - deleted",
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "draft",
                "awaiting_approval",
                "needs_confirmation",
                "approved",
                "scheduled",
                "publishing",
                "sent",
                "failed",
                "expired",
                "needs_reconnect",
                "deleted"
              ],
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostPage"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Posts, newest first, with cursor pagination",
        "tags": [
          "posts"
        ]
      },
      "post": {
        "description": "The platform rules of the composer apply (see channel_options). Issues come back per channel and field in `error.details`, and nothing is stored. A post is never published without a person's approval, whatever you send. Counts toward 100 posts a day per workspace.",
        "operationId": "create_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Post"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create a post: a draft, or with submit true waiting for a person's approval",
        "tags": [
          "posts"
        ]
      }
    },
    "/api/v1/posts/validate": {
      "post": {
        "operationId": "validate_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PostRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Check a post without saving it: the issues per channel and field",
        "tags": [
          "posts"
        ]
      }
    },
    "/api/v1/posts/{post_id}": {
      "delete": {
        "operationId": "delete_post",
        "parameters": [
          {
            "in": "path",
            "name": "post_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Delete a post that was never sent or approved",
        "tags": [
          "posts"
        ]
      },
      "get": {
        "operationId": "get_post",
        "parameters": [
          {
            "in": "path",
            "name": "post_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Post"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "One post with its variants, their status, errors and approval",
        "tags": [
          "posts"
        ]
      },
      "patch": {
        "description": "Content fields (channels, text, media_ids, ai_generated) replace every copy: send them all. Editing a post a person already approved puts it back to awaiting approval and tells the approvers. scheduled_at and submit may be sent alone.",
        "operationId": "update_post",
        "parameters": [
          {
            "in": "path",
            "name": "post_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchedPostUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Post"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change a draft or a post waiting for approval",
        "tags": [
          "posts"
        ]
      }
    },
    "/api/v1/posts/{post_id}/delete-published": {
      "post": {
        "description": "Public and not undoable, so the body must say `\"confirm\": true` (else 422 `confirmation_required`). Writes a deletion record naming this credential and its source. Needs the approve role.",
        "operationId": "delete_published_post",
        "parameters": [
          {
            "in": "path",
            "name": "post_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeletePublishedRequestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletePublished"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Take sent copies down from their channels, where the platform allows",
        "tags": [
          "posts"
        ]
      }
    },
    "/api/v1/posts/{post_id}/submit": {
      "post": {
        "description": "Needs a time in the future. TikTok copies and copies that post to a board are checked against what the account offers now.",
        "operationId": "submit_post",
        "parameters": [
          {
            "in": "path",
            "name": "post_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Post"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send the draft copies of a post for a person's approval",
        "tags": [
          "posts"
        ]
      }
    },
    "/api/v1/webhooks": {
      "get": {
        "description": "Owner only: a key or app connected by anyone else gets 403 `forbidden`.",
        "operationId": "list_webhooks",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookPage"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "The workspace's webhook endpoints (never the secret)",
        "tags": [
          "webhooks"
        ]
      },
      "post": {
        "description": "Events: post.awaiting_approval, post.approved, variant.sent, variant.failed, variant.needs_reconnect, variant.deleted, channel.needs_reconnect. Each POST carries the header `Postaki-Signature: t=<unix>,v1=<hex>` where hex is the HMAC-SHA256, keyed with the secret, of the text `<t>.<raw body>`; and `Postaki-Delivery-Id` and `Postaki-Event-Id` (also in the body) to de-duplicate. Any 2xx is success; otherwise it is retried after 1 min, 5 min, 30 min, 2 h and 12 h. An endpoint that keeps failing for 3 days is switched off and the owners are told. Redirects are not followed. The secret is in the first answer only: if an idempotent replay shows `secret: null`, delete the webhook and create it again. Owner only: a key or app connected by anyone else gets 403 `forbidden`.",
        "operationId": "create_webhook",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            },
            "description": ""
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Register an https endpoint for events",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/{webhook_id}": {
      "delete": {
        "description": "Owner only: a key or app connected by anyone else gets 403 `forbidden`.",
        "operationId": "delete_webhook",
        "parameters": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No response body"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Remove a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://app.postaki.io"
    }
  ]
}
