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.

Written by Philippe Genois

Updated November 28, 2026

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 has nextCursor. Errors look like { "error": { "code", "message", "requestId" } }.

  • Add an Idempotency-Key header (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

  1. Open the Data API page

    Click New key, type a Key name, pick Full access, click Create key, then Copy. Use it as YOUR_KEY below.

  2. 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 or username, followers), plus tiktok and linkedin when they are connected. You get 409 notConnected if Facebook & Instagram isn't connected.

  3. 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, or facebook, 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 (post or story), 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): privacy is required for TikTok and is one of PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLY. It also takes allowComment, 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).

    status is publishing when it goes now, scheduled when it waits for publishAt, and draft for a draft. If approval is on and the key's person isn't an approver, the post waits for approval.

    Refusals come back as 422 with a code such as tiktokPrivacyNeeded, needsPhoto or linkedinNotConnected. Sending mediaUrls, draft, labels, trackClicks or repeat to an app built before those existed gives 409 appNeedsUpdate.

  4. 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" }]
      }
    }

    status is scheduled, publishing, published, partial or failed. Each account shows its url once posted or its error if it refused. A post with that id missing answers 404.

  5. 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 (true holds it back, false books it) and labels (the whole list of names). A post that is already out answers 422 notScheduled. Only labels can change on any post.

  6. 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 partial or failed). The accounts it already reached are left alone.

  7. 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, so 10 is $10 a day.

    • days (whole number from 1 to 30, required): the boost stops by itself after that.

    • network (facebook, instagram or linkedin): 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 answers 422 budgetLow.

  8. 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 204 with 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 appNeedsUpdate means your app was built before that feature. Upgrade your app and try again.

  • Every answer carries a Request-Id header. 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?

NoPartlyYes
Built with Alori