Meta

Facebook Graph API (Meta)

Tokens, Pages, posts, photos, comments, Page insights, batch calls and webhooks on Graph API v27.0: ready-to-send requests.

SocialGuided#facebook#graph-api#pages#meta#webhooks#insights

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The Facebook Graph API is the HTTP interface to Meta's social graph: users, Facebook Pages, posts, photos, comments, insights and the webhooks that tell you when any of them change. Every object has an ID, every request goes to https://graph.facebook.com/{version}/..., and what you can read or write depends on the access token you send and the permissions behind it. This guided collection covers the part most developers need first: understanding tokens, finding your Pages, posting as a Page, moderating comments, reading Page insights, batching calls and wiring up webhooks.

Set up an app in the App Dashboard

  1. Sign in at developers.facebook.com and register as a developer if asked.
  2. Open My Apps > Create app. Pick the use case Manage everything on your Page (this is the Pages API use case; it adds public_profile, pages_show_list and business_management by default). Attach a business portfolio when asked.
  3. In Dashboard > Customize the use case, add the permissions this collection uses: pages_read_engagement, pages_manage_posts, pages_manage_engagement, pages_read_user_content, pages_manage_metadata and read_insights.
  4. Copy the App ID and App secret from App settings > Basic into the appId and appSecret variables.
  5. Open the Graph API Explorer, choose your app, tick the same permissions, click Generate Access Token and log in with a Facebook account that has a role on your Page. Paste the token into accessToken.

While the app is in development, only people with a role on the app (admins, developers, testers) can grant permissions. Before anyone else can use it, every permission must pass App Review (Review > App Review: screencast, reviewer instructions, privacy policy URL) and, for business data, Business verification.

Access tokens

TokenWho it acts asHow you get it
User tokenA person who logged in to your appFacebook Login or the Graph API Explorer. Short-lived (about 1-2 hours); exchange it for a long-lived one (about 60 days).
Page tokenA Facebook PageGET /me/accounts with a user token. A Page token taken from a long-lived user token has no expiry date.
System user tokenA business portfolio's system user, for server automationBusiness settings > System users > Generate token.
App tokenYour app itself (settings, debug_token, webhooks)GET /oauth/access_token?grant_type=client_credentials, server side only.

Most Page calls need the Page token, not the user token: the collection keeps them in two variables, accessToken (user) and pageAccessToken (Page), and each request uses the right one.

Base URL and version

https://graph.facebook.com/v27.0. v27.0 is the current Graph API version (released November 4, 2026, per the Graph API changelog). A version stays available for about two years; change the graphVersion variable to move every request at once.

How to use this collection

  • Fill in appId, appSecret and accessToken.
  • Run 1. Tokens: get an app token, inspect your user token with debug_token, then swap it for a long-lived one.
  • Run 2. You and your Pages. List my Pages saves the first Page's ID and Page token into pageId and pageAccessToken (change them if you manage several Pages).
  • 3. Posts saves the new post's ID into postId, 4. Comments saves commentId, so the later requests work without copying IDs.
  • 5. Insights, 6. Batch requests and 7. Webhooks can run in any order after that.

Limits

Calls are rate limited per app, per user and per Page (Business Use Case limits for Page tokens). Usage is reported in the X-App-Usage and X-Business-Use-Case-Usage response headers and in the App Dashboard. See Rate limiting. The Graph API itself is free to call.

Common errors

CodeMeaningWhat to do
190Access token invalid or expired (subcode 463 = expired, 460 = password changed, 458 = app removed)Log in again or exchange for a long-lived token. Check it with debug_token.
190 / 2069032This call needs a Page access tokenUse pageAccessToken from /me/accounts, not the user token.
10, 200-299Permission missing or not approvedAdd the permission to the use case, grant it again, pass App Review for live users.
100Invalid parameter or unknown fieldCheck spelling of fields, metric names and IDs.
4, 17, 32, 613Rate limitedBack off and retry later; spread calls out.
368Temporarily blocked for policy reasonsWait; review the content you are posting.
1705Tried to comment as a user on a Page postUse a Page token.

Errors come back as {"error": {"message", "type", "code", "error_subcode", "fbtrace_id"}}; quote the fbtrace_id when you ask Meta for help.

Links

Endpoints 26

1. Tokens

  • GETGet an app access token/oauth/access_token?client_id={{appId}}&client_secret={{appSecret}}&grant_type=client_credentialsReturns an app access token: a token that represents your app rather than a person. Use it for app-level calls such as debug_token, reading or changing app…
  • GETDebug a token (debug_token)/debug_token?input_token={{accessToken}}&access_token={{appAccessToken}}Inspects any access token and tells you whose it is, which app issued it, whether it is still valid, when it expires and which permissions (scopes) it…
  • GETExchange for a long-lived user token/oauth/access_token?grant_type=fb_exchange_token&client_id={{appId}}&client_secret={{appSecret}}&fb_exchange_token={{accessToken}}Swaps a short-lived user token (about 1-2 hours, what web login and the Graph API Explorer give you) for a long-lived one that lasts about 60 days. Page…

2. You and your Pages

  • GETWho am I (/me with fields)/me?fields=id,name,picture/me is a shortcut for the object that owns the token: the person for a user token, the Page for a Page token. Graph API returns only id and a few defaults…
  • GETField expansion and paging/me?fields=id,name,accounts.limit(2){id,name,category,tasks}Field expansion fetches an object's edges inside one request instead of one call per edge: edge{field1,field2} picks fields of the objects on the edge,…
  • GETList my Pages (and Page tokens)/me/accounts?fields=id,name,category,tasks,access_tokenLists the Facebook Pages the logged-in person can work on, with the Page access token for each, the Page's category and the tasks the person may perform there…
  • GETGet Page details/{{pageId}}?fields=id,name,category,about,website,emails,location,hours,followers_count,linkReads fields of your Page. Ask only for what you need: a field the Page has not filled in is simply left out of the response. Token: the Page token…
  • POSTUpdate Page details/{{pageId}}Changes Page details such as about, website or hours. Send only the fields you want to change. Requires a Page token from someone who can perform the MANAGE…

3. Posts

  • POSTPublish a post/{{pageId}}/feedPublishes a post on the Page as the Page. Needs a Page token, the pages_manage_posts permission (with pages_read_engagement and pages_show_list) and the…
  • POSTSchedule a post/{{pageId}}/feedCreates an unpublished post that Facebook publishes later. Set published to false and scheduled_publish_time to the moment it should go out: a UNIX timestamp…
  • POSTPublish a photo/{{pageId}}/photosPosts a photo to the Page from a public image URL. url is the image to fetch (it must be reachable by Facebook's servers); caption is the text shown with it…
  • GETRead Page posts (feed)/{{pageId}}/feed?fields=id,message,created_time,permalink_url,full_picture,status_type&limit=10Lists posts on the Page: the Page's own posts, posts by visitors and public posts the Page is tagged in, newest first. Choose fields with fields; limit can be…
  • GETGet one post/{{postId}}?fields=id,message,created_time,permalink_url,shares,comments.summary(true).limit(0)Reads a single post by its ID (postId, set by Publish a post). Add comments.summary(true).limit(0) to the fields to get just the comment count, or…
  • POSTEdit a post/{{postId}}Updates a post's text. Send only what changes, here message. Since v27.0 you can also pass is_ai_generated (true/false) to add or remove the AI-generated…
  • DELETEDelete a post/{{postId}}Deletes the post in postId. This cannot be undone. Page token with pages_manage_posts and the CREATE_CONTENT task. Returns {"success": true}. Error 100 if the…

4. Comments

  • GETRead comments on a post/{{postId}}/comments?fields=id,from,message,created_time,comment_count,like_count&filter=toplevel&summary=trueLists comments on a Page post. filter=toplevel (default) gives top-level comments in the order Facebook shows them; filter=stream gives every comment, replies…
  • POSTComment on a post as the Page/{{postId}}/commentsAdds a comment to the post, written as the Page. Send message (or an image with attachment_url). To tag someone who commented, write @[PSID] in the message…
  • POSTReply to a comment/{{commentId}}/commentsReplies to the comment in commentId; the reply appears threaded under it, written as the Page. Check the comment's can_comment field if a reply fails. Same…
  • POSTHide a comment/{{commentId}}Hides a comment on a Page post from public view without deleting it. Set is_hidden to false to show it again. Only Page comments can be hidden. Page token…
  • DELETEDelete a comment/{{commentId}}Deletes a comment on one of your Page's posts permanently. Prefer hiding when you want to keep a record. Page token with pages_manage_engagement and the…

5. Insights

  • GETPage insights/{{pageId}}/insights?metric=page_media_view,page_total_media_view_unique,page_post_engagements,page_follows&period=day&date_preset=last_7dReturns Page metrics as time series. Pass several metric names in metric, a period (day, week, days_28) and optionally since/until (at most 90 days per…
  • GETPost insights/{{postId}}/insights?metric=post_media_view,post_total_media_view_unique,post_clicks,post_reactions_by_type_totalLifetime metrics for one Page post (the post must be public and owned by the Page). Page token, read_insights and pages_read_engagement. Errors 2932001 (post…

6. Batch requests

  • POSTBatch several calls in one request/Bundles up to 50 Graph API calls into one HTTP request. Send a form field batch holding a JSON array; each element has method, relative_url (no host or…

7. Webhooks

  • POSTSubscribe the app to Page webhooks/{{pageId}}/subscribed_apps?subscribed_fields=feed,mentionInstalls your app on the Page for webhooks and chooses which Page fields to receive. subscribed_fields is a comma-separated list, e.g. feed (posts, comments,…
  • GETList the Page's subscribed apps/{{pageId}}/subscribed_appsShows which apps are installed on the Page for webhooks and the fields each one receives (subscribed_fields). Use it to confirm the previous request worked.…
  • GETTest your webhook verification handshake{{webhookUrl}}?hub.mode=subscribe&hub.verify_token={{verifyToken}}&hub.challenge=1158201444Imitates the verification request Meta sends when you save a callback URL, so you can test your own endpoint before entering it in the App Dashboard. It calls…

API details

Base URL
https://graph.facebook.com/v27.0
Authentication
A bearer token in the Authorization header
An API key in the access_token query parameter
Operations
26 operations on 26 pathsGET 14POST 10DELETE 2
Main resources
1. Tokens 32. You and your Pages 53. Posts 74. Comments 55. Insights 26. Batch requests 17. Webhooks 3
Description format
Swastik Codes guided collection, API version checked against the docs on 2026-11-17

How to test the Facebook Graph API (Meta) in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Facebook Graph API (Meta) collection, without the publisher's secrets.
  3. Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Get an app access token” (GET /oauth/access_token?client_id={{appId}}&client_secret={{appSecret}}&grant_type=client_credentials), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Facebook Graph API (Meta)?

Tokens, Pages, posts, photos, comments, Page insights, batch calls and webhooks on Graph API v27.0: ready-to-send requests. It is listed under Social and has 26 endpoints.

Who publishes the Facebook Graph API (Meta)?

It is listed from Meta's public API description (an OpenAPI document), not published by Meta on Swastik Codes. Anyone who controls facebook.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Facebook Graph API (Meta)?

Requests go to https://graph.facebook.com/v27.0. Endpoint paths are added to this base URL.

How do I authenticate with the Facebook Graph API (Meta)?

It accepts 2 methods: A bearer token in the Authorization header; an API key in the access_token query parameter.

How many endpoints does the Facebook Graph API (Meta) have?

26 operations on 26 paths (14 GET, 10 POST, 2 DELETE). The largest groups are 1. Tokens, 2. You and your Pages, 3. Posts, 4. Comments.

Is forking the Facebook Graph API (Meta) free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.