How to Post to a Facebook Page via API
The request flow for posting to a Facebook Page programmatically, including required admin access.
Posting to a Facebook Page via API takes four calls through PostGate: create a hosted connection URL and have a Page admin authorize it, list profiles to get the resulting profile_id, publish with POST /api/posts and a stable Idempotency-Key, then read the post back to confirm delivery. No Graph API SDK, no token handling on your side.
This is the full request flow, end to end: connect a Page you administer, find its profile ID, publish a post, and confirm it actually went out. Four calls, no Graph API SDK, no token handling on your side.
Step 1 — Connect the Page
curl -X POST https://postgate.studio/api/profiles/connect \
-H "Authorization: Bearer $POSTGATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "facebook",
"profile_group_id": "grp_acme123",
"return_url": "https://app.example.com/settings/social"
}'Step 2 — Confirm the connection and find the profile ID
return_url with connected=1&connection_platform=facebook. List profiles for the group to read the resulting profile_id — you'll need it for every post you publish to that Page.curl "https://postgate.studio/api/profiles?profile_group_id=grp_acme123" \
-H "Authorization: Bearer $POSTGATE_API_KEY"Step 3 — Publish the post
Idempotency-Key so a dropped connection and a retry never publish the same post twice — PostGate honors the key for 72 hours.curl -X POST "https://postgate.studio/api/posts?profile_group_id=grp_acme123" \
-H "Authorization: Bearer $POSTGATE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: launch-post-001" \
-d '{
"post": { "body": "We just shipped something new." },
"profiles": ["pro_facebook789"],
"media": ["https://cdn.example.com/launch.jpg"]
}'Step 4 — Confirm delivery
failed target carries a structured error you can act on; awaiting_reconnect means the customer needs to reconnect the Page.curl https://postgate.studio/api/posts/post_01JXYZ \
-H "Authorization: Bearer $POSTGATE_API_KEY"Why is admin access non-negotiable?
pages_manage_posts, sourced from a user with an admin-equivalent task on the Page — and Meta requires the app itself to complete App Review and Business Verification before that permission works for anyone outside the app's own roles. See Facebook Page access token for the token mechanics.Frequently asked questions
Can I post to a personal Facebook profile via API?
No — a personal profile can’t be the destination. The person connecting needs to be an admin (or hold an equivalent task) on a Facebook Page, and posts publish to that Page. The connection runs through a hosted URL that expires after 15 minutes.
Why does posting to a Facebook Page require admin access?
Meta requires a Page access token carrying pages_manage_posts, sourced from a user with an admin-equivalent task on the Page — and Meta requires the app itself to complete App Review and Business Verification before that permission works for anyone outside the app’s own roles.
How do I stop a retry from publishing the same Facebook post twice?
Include a stable Idempotency-Key header on the publish call. PostGate honors the key for 72 hours, so a dropped connection followed by a retry never publishes the same post twice.
How do I confirm a Facebook Page post actually went out?
The create response is acceptance, not proof. Read the post back to see each target’s terminal status and permalink, or — better — subscribe to a webhook instead of polling. A failed target carries a structured error you can act on; awaiting_reconnect means the customer needs to reconnect the Page.
