Social media6 min readBy Purrkey teamUpdated

How to list a Facebook page's recent posts with an API

Get a Facebook page's recent posts with text, author, timestamps, permalinks, reactions and cursor paging, then compare three pages in one table

On this page

You have three competitor Facebook pages and a weekly content review to fill, and you need each page's recent posts in one table with text, timestamps, permalinks and reaction counts. anyapi.facebook.profile_posts returns one page of posts per call for a page or profile link, and data.nextCursor carries you to the next one

The table below is the deliverable design. No run has been executed for this article, so the values are placeholders

The table your weekly review needs

Ten columns, one row per post

ColumnWhat it holds
authorThe page or profile name that posted
createdUtcUTC epoch timestamp in seconds
textThe post text
urlThe post permalink
likesTotal reaction count on the post
commentsComment count on the post
sharesShare count, null when the serving source does not report it
reactions.likeLike reactions
reactions.loveLove reactions
media.typeOne of photo, video or gif

Values here are placeholders showing the shape: a row might read Northwind Plumbing, 1730000000, a caption, a permalink, 42, 7, null, 30, 9, photo. A null shares cell is a real value, not a missing row

What the tool takes

Send url or pageId. url is a Facebook page or profile link, and pageId is the numeric Facebook page id, which suits a spreadsheet that already stores ids. cursor is optional and comes from data.nextCursor in the previous response. requireFields is optional, and the catalog currently lists one value for it: shares

Agents call it through POST /v1/runs with toolId anyapi.facebook.profile_posts. Example input, with invented page handles

Those handles are placeholders. A domain such as acme-plumbing.example cannot stand in for the link here, because the address has to be a facebook.com or fb.com page link, so swap in the three pages you actually track

Fetch one page at a time

Start with the page you care about most. Send its link, read data.posts, and note data.nextCursor. Pass that string back as cursor while it is not null. How many cursor pages you need depends on how often the page posts

Only page and profile links are accepted. The catalog lists the shapes it takes: facebook.com/NAME, /p/NAME-ID, /pages/NAME/ID, /pg/NAME, /people/NAME/ID, profile.php?id=ID, and share links to a page (/share/ID or /share/p/ID), on facebook.com or fb.com with or without www, m, mbasic, web, business or a language subdomain. Text after the page, such as a tab, is ignored

The same rule refuses other link types. A single event, group, reel, video, video or reel share link, hashtag, search, login, about or fb-answers page is refused as invalid input, with no charge. Check the three links before the run: a refused link comes back with no charge and no data

Read the fields that drive the next test

createdUtc is a UTC epoch timestamp in seconds. Multiply by 1000 for a JS Date and you have posting times you can sort, which is how you compare cadence between the three pages. likes is the total reaction count and comments is the comment count. The reactions object splits the total into like, love, haha, wow, sad, angry and care, so one page's response style sits next to another's

shares is null when the serving source does not report it. If share counts belong in your comparison, name shares in requireFields, and the request is served only by a source that returns that field. The catalog warns that this can raise the price, since a dearer source may serve, and that a named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge

media.type tells you whether the post was a photo, video or gif, and that column picks the format for next week's test. url opens the post in a browser when a number looks odd

If found comes back false with a reason of not_found, the call succeeded and the source returned nothing for that target. That is an answer about the page, not a failed request

The agent prompt

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to list recent posts
from three competitor Facebook pages. Check the current inputs and price
of anyapi.facebook.profile_posts before running anything. Call it once
per page with the url, then pass data.nextCursor back as cursor while it
is not null and keep the window you need for one week. Return one table
with a page name column plus author, createdUtc, text, url, likes,
comments, shares, reactions.like, reactions.love and media.type, one row
per post, sorted by createdUtc. Leave shares empty when it is null. If a
link is refused as invalid input, report it and stop that page; do not
substitute another Facebook link.

Example pages (invented handles, replace with the pages you track):
https://www.facebook.com/northwind-plumbing-example
https://www.facebook.com/harbor-view-cafe-example
https://www.facebook.com/example-bike-works

Estimated tool cost

Prices read through the Purrkey catalog on November 13, 2026, from price revision anyapi-catalog-2026-11-05. The unit is max_call, which the catalog defines as "Maximum per call. Successful runs settle at the actual AnyAPI charge". The totals are ceilings

StepFormulaUnit pricePlanned quantityTotal
Single page checkcalls x max price$0.0067 per call1$0.0067
Three-page comparisoncalls x max price$0.0067 per call3$0.0201
Four weekly comparisons4 x 3 calls x max price$0.0067 per call12$0.0804

Each cursor page adds a call, so a deeper window costs more than the three-call figure. Naming shares in requireFields can raise the quoted price to a dearer source's rate. Model fees for the agent are not counted

Run the first page

Open https://purrkey.app/tools/facebook?q=profile_posts, run one page with one cursor page, and read the reactions breakdown before you give the three-page comparison a weekly slot

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with Facebook.
Explore Facebook tools and pricing

FAQ

How do I get a Facebook page's recent posts with an API?

Call anyapi.facebook.profile_posts with a page url or a pageId. Each call returns one page of posts with author, createdUtc, text, url and reactions, plus data.nextCursor for the next page.

What is the difference between url and pageId in anyapi.facebook.profile_posts?

Send at least one of them. url is a page or profile link on facebook.com or fb.com, and pageId is the numeric Facebook page id.

Why is my Facebook group link refused?

Only page and profile links are accepted. Group, event, reel, video, hashtag, search, login and about links are refused as invalid input, with no charge.

How do I fetch older posts from a page?

Pass data.nextCursor from one response back as cursor in the next call. nextCursor is null when that lane has no more posts.

What does a null shares value mean?

The source that served the request does not report share counts. Naming shares in requireFields makes the request wait for a source that does, which can raise the price.

What does createdUtc contain?

A UTC epoch timestamp in seconds. Multiply it by 1000 for a JS Date in milliseconds.

How much does it cost to compare three Facebook pages?

Three calls at $0.0067 per call come to $0.0201, and each extra cursor page adds one more call.

Next step

Try this with Facebook

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See Facebook tools

Share this article