What you get#
Onekey exposes Facebook as 29 endpoints behind one API key: 9 endpoints return one record (data is an object) and 20 endpoints return a list (data is an array). Every answer uses the same envelope (success, data, metadata, error), the cost is reported in metadata.credits_charged, and fields are mapped onto the unified schema so the code you write for Facebook also works for the rest of the social networks category.
Endpoints#
| Endpoint | What it does | Parameters | Credits | Status |
|---|---|---|---|---|
ad_library | Search the Facebook/Instagram Ad Library (public political/issue and EU ads) by keyword. | q*, country | 2 | beta |
adlibrary_ad | Get Facebook Ad Library ad details. | url, id | 2 | beta needs a pack |
adlibrary_ad_transcript | Get a Facebook Ad Library video ad transcript. | url* | 2 | beta needs a pack |
adlibrary_company_ads | List Facebook Ad Library company ads. | company_name, page_id, cursor | 3 | beta needs a pack |
adlibrary_search_companies | Search Facebook Ad Library companies. | query* | 3 | beta needs a pack |
event_details | Get details for a Facebook event. | url, id | 2 | beta needs a pack |
events | List Facebook events for a city. | url*, cursor | 2 | beta needs a pack |
events_search | Search Facebook events by keyword. | query*, cursor | 2 | beta needs a pack |
group | Get a Facebook group. | url, group_id | 2 | beta needs a pack |
group_posts | List Facebook group posts. | url*, cursor | 2 | beta needs a pack |
marketplace_item | Get a Facebook Marketplace item. | url, id | 2 | beta needs a pack |
marketplace_location_search | Search Facebook Marketplace locations. | query* | 2 | beta needs a pack |
marketplace_search | Search Facebook Marketplace listings. | query*, lat*, lng*, cursor | 2 | beta needs a pack |
page | Facebook page: name, about, category, followers, likes, link, picture. | page* | 2 | beta may need a pack |
page_events | Events of a Facebook page. | page*, cursor | 2 | beta may need a pack |
page_photos | Photos uploaded by a Facebook page. | page*, cursor | 2 | beta may need a pack |
page_posts | Recent public posts of a Facebook page. | page*, cursor | 2 | beta may need a pack |
page_videos | Videos published by a Facebook page. | page* | 2 | beta |
post | A single Facebook post with reaction/comment/share counts. | post_id* | 2 | beta may need a pack |
post_comment_replies | List replies to a Facebook post comment. | feedback_id*, expansion_token*, cursor | 2 | beta needs a pack |
post_comments | Comments on a Facebook post. | post_id*, cursor | 2 | beta may need a pack |
post_transcript | Get Facebook video transcript. | url* | 2 | beta needs a pack |
profile_full | Facebook profile, recent posts, and computed analytics in one call. | url* | 2 | beta needs a pack |
profile_reels_full | Facebook profile reels with exact views, likes, comments, and shares merged in, in one call. | url* | 3 | beta needs a pack |
search_groups | Search Facebook groups by keyword. | query*, cursor | 2 | beta needs a pack |
search_pages | Search public Facebook pages by name (Pages Search, needs Page Public Metadata Access). | q* | 2 | beta |
search_people | Search Facebook people by keyword. | query*, cursor | 2 | beta needs a pack |
search_posts | Search Facebook posts by keyword. | query*, cursor | 2 | beta needs a pack |
search_videos | Search Facebook videos by keyword. | query*, cursor | 2 | beta needs a pack |
A * marks a required parameter. Each endpoint name links to its reference page with the full parameter table, caching window and a recorded response.
Make a request#
This calls facebook.adlibrary_ad (2 credits, beta). Replace YOUR_API_KEY with your key; sign up, no card. 1,000 free credits cover the open-platform endpoints. Hard-to-reach platforms (X, TikTok, Instagram, Reddit, and others marked on their page) need a verified email and a purchased pack.
curl "https://api.onekey.dev/v1/facebook/adlibrary_ad?url=https%3A%2F%2Fwww.facebook.com%2Fnasa" \
-H "x-api-key: YOUR_API_KEY"Fields you get back#
These unified fields come back from Facebook, with the same names as on every other platform. The count is how many of its 29 mapped endpoints return the field; a field the source lacks is null, never missing. 12 platform-specific fields (ext.<name>) come on top, documented on each endpoint page.
| Field | Type | Endpoints |
|---|---|---|
content.text | string | 17 |
content.createdAt | ISO 8601 date | 14 |
content.id | string | 12 |
engagement.likes | integer | 11 |
entity.id | string | 11 |
media.thumbnailUrl | URL | 11 |
entity.url | URL | 10 |
content.url | URL | 9 |
entity.name | string | 9 |
author.displayName | string | 8 |
engagement.comments | integer | 8 |
author.username | string | 7 |
content.title | string | 7 |
engagement.views | integer | 7 |
entity.description | string | 7 |
author.id | string | 6 |
engagement.shares | integer | 6 |
entity.location | string | 5 |
author.avatarUrl | URL | 4 |
author.followers | integer | 3 |
author.url | URL | 3 |
event.endDate | ISO 8601 date | 3 |
event.startDate | ISO 8601 date | 3 |
media.durationSeconds | number | 3 |
author.verified | boolean | 2 |
content.language | string | 2 |
entity.createdAt | ISO 8601 date | 2 |
entity.status | string | 2 |
listing.currency | string | 2 |
listing.price | number | 2 |
listing.seller | string | 2 |
media.url | URL | 2 |
author.bio | string | 1 |
author.contentCount | integer | 1 |
author.following | integer | 1 |
author.website | URL | 1 |
entity.category | string | 1 |
place.address | string | 1 |
place.city | string | 1 |
place.lat | number | 1 |
place.lon | number | 1 |
The full schema is in Unified schema.
Pricing#
Facebook calls cost 2 to 3 credits, flat per endpoint. Free when served from cache (0.2 credit for a cached response over 100 KB). Invalid, failed or not-found calls are not charged. See pricing for credit packs.