How do I manage social media posts with the API?
Create, read, edit, delete, retry and boost your Facebook, Instagram, TikTok and LinkedIn posts from your own software, with requests to api.alori.dev/v1/social.
With the Alori API, your own software can write a post, read your posts, change one that hasn't gone out, delete it, post it again where it failed, and put money behind it (boost). The routes all start with https://api.alori.dev/v1/social.
Also called: social media API, post to Facebook, Instagram, TikTok or LinkedIn from code, schedule a post, boost a post, API réseaux sociaux, publication, booster une publication
Before you start
Connect your accounts first (Facebook & Instagram, TikTok, LinkedIn) in Connectors. The API can only post to accounts that are connected.
Reading needs a Reports (read only) key or a Full access key. Creating, editing, deleting, retrying and boosting need a Full access key.
Each key can send up to 1,000 requests a minute.
Every answer is
{ "data": { … } }. A list also hasnextCursor. Errors look like{ "error": { "code", "message", "requestId" } }.Add an
Idempotency-Keyheader (1 to 255 characters) to a POST, PATCH or DELETE. If you send the same request again with the same key, you get the first answer back instead of a second post.
Steps
Click New key, type a Key name, pick Full access, click Create key, then Copy. Use it as
YOUR_KEYbelow.See which accounts you can post to.
curl https://api.alori.dev/v1/social/accounts \ -H "Authorization: Bearer YOUR_KEY"The answer lists each Facebook Page and Instagram account (
network,id, name orusername,followers), plustiktokandlinkedinwhen they are connected. You get409 notConnectedif Facebook & Instagram isn't connected.Create a post:
POST /v1/social/posts.curl -X POST https://api.alori.dev/v1/social/posts \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: launch-post-001" \ -d '{ "text": "Northwind Studio just shipped dark mode. Here is how it works.", "accounts": ["facebook", "instagram"], "mediaUrls": ["https://example.com/dark-mode.jpg"], "publishAt": "2026-12-03T14:00:00-05:00" }'{ "data": { "id": "k57abc123", "accounts": ["facebook", "instagram"], "status": "scheduled" } }The body takes:
text(string, required). Use""for a Story or a photo alone.accounts(list of strings): ids, names or usernames from step 2, orfacebook,instagram,tiktok,linkedin. Left out, the post goes to every Facebook and Instagram account.mediaUrls(list of strings): up to 10 photos, or one video, at public https addresses. Instagram and TikTok need one. A video goes out as a Reel.publishAt(ISO date and time with its offset, or milliseconds): when to post. Left out, it goes now.format(postorstory),instagramText(Instagram's own caption),link(a card on Facebook, an article on LinkedIn, only without photos),firstComment(for example hashtags),collaborators(up to 3 Instagram usernames).tiktok(object):privacyis required for TikTok and is one ofPUBLIC_TO_EVERYONE,MUTUAL_FOLLOW_FRIENDS,FOLLOWER_OF_CREATOR,SELF_ONLY. It also takesallowComment,allowDuet,allowStitch,brandOrganic,brandedContent(true or false).draft(true or false): save it on the calendar without posting.labels(up to 10 names; a new name makes the label),trackClicks(true or false),repeat({ "everyWeeks": 2, "left": 3 }, each from 1 to 52).
statusispublishingwhen it goes now,scheduledwhen it waits forpublishAt, anddraftfor a draft. If approval is on and the key's person isn't an approver, the post waits for approval.Refusals come back as
422with a code such astiktokPrivacyNeeded,needsPhotoorlinkedinNotConnected. SendingmediaUrls,draft,labels,trackClicksorrepeatto an app built before those existed gives409 appNeedsUpdate.Read your posts.
curl https://api.alori.dev/v1/social/posts \ -H "Authorization: Bearer YOUR_KEY"You get the latest 25 posts, newest first. To read one post of any age, add its id:
curl https://api.alori.dev/v1/social/posts/k57abc123 \ -H "Authorization: Bearer YOUR_KEY"{ "data": { "id": "k57abc123", "text": "Northwind Studio just shipped dark mode. Here is how it works.", "photos": 1, "video": false, "format": "post", "status": "scheduled", "publishAt": "2026-12-03T19:00:00.000Z", "publishedAt": null, "accounts": [{ "network": "facebook", "name": "Northwind Studio" }] } }statusisscheduled,publishing,published,partialorfailed. Each account shows itsurlonce posted or itserrorif it refused. A post with that id missing answers404.Edit a post that hasn't gone out:
PATCH /v1/social/posts/{id}.curl -X PATCH https://api.alori.dev/v1/social/posts/k57abc123 \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Dark mode is live at Northwind Studio.", "publishAt": "2026-12-04T14:00:00-05:00" }'{ "data": { "id": "k57abc123", "changed": true } }Send only what changes:
text,publishAt(moves it),draft(trueholds it back,falsebooks it) andlabels(the whole list of names). A post that is already out answers422 notScheduled. Onlylabelscan change on any post.Post again where it failed:
POST /v1/social/posts/{id}/retry.curl -X POST https://api.alori.dev/v1/social/posts/k57abc123/retry \ -H "Authorization: Bearer YOUR_KEY"{ "data": { "id": "k57abc123", "status": "publishing" } }It only tries again on the accounts that refused the post (status
partialorfailed). The accounts it already reached are left alone.Boost a post that is already out:
POST /v1/social/posts/{id}/boost.curl -X POST https://api.alori.dev/v1/social/posts/k57abc123/boost \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "dailyBudget": 10, "days": 7, "network": "facebook", "places": ["Canada"] }'{ "data": { "postId": "k57abc123", "network": "facebook", "dailyBudget": 10, "days": 7, "total": "70.00", "currency": "USD", "places": ["Canada"], "status": "launching" } }dailyBudget(number, required): whole units of your ad account's currency, so10is $10 a day.days(whole number from 1 to 30, required): the boost stops by itself after that.network(facebook,instagramorlinkedin): only needed when the post went to several.places(list of words, like cities, regions or countries): if left out, it uses your latest ad's places on that network.
The network bills your own ad account (Meta's or LinkedIn's), never Alori. This spends real money, so only send it when you mean it. The boost then shows in Marketing › Ads, where you can pause it. A LinkedIn boost works only for a post on a company Page: a post on a person's profile answers
422 personalProfile. A budget under the network's minimum answers422 budgetLow.Delete a post:
DELETE /v1/social/posts/{id}.curl -X DELETE https://api.alori.dev/v1/social/posts/k57abc123 \ -H "Authorization: Bearer YOUR_KEY"It answers
204with no body. The post leaves Alori and a scheduled post never goes out. A post that already went out stays on Facebook, Instagram, TikTok and LinkedIn.
Good to know
409 appNeedsUpdatemeans your app was built before that feature. Upgrade your app and try again.Every answer carries a
Request-Idheader. Give it to support if something looks wrong.For keys, webhooks and the rest of the API, see How does the Alori API work?
Did this answer your question?