Skip to main content

Search posts

Search public Facebook posts by keyword. Results are relevance-ranked and deduplicated.

GET /v1/facebook/search

Query parameters​

ParameterRequiredDescription
queryyesKeyword or phrase, e.g. electric vehicles or "climate summit".
max_pagesnoNumber of result pages to fetch (1–50, default 1). Each page returns ~10 posts. Billed per page fetched.

Example​

curl "$LISTENX_BASE/v1/facebook/search?query=electric%20vehicles&max_pages=2" \
-H "X-API-Key: $LISTENX_KEY"

Response​

{
"query": "electric vehicles",
"pages_requested": 2,
"pages_fetched": 2,
"returned": 19,
"next_cursor": "eyJ...",
"results": [
{
"id": "100071000_555000111",
"url": "https://www.facebook.com/story.php?story_fbid=555000111&id=100071000",
"author": {
"id": null,
"name": "CleanTech Daily",
"username": "CleanTechDaily",
"url": "https://www.facebook.com/CleanTechDaily/"
},
"text": "Global electric vehicles sales crossed a record this quarter…",
"created_at": "3 hrs"
}
],
"billing": {
"endpoint": "facebook.search",
"units": 2,
"unit_price": "0.010000",
"amount": "0.020000",
"balance_after": "97.230000",
"request_id": "…"
}
}

Fields​

FieldDescription
idPost id — pass to the post endpoint.
urlCanonical post permalink.
authorPost author (id, name, username, url).
textPost text, when present.
created_atWhen the post was published, as shown by Facebook.
next_cursorPass as cursor on a follow-up request to continue; null when exhausted.

Billing​

Billed per page fetched — units equals pages_fetched. See Billing.

Errors​

HTTPcodeMeaning
429upstream_rate_limitedTransient block — retry with backoff.