Skip to content
postpeg

Facebook API

Publish to Facebook Pages through one API

postpeg publishes to Facebook through its official API, alongside nine other networks, from a single POST /v1/posts. You also get post analytics and the comments on what you published, so you can answer people without opening Facebook.

  • Publish
  • Schedule
  • Analytics
  • Comments
  • Facebook121/63206
    image

    We’re open late on Friday for the street fair: coffee until 10pm and a live set from 7. Details: https://example.com/fair

    Ready

The example below, checked against Facebook’s rules

Facebook’s text limit is generous (63,206 characters), so long announcements fit, and a post can carry up to 10 images or 1 video.

What you can do on Facebook

  • Publish. Publish to Facebook now with POST /v1/posts, alone or in the same request as any of the other networks. More on the Posting API.
  • Schedule. Schedule up to a year ahead with scheduled_at, and cancel with DELETE /v1/posts/{id} any time before it goes out. More on the Scheduling API.
  • Analytics. Read impressions, likes, shares and more per post with GET /v1/posts/{id}/analytics, and follower growth with GET /v1/accounts/{id}/analytics. More on the Analytics API.
  • Comments. List comments on your posts, reply to them, and hide the ones you don’t want shown, with /v1/posts/{id}/comments. More on the Comments API.

Not available on Facebook: direct messages. The coverage table shows what each network supports.

Facebook’s rules, checked before sending

A Facebook post can have up to 63,206 characters, counted as people see them (an emoji is one). Media is optional: up to 10 images or 1 video. postpeg runs these checks on every request, so a post that won’t fit Facebook is refused with a 400 before anything is published, on any network.

Facebook limits as postpeg checks them
Max text63,206 characters
MediaOptional
Images10
Videos1
Images and video togetherNone
Required optionsNone
Connects withHosted OAuth

Connecting Facebook accounts

Call POST /v1/accounts/connect with a profile and "platform": "facebook", and send the account’s owner to the URL you get back. It’s valid for 15 minutes. They approve access on Facebook’s own screen and land on your redirect_url with status=success and the new account_id.

Facebook’s official API publishes to Pages, not personal profiles. The Page’s admin approves access on Facebook’s own screen through postpeg’s hosted OAuth flow.

If Facebook ever expires a login, the account turns reconnect_required so you can ask its owner to connect again. More in Profiles and accounts.

Example: a scheduled Facebook post

One request, with an Idempotency-Key so a retry on your side never posts twice. To post to Facebook and other networks together, add more ids to account_ids.

curl https://api.postpeg.com/v1/posts \
  -H "Authorization: Bearer $POSTPEG_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: facebook-example-2026-10-01" \
  -d '{
    "account_ids": [
      "acc_mfz25g0v3b6n9m2q5w8e1r4t7y"
    ],
    "content": "We’re open late on Friday for the street fair: coffee until 10pm and a live set from 7. Details: https://example.com/fair",
    "media": [
      {
        "url": "https://example.com/street-fair.jpg",
        "type": "image",
        "alt_text": "Street fair"
      }
    ],
    "scheduled_at": "2026-10-01T09:00:00Z",
    "platform_options": {}
  }'
Response · 201 Created
{
  "id": "post_mfz2k3v8q1w5e9r4t7y0u2i6o3",
  "content": "We’re open late on Friday for the street fair: coffee until 10pm and a live set from 7. Details: https://example.com/fair",
  "media": [
    {
      "url": "https://example.com/street-fair.jpg",
      "type": "image",
      "alt_text": "Street fair"
    }
  ],
  "platform_options": {},
  "status": "scheduled",
  "scheduled_at": "2026-10-01T09:00:00.000Z",
  "targets": [
    {
      "account_id": "acc_mfz25g0v3b6n9m2q5w8e1r4t7y",
      "platform": "facebook",
      "status": "pending",
      "platform_post_id": null,
      "url": null,
      "error": null,
      "attempts": 0,
      "published_at": null
    }
  ],
  "created_at": "2026-09-24T14:02:11.418Z"
}

From 09:00 the target moves through queued and publishing to published with the live url, or to failed with the reason in error. Temporary failures are retried, up to 5 attempts with growing waits. See Publishing for every status.

Questions

How do I schedule a Facebook post?
Add scheduled_at (ISO 8601, up to a year ahead) to POST /v1/posts. The post waits as scheduled and goes out within a minute of that time. DELETE /v1/posts/{id} cancels it any time before.
What happens if a post breaks Facebook’s rules?
postpeg checks the text (up to 63,206 characters), the media before anything is sent. A post that doesn’t fit comes back as a 400 with every problem listed in issues, and nothing is published on any network.
Which Facebook features does postpeg support?
Publishing, scheduling, analytics, comments. Direct messages is not available on Facebook; asking for it returns a 400 naming the feature.
Can I hide a comment on a Facebook post?
Yes. POST /v1/posts/{id}/comments/{comment_id}/hide hides it from everyone but its author, and sending "hidden": false shows it again.
Can a Facebook post have several videos?
No. A Facebook post takes up to 10 images or 1 video. A request with more comes back as a 400 naming the problem, and nothing is published.

The same request publishes to all ten networks. Often paired with Facebook:

Or see all 10: X, Instagram, LinkedIn, TikTok, YouTube, Threads, Pinterest, Bluesky and Google Business, in the platform reference.

Send your first post in a few minutes

The 7-day trial has every feature and 3 connected accounts, with no card. The quickstart takes you from a key to a published post.