SwapFlow API
Publish content programmatically via REST API
REST API
Publish to any connected social platform using curl, scripts, or your own tools.
List your social accounts
Publish content to a platform
Schedule a post for future publishing
View published post history
Get post details
Update a scheduled post
Get Your API Key
Sign up for SwapFlow to generate API keys and start publishing content programmatically.
Get StartedJust two steps: get your connection IDs, then publish. Files are uploaded directly β no need to pre-upload to SwapFlow first.
# 1. List your connected accounts to find your connection ID
curl -s "https://www.swapflow.top/api/cli/connections" \
-H "X-API-Key: sf_your_api_key_here" | jq .
# 2. Publish a file directly β no pre-upload needed!
curl -X POST "https://www.swapflow.top/api/cli/publish" \
-H "X-API-Key: sf_your_api_key_here" \
-F "file=@photo.jpg" \
-F "connectionId=YOUR_CONNECTION_ID" \
-F "platform=twitter" \
-F "caption=Posted from the API!"Schedule posts for future publishing on any platform. Posts are published automatically with up to 5-minute precision.
# Schedule a post for future publishing
curl -X POST "https://www.swapflow.top/api/cli/posts" \
-H "X-API-Key: sf_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"connectionId": "CONNECTION_ID",
"caption": "Launching tomorrow!",
"scheduledAt": "2026-04-01T15:30:00Z"
}'You can also upload a file and set platform-specific options:
# Schedule a post for future publishing
curl -X POST "https://www.swapflow.top/api/cli/posts" \
-H "X-API-Key: sf_your_api_key_here" \
-F "file=@video.mp4" \
-F "connectionId=CONNECTION_ID" \
-F "caption=Check this out!" \
-F "scheduledAt=2026-04-01T15:30:00Z" \
-F 'platformSettings={"youtube":{"privacyStatus":"public","videoType":"shorts"}}'Publish Parameters Reference
| Parameter | Required | Description |
|---|---|---|
| connectionId | Yes | UUID of the target social connection |
| platform | Yes | Platform name (twitter, tiktok, youtube, etc.) |
| file | No | Media file to upload (multipart/form-data) |
| file1, file2, ... | No | Multiple image files for carousel/multi-image posts (multipart) |
| mediaId | No | UUID of existing media from /api/media |
| mediaIds | No | JSON array of media UUIDs for multi-image posts |
| mediaUrl | No | Direct URL to media file |
| caption | No | Post text or caption |
| mediaType | No | video, image, or text (auto-detected from file) |
| tiktokUserConsent | TikTok | Must be true to publish to TikTok |
| tiktokPrivacyLevel | No | SELF_ONLY, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, or PUBLIC_TO_EVERYONE |
| youtubePrivacy | No | public, private, or unlisted (default: private) |
| youtubeIsShorts | No | true for Shorts, false for long-form (default: true) |
| pinterestBoardId | Pinterest board ID (required for Pinterest) | |
| snapchatType | No | spotlight or stories (default: spotlight) |
| scheduledAt | No | ISO 8601 date for future publish time (min 5 min ahead). Omit for immediate async publish |
| webhookUrl | No | HTTPS URL for publish/fail status callbacks |
| platformSettings | No | Platform-specific options as JSON (e.g. TikTok privacy, YouTube type) |