Post with an AI agent or your own code (API)
About 2 minutes with an agent
Give your AI agent (Claude, ChatGPT, Cursor, Claude Code…) one prompt and a key. It asks which channel and which videos, then uploads and posts them - queued for the next time slot, or right away. Developers can call the same API directly.
Easiest: let your agent do it
- 1
Open Settings → API keys (workspace owner only). Type a name like
My agentand click Make key. - 2
Click Copy prompt for my agent (includes this key). It copies one block of text with Postline's address, your key and the instructions.
The prompt contains your key - paste it only into your own agent, never into a shared chat or document. Delete the key in Settings if it leaks.
- 3
Paste it into your agent - one that can run commands or code and read your files (for example Claude Code, Cursor, or ChatGPT with code running on your computer).
- 4
The agent lists your channels and asks: which channel, which video files, the titles and captions (or uses the
.txt/post.jsonnext to each video), and post now or queue. Answer, check its plan, and say yes. - 5
It uploads each video and adds it to the channel - then tells you queued, or gives you the YouTube / Facebook / Instagram links if you chose post now. The videos show up in the channel's Queue or Posted tab.
- 6
Lost the key? Click Copy agent prompt at the top of the card and replace
PASTE_YOUR_POSTLINE_KEY_HEREwith a new key.
For developers: make a key
- 1
Open Settings → API keys (workspace owner only). Type a name like
Reel factoryand click Make key. - 2
Copy the key (
pl_…) - it's shown once. Copy the API address too.A key can add and post videos on every channel in this workspace. Keep it in your project's .env, never in code you share. Delete it in Settings if it leaks.
Send a video
Every call sends the header `Authorization: Bearer pl_…`. `channel` is the channel's exact name (any case) or its id.
- 1
GET
/channels- lists your channels and their platforms, to check names. - 2
GET
/stats?channel=<name>&days=28- a channel's saved numbers, for your AI to analyse. 20 a day per workspace. Make a Stats only key for this: it can't post. - 3
POST
/uploadswith JSON{"channel": "Cooking Channel", "fileName": "ep1.mp4", "size": 7352149}- Postline answers withfileKeyanduploadUrl. - 4
PUT the video file's bytes to
uploadUrlwithContent-Type: video/mp4(no Authorization header - the link is already signed, valid 1 hour). It goes straight to your storage bucket. - 5
POST
/videoswith JSON{"channel": "Cooking Channel", "fileKey": "…", "title": "…", "caption": "… #tags"}. Optional:"tags": ["cat"],"platforms": ["youtube", "facebook"],"postNow": true,"ref": "your-own-id"(a second video with the same ref is refused with 409, so a rerun never posts twice). Answer:{"id": "…", "status": "queued"}(or"posting"). - 6
GET
/videos/<id>- the video's status and, once posted, a link per platform. - 7
GET
/videos?channel=Cooking Channel&status=posted- a channel's videos with their status, ref and links, 100 at a time (limitup to 200; pass the returnedcursorfor the next page). Leave outstatusfor all of them.
Or use the Python script
- 1
Download postline_post.py into your project. It needs only Python 3 - nothing to install.
- 2
Set the key:
export POSTLINE_KEY=pl_…(andPOSTLINE_API=<API address>if Settings shows a different address). - 3
Queue a video:
python3 postline_post.py "Cooking Channel" final/video.mp4. Title and caption come frompost.jsonorvideo.txtnext to it, same as the Upload tab. - 4
Post now and print the links: add
--now --wait. From Python:from postline_post import postthenpost("Cooking Channel", "final/video.mp4", title="…", now=True).
If something goes wrong
- “Too many requests” (429)
- Each key can make 120 requests a minute, start 300 uploads an hour and use
postNow120 times an hour. Wait for the seconds in theRetry-Afterheader, then try again. - 401 “That API key doesn't exist”
- The key was deleted or copied wrong. Make a new one in Settings → API keys.
- 404 “No channel called …”
- The name must match the channel's name in Postline. Run GET /channels (or the script with --channels) to see them.
- “The file isn't in storage yet”
- The PUT to uploadUrl didn't finish. Send the file again, then call POST /videos.
- “Set up video storage first”
- The workspace needs a bucket - Settings → Video storage.
- Uploads keep failing on a slow connection
- The script retries each upload 4 times. Upload links last 1 hour - for very slow links, start a new upload with POST /uploads.