Facebook API

Facebook Search posts API

Search public Facebook posts by keyword, optionally filtered by location, and get structured post records (text, author, engagement).

$30.00/1k req, pay per request, no subscription.

What the API returneditems[0]
{
"id": "743920185640217",
"url": "https://www.facebook.com/riversidecommunitymarket/posts/743920185640217",
"text": "Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.",
"authorName": "Riverside Community Market",
"authorUrl": "https://www.facebook.com/riversidecommunitymarket",
"reactionCount": 842,
"commentCount": 96,
"shareCount": 213,
... 8 more fields
}
Uptime
98.39%
30d · 9,173 calls
Requests
9,218
30d · weekly, last 12 wks
Response
18.9s
median · 30d

Pricing and providers

Facebook Search posts API pricing: one API, 3 interchangeable providers

The cheapest provider serves first. If it fails, the next one takes over in the same call.

You pay
$300.00
$30.00/1k req, only for what you use. No monthly plan.
Your first 3 requests are free with the $0.10 starting balance.

Try it

Get Facebook search posts in one request

requireFieldsarray
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `imagesCount` or `albumPreview`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. 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.
Open in
Get a free key
Sample response
Free runs return only the first 3 results. Fund a key to get the full response.

This sample shows 13 of 31 fields. See every field

{
  "found": true,
  "data": {
    "items": [
      {
        "id": "743920185640217",
        "url": "https://www.facebook.com/riversidecommunitymarket/posts/743920185640217",
        "text": "Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.",
        "authorName": "Riverside Community Market",
        "authorUrl": "https://www.facebook.com/riversidecommunitymarket",
        "reactionCount": 842,
        "commentCount": 96,
        "shareCount": 213,
        "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_banner.jpg",
        "createdUtc": 1727366400,
        "type": "post",
        "authorId": "187204093312",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/riverside_market_avatar.jpg",
        "imagesCount": 3,
        "reactions": {
          "like": 610,
          "love": 178,
          "care": 22,
          "haha": 9,
          "wow": 14,
          "sad": 2,
          "angry": 1
        },
        "albumPreview": [
          {
            "id": "743920182306884",
            "type": "photo",
            "url": "https://www.facebook.com/photo/?fbid=743920182306884",
            "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_1.jpg"
          },
          {
            "id": "743920182306901",
            "type": "photo",
            "url": "https://www.facebook.com/photo/?fbid=743920182306901",
            "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_2.jpg"
          }
        ]
      },
      {
        "id": "601487723190845",
        "url": "https://www.facebook.com/oldtownfarmers/posts/601487723190845",
        "text": "Harvest Festival vendor lineup is confirmed. Come say hi to us at booth 12!",
        "authorName": "Old Town Farmers Collective",
        "authorUrl": "https://www.facebook.com/oldtownfarmers",
        "reactionCount": 214,
        "commentCount": 18,
        "shareCount": 31,
        "image": "",
        "createdUtc": 1726934400,
        "type": "post",
        "authorId": "220981473052",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/oldtown_farmers_avatar.jpg",
        "imagesCount": 0,
        "reactions": {
          "like": 180,
          "love": 24,
          "care": 4,
          "haha": 3,
          "wow": 2,
          "sad": 0,
          "angry": 1
        },
        "albumPreview": []
      },
      {
        "id": "918204573110982",
        "url": "https://www.facebook.com/mapleridgeschool/posts/918204573110982",
        "text": "Our 3rd grade class made scarecrows for the Harvest Festival parade this weekend. So proud of this crew!",
        "authorName": "Maple Ridge Elementary PTA",
        "authorUrl": "https://www.facebook.com/mapleridgeschool",
        "reactionCount": 356,
        "commentCount": 42,
        "shareCount": 8,
        "image": "https://scontent.xx.fbcdn.net/v/t39.30808-6/scarecrow_parade.jpg",
        "createdUtc": 1726761600,
        "type": "post",
        "authorId": "339812065521",
        "authorImage": "https://scontent.xx.fbcdn.net/v/t39.30808-1/maple_ridge_avatar.jpg",
        "imagesCount": 1,
        "reactions": {
          "like": 290,
          "love": 55,
          "care": 8,
          "haha": 2,
          "wow": 1,
          "sad": 0,
          "angry": 0
        },
        "albumPreview": []
      }
    ]
  }
}

Full parameter and response reference - every field, type, and example for this endpoint.

Reference

One request, one response shape.

Every field you send and every field you get back, each with a real example.

Last verified 2026-10-31 · uptime and latency measured over 30d

Request body

JSON, posted to this endpoint.

  • querystring

    harvest festival

    Keyword or phrase to search Facebook posts for (e.g. 'product launch').

  • endDatestring

    Only return posts published on or before this date, format YYYY-MM-DD (e.g. 2024-12-31).

  • limitinteger

    3

    Maximum number of results to return (1-20, default 20).

  • locationstring

    Portland, United States

    Optional place name; include both city and country for best matches (e.g. 'Paris, France'). Uses Facebook's place filter, which favors posts tagged at that place rather than every post by people who live there, and can still return some posts from elsewhere.

  • requireFieldsarray

    Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `imagesCount` or `albumPreview`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. 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.

  • startDatestring

    Only return posts published on or after this date, format YYYY-MM-DD (e.g. 2024-01-01).

You send. A small JSON body. The values shown are examples to replace with your own.

Response

JSON, one example value per field.

each albumPreviewdata.albumPreview[]

Preview of the photos attached to the post.

  • idstring

    Numeric Facebook id of the photo, as a string.

  • imagestring

    Image URL of the photo.

  • typestringcan require

    Kind of attachment, e.g. "photo".

  • urlstring

    Canonical Facebook URL of the photo.

datadata
  • authorIdstring

    Numeric Facebook id of the page or profile that posted, as a string.

  • authorImagestring

    Profile picture URL of the page or profile that posted.

  • imagesCountintegercan require

    Number of images attached to the post. Null when the source does not report it.

  • typestringcan require

    Kind of record Facebook returned, e.g. "post".

each itemdata.items[]

Matching public Facebook post records for the query. Populated whenever the provider has data for the entity.

  • authorNamestring

    Riverside Community Market

    Display name of the post's author. Empty when the upstream omits it.

  • authorUrlstring

    https://www.facebook.com/riversidecommunitymarket

    Canonical profile URL of the post's author, with tracking query params stripped. Empty when the upstream omits it.

  • commentCountinteger

    96

    Total number of comments on the post.

  • createdUtcnumber

    1727366400

    UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds.

  • idstring

    743920185640217

    The post's numeric Facebook ID, as a string. Populated whenever the provider has data for the entity.

  • imagestring

    https://scontent.xx.fbcdn.net/v/t39.30808-6/harvest_festival_banner.jpg

    URL of the post's primary image, a signed CDN URL whose query must be kept. Empty for text-only or video posts.

  • reactionCountinteger

    842

    Total number of reactions on the post.

  • shareCountinteger

    213

    Total number of shares/reshares of the post.

  • textstring

    Fall Harvest Festival is back this Saturday! Live music, a pumpkin patch, cider pressing and over 40 local vendors. Free entry, 10am to 5pm at Riverside Park.

    The post's text/message. Empty for media-only posts with no caption.

  • urlstring

    https://www.facebook.com/riversidecommunitymarket/posts/743920185640217

    Canonical URL of the post. A post with no page path keeps the query that identifies it (permalink.php?story_fbid=...&id=...). Populated whenever the provider has data for the entity.

reactionsdata.reactions

Reaction counts on the post, broken down by reaction type.

  • angryinteger

    Angry reactions.

  • careinteger

    Care reactions.

  • hahainteger

    Haha reactions.

  • likeinteger

    Like reactions.

  • loveinteger

    Love reactions.

  • sadinteger

    Sad reactions.

  • wowinteger

    Wow reactions.

top level
  • foundboolean

    true

    Whether any matching posts were returned for the query.

  • reason"not_found"

    Present only when `found` is false, and says why there is no result. `not_found`: the source states the target does not exist, or returned nothing for it. A `found: false` answer is a successful call, not an error, and `costUsd` is what it actually cost.

You get back. Named, typed fields in the same shape whichever source answers.

FAQ

About the Facebook Search posts API

The AnyAPI Facebook Search posts API returns Facebook search posts data as normalized JSON from one POST call to /v1/run/facebook.search_posts. Search public Facebook posts by keyword, optionally filtered by location, and get structured post records (text, author, engagement). AnyAPI routes each request across 3 sources and falls back automatically when one fails. It costs from $30 per 1,000 requests, in US dollars with no subscription and no monthly minimum. Over the last 30 days, 98.4% of Facebook search posts calls through AnyAPI succeeded, with a median response time of 18.9 seconds across 9,173 measured calls.

It costs from $30 per 1,000 requests, in US dollars with no subscription and no monthly minimum. You fund one USD wallet and each call draws it down. Some failed wallet-funded requests incur processing charges that we pass through at cost, with no markup; the error response shows the amount charged.

Search public Facebook posts by keyword, optionally filtered by location, and get structured post records (text, author, engagement). The response is normalized JSON with the same envelope every AnyAPI endpoint returns, so parsing a second endpoint is a change of URL and nothing else.

Over the last 30 days, 98.4% of Facebook search posts calls through AnyAPI succeeded, with a median response time of 18.9 seconds across 9,173 measured calls. These are AnyAPI's own measurements of traffic through the gateway, recomputed continuously, not a published service-level target.

Yes. A new AnyAPI account starts with $0.10 of free balance and no card required, which covers 3 Facebook Search posts calls at $0.03 each.

AnyAPI asks the next of its 3 sources in the same request, cheapest first, so one source going down does not fail your call.

Send a POST request to https://api.getanyapi.com/v1/run/facebook.search_posts with your AnyAPI key in an "Authorization: Bearer" header and the input as a JSON body. The same key and the same wallet work on every AnyAPI endpoint.

No. You add US dollars to one prepaid AnyAPI balance and each request draws it down. There is no monthly plan and no minimum, and the same balance pays for every AnyAPI endpoint.

Yes. Install @getanyapi/sdk from npm for TypeScript or getanyapi from pip for Python. Both call every AnyAPI endpoint with the same key, and any HTTP client works too.

Yes. An agent can connect to the AnyAPI MCP server at https://api.getanyapi.com/mcp, or create its own free-trial key with one unauthenticated POST to https://api.getanyapi.com/agent/signup and call this endpoint over HTTP.