You need to programmatically search Facebook Pages, grab IDs and profile URLs, and ship it this week. By the end of this article, you’ll query Facebook for pages matching a keyword, parse IDs and names, and be ready to wire those results into your product using the Facebook Scraper API on Zyla API Hub.
What you can build with a pages search
Many apps need a “type a name, pick the right Facebook Page” flow: onboarding merchants, enriching CRM records, powering admin tools, or seeding monitoring pipelines. The Facebook Scraper API provides a Search Pages endpoint that returns structured matches for a query, including the page’s name, canonical URL, image, and a stable Facebook ID you can store. You can also search Facebook videos and events using companion endpoints when you need to enrich discovery beyond pages.
Getting started on Zyla API Hub
The Facebook Scraper API is available on Zyla API Hub, which hosts more than 10,000 public APIs behind one account, one API key, and one subscription model. To try this API:
- Open the listing and Start 7-day trial on Facebook Scraper API.
- Subscribe to get your API key. Zyla uses subscription + quota (not pay-per-call). There is no Free Plan; check the API page for current access options and pricing.
- Call endpoints with the header: Authorization: Bearer YOUR_API_KEY.
Endpoint: Search Pages
Retrieve pages matching a search query.
- Method: GET
- URL: https://zylalabs.com/api/11904/facebook-scraper-api/22640/search-pages
- Required query param:
- query (string): the search term. Example value: messi
cURL
curl -s -X GET "https://zylalabs.com/api/11904/facebook-scraper-api/22610/profile-details-by-url?url=https%3A%2F%2Fwww.facebook.com%2Fzuck%2F" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
{"results":[{"type":"page","profile_url":"https://www.facebook.com/people/Messi/61575483092973/","url":"https://www.facebook.com/people/Messi/61575483092973/","image":{"uri":"https://scontent-los4-1.xx.fbcdn.net/v/t39.30808-1/658173307_122096915972849436_352065376866915770_n.png?stp=dst-png_s120x120&_nc_cat=100&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=Q6GhRcSBlJEQ7kNvwGaGcET&_nc_oc=AdqhrcXMJrRNvPcOqNSazryCVdHytKU23AZJftlymsoAz5L-SLjyIyje1SH1UgAk1ww&_nc_zt=24&_nc_ht=scontent-los4-1.xx&_nc_gid=nONdBaRLdDt8MKTsEq-zFA&_nc_ss=7f180&oh=00_AQD2pz1mHUD7t0Y2DbY5dazGLupDbOuQURnRVV7-FlOWLg&oe=6A5D73A9","width":120,"height":120,"scale":2},"name":"Messi","facebook_id":"61575483092973","is_verified":false},{"type":"page","profile_url":"https://www.facebook.com/people/Messi/61573475127128/","url":"https://www.facebook.com/people/Messi/61573475127128/","image":{"uri":"https://scontent-los4-1.xx.fbcdn.net/v/t39.30808-1/662156613_122095171862782504_7840790257873569794_n.png?stp=dst-png_s120x120&_nc_cat=102&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=fBjMrUIZnSIQ7kNvwEnISn0&_nc_oc=Adp3aMvZds0t7Nkn0ONKaESKkhwLXNJ_Hqi_r2sXdpOodC9UNEGU40F-p_pRlzggoK8&_nc_zt=24&_nc_ht=scontent-los4-1.xx&_nc_gid=nONdBaRLdDt8MKTsEq-zFA&_nc_ss=7f…
Useful fields you’ll likely store:
- results[i].facebook_id: stable page identifier for deduping and joins.
- results[i].name: display name for UI lists.
- results[i].url or results[i].profile_url: canonical link for deep linking.
- results[i].image.uri with width/height/scale: thumbnail in onboarding flows.
- results[i].is_verified: signal for ranking or labeling verified pages.
Python example
This script searches for “messi”, selects the top match, and prints its ID, name, and URL.
import os
import requests
API_KEY = os.environ.get("ZYLA_API_KEY", "YOUR_API_KEY")
url = "https://zylalabs.com/api/11904/facebook-scraper-api/22640/search-pages"
params = {"query": "messi"}
headers = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(url, params=params, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
results = data.get("results", [])
if not results:
print("No pages found")
else:
top = results[0]
print("facebook_id:", top.get("facebook_id"))
print("name:", top.get("name"))
print("url:", top.get("url"))
# Example: access image
image = top.get("image") or {}
print("image_uri:", image.get("uri"))
Other useful search endpoints
If your workflow benefits from discovering videos or events alongside pages, the same API offers dedicated endpoints. Their required parameter is also query. Use them when enriching a search results page or supplying quick links to related media.
Search Events
- Method: GET
- URL: https://zylalabs.com/api/11904/facebook-scraper-api/22642/search-events
- Required param: query (example: beer)
{"results":[{"type":"search_event","event_id":"1469174158547978","title":"Beer Fest 2026","url":"https://www.facebook.com/events/1469174158547978/"},{"type":"search_event","event_id":"1390316932482970","title":"Beer Festival ","url":"https://www.facebook.com/events/1390316932482970/"},{"type":"search_event","event_id":"1950990155494535","title":"Beer Con 1","url":"https://www.facebook.com/events/1950990155494535/"},{"type":"search_event","event_id":"1382265020274853","title":"EASTER BEER FEST","url":"https://www.facebook.com/events/1382265020274853/"},{"type":"search_event","event_id":"1157579969421529","title":"Beer21","url":"https://www.facebook.com/events/1157579969421529/"},{"type":"search_event","event_id":"1772093293614143","title":"Wicken Beer Festival","url":"https://www.facebook.com/events/1772093293614143/"},{"type":"search_event","event_id":"1747992505827558","title":"Beer Festival ","url":"https://www.facebook.com/events/1747992505827558/"}],"cursor":"{\"page_number\": 0, \"flow_cursors_serialized\": {\"INTERNAL_DEBUG_MODULE\": \"{}\", \"SEARCH_CONTROLS_INTERCEPT\": \"{}\", \"INTEGRITY\": \"{\\\"has_more_results\\\"..."}"
Notes:
- Each result includes event_id, title, and url for linking.
- A cursor string is returned in this sample; consult the API page for how to use it if pagination is needed in your app.
Search Videos
- Method: GET
- URL: https://zylalabs.com/api/11904/facebook-scraper-api/22641/search-videos
- Required param: query (example: football)
{"results":[{"type":"search_video","video_id":"791498386713336","video_url":"https://www.facebook.com/reel/791498386713336/","description":"هدف عالمي للموهبة الرجاوية يحيا ايغيز ⭐️🟢🔥\n#الرجاء #الوداد #الماص #بركان #البطولة_المغربية #raja #widad #football #botola","title":"هدف عالمي للموهبة الرجاوية يحيا ايغيز ⭐️🟢🔥 #الرجاء #الوداد #الماص #بركان #البطولة_المغربية #raja #widad #football #botola","author":{"__typename":"User","__isActor":"User","name":"البطولة آنفو","url":"https://www.facebook.com/people/%D8%A7%D9%84%D8%A8%D8%B7%D9%88%D9%84%D8%A9-%D8%A2%D9%86%D9%81%D9%88/100083047823362/","is_verified":false,"id":"100083047823362"},"thumbnail":"https://scontent.fcai19-12.fna.fbcdn.net/v/t15.5256-10/640676129_921391920397606_2677953042354722746_n.jpg?stp=c0.289.720.403a_dst-jpg_s403x403_tt6&_nc_cat=101&ccb=1-7&_nc_sid=e3495b&_nc_ohc=NqrODWPm42UQ7kNvwHU-l1v&_nc_oc=AdkqfKKczR7ZPdaimVUPWio4jBwWw-WHtdodtW8x6NwzQ3WGuQpNpaJI66duMtZB-Rw&_nc_zt=23&_nc_ht=scontent.fcai19-12.fna&_nc_gid=zQWYTQNV7ow0DaMz9wXpBQ&oh=00_AfuAU2U6GEx1XQ4qJwpWczx_ubFqkrwSKA3OtveP0piWtw&oe=69A1B51B","time_and_views_raw":"3 hours ago · 3.3K views"},{"type":"search_video","video_id":"1245009567733383","video_url":"htt…
Notes:
- Each entry includes video_id and video_url for direct linking.
- Some entries return author fields you can surface alongside the title.
Practical implementation tips
- Normalize IDs: Store results[i].facebook_id from Search Pages as your primary key for future lookups and deduplication.
- Stable links: Use results[i].url or results[i].profile_url as the canonical deep link.
- UI ranking: Consider preferring results where is_verified is true when surfacing likely official pages.
- Caching: Cache search results by query string for a short TTL in your backend to reduce repeat calls while users type-ahead.
- Thumbnails: results[i].image.uri includes width/height/scale; use these to pick appropriate sizes for your UI and avoid layout shifts.
From search to details
After selecting a page from the search results, many apps fetch richer profile details. The listing includes a Profile Details By Url sample. You can use it after selecting a page URL from search results.
Official sample: Profile Details By Url
{"profile":{"name":"Mark Zuckerberg","profile_id":"4","url":"https://www.facebook.com/zuck","image":"https://scontent-atl3-2.xx.fbcdn.net/v/t39.30808-1/632598281_10117314650513371_3238643608998008744_n.jpg?stp=dst-jpg_s480x480_tt6&_nc_cat=105&ccb=1-7&_nc_sid=1d2534&_nc_ohc=LjkvEg7sdw8Q7kNvwEaPsox&_nc_oc=AdmCdyxSpDASES67Y_gDG38HAgX4jHJmTVIhvvCWNAPvPyv-pT2MkqAPjlQhPbHwWrY8uW9gqGX2G_SqONA9jbku&_nc_zt=24&_nc_ht=scontent-atl3-2.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_Aft5Pz5CRJir2D9RSDB9DHeDE2DgVFClZFvg3B_3N3-Rdg&oe=69A18B0B","intro":"Bringing the world closer together.","cover_image":"https://scontent-atl3-3.xx.fbcdn.net/v/t39.30808-6/632550896_10117314656231911_7975049830116595629_n.png?_nc_cat=110&ccb=1-7&_nc_sid=2a1932&_nc_ohc=MK0GxxJ3MnAQ7kNvwGa91zk&_nc_oc=AdkYRmT5nQE8Wy7rtQIQVcsAFZpf2O-AfWgQayQistV8orDCmh3HHLcV1wyBGJ4MhxNmm_SjaJsm_Fhj0K4dUZng&_nc_zt=23&_nc_ht=scontent-atl3-3.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_AfvWwbUzfWNcxPpMjaQEicKtpNeAHrXk8D1zfpIjowyKEw&oe=69A17D22","gender":"MALE","about":{},"about_public":[{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nS7-NxdkDDt.png","width":40},"text":"Profile · Public figure","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Founder and CEO at Meta","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Works at Biohub","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nDxCDAeszOF.png","width":40},"text":"Studied Computer Science and Psychology at Harvard University","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yA/r/bStXkZOl3Ha.png","width":40},"text":"Lives in Palo Alto, California","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yh/r/k7egJAGHjmH.png","width":40},"text":"From Dobbs Ferry, New York","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yk/r/exk40A1bzjc.png","width":40},"text":"Married to Priscilla Chan","external_url":null}],"verified":true,"delegate_page_id":null,"reels_profile_id":"YXBwX2NvbGxlY3Rpb246cGZiaWQwUHlEa0Y2ZnV0NlFXdjhtS2NlNDR6dnp3OUJ5TnlXOVZXanNmM2hiWjJ1OXZ6cGVzQmh4NWdRd3RrUU1oajhHSGJoMjczN2hXcEMyMWJXWDRLTWw=","influencer_category":"Profile · Public figure","education":"…
Tip: Wire a simple flow—Search Pages to select a candidate, then pass its URL into a details endpoint—to enrich your internal record with images, labels, and metadata for your UI.
Calling this API from an AI agent (MCP)
If you use MCP-compatible tools (Claude Code, Cursor, Windsurf), you can also call Zyla APIs via the MCP endpoint. Set your API key and invoke the same hub URLs shown above from your agent. See the MCP docs for how to configure an MCP client. This is useful for scripted data collection or to let an IDE agent run searches and paste back structured results during development.
Integrating search into your product
Server-side search backing a typeahead
- On keystroke or submit, call Search Pages with the full query string.
- Cache by query for a brief TTL and dedupe frequent inputs (e.g., “mes”, “mess”, “messi”).
- Render name, image.uri, and is_verified in the dropdown; persist facebook_id and url once selected.
Enrichment upon selection
- Store facebook_id in your database as the foreign key.
- Optionally fetch profile details by URL (see the official sample) to populate images and labels on the profile page in your app.
Monitoring or discovery
- Batch run daily searches for a list of brands or entities; store matched page IDs for downstream processing.
- Use Search Videos or Search Events to surface related content or upcoming events for the entity you track.
Operational notes and reliability pointers
- Authentication: Always send Authorization: Bearer YOUR_API_KEY.
- Quotas and billing: Zyla uses subscription + quota, not pay-per-call. This API offers a 7-day trial on the listing page; check the item page for current quotas.
- Error handling: Treat non-2xx as retryable or user-visible errors depending on your UX; log the query string for debugging.
- Internationalization: Names and titles can include non-Latin characters; ensure UTF-8 handling throughout your stack.
- Thumbnails: Some clients prefetch image.uri server-side to avoid mixed-content or third-party blocking; use your own CDN if needed.
End-to-end walkthrough (quick recap)
- Subscribe on Zyla and copy your API key.
- Call Search Pages with query=messi (or your term) and show the results list.
- Persist the chosen item’s facebook_id and url.
- Optionally call the details endpoint (see official sample) for richer metadata.
- Extend with Search Events or Search Videos if your UX benefits from related content.
FAQ
Do I need a Facebook app or token?
No. You call the Zyla hub URL with Authorization: Bearer YOUR_API_KEY from your Zyla subscription.
What parameters are supported for Search Pages?
The required parameter is query (string). Use the exact hub URL and pass query as shown in the examples.
How do I paginate results?
If the response includes a cursor (as seen in the Search Events example), use it according to guidance on the API page. If not present, process the returned results set as-is.
How do I get richer data after selecting a page?
Use a details endpoint by page URL. See the official “Profile Details By Url” sample above for a working pattern.
What are the access limits and pricing?
Access is subscription + quota (not pay-per-call). This API offers a 7-day trial from the listing page; check the item page for current access options and pricing.
Ready to implement page search now? Create your account, get an API key, and start your 7-day trial here: Facebook Scraper API on Zyla API Hub. Browse more APIs anytime on zylalabs.com.
Official API response
{"profile":{"name":"Mark Zuckerberg","profile_id":"4","url":"https://www.facebook.com/zuck","image":"https://scontent-atl3-2.xx.fbcdn.net/v/t39.30808-1/632598281_10117314650513371_3238643608998008744_n.jpg?stp=dst-jpg_s480x480_tt6&_nc_cat=105&ccb=1-7&_nc_sid=1d2534&_nc_ohc=LjkvEg7sdw8Q7kNvwEaPsox&_nc_oc=AdmCdyxSpDASES67Y_gDG38HAgX4jHJmTVIhvvCWNAPvPyv-pT2MkqAPjlQhPbHwWrY8uW9gqGX2G_SqONA9jbku&_nc_zt=24&_nc_ht=scontent-atl3-2.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_Aft5Pz5CRJir2D9RSDB9DHeDE2DgVFClZFvg3B_3N3-Rdg&oe=69A18B0B","intro":"Bringing the world closer together.","cover_image":"https://scontent-atl3-3.xx.fbcdn.net/v/t39.30808-6/632550896_10117314656231911_7975049830116595629_n.png?_nc_cat=110&ccb=1-7&_nc_sid=2a1932&_nc_ohc=MK0GxxJ3MnAQ7kNvwGa91zk&_nc_oc=AdkYRmT5nQE8Wy7rtQIQVcsAFZpf2O-AfWgQayQistV8orDCmh3HHLcV1wyBGJ4MhxNmm_SjaJsm_Fhj0K4dUZng&_nc_zt=23&_nc_ht=scontent-atl3-3.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_AfvWwbUzfWNcxPpMjaQEicKtpNeAHrXk8D1zfpIjowyKEw&oe=69A17D22","gender":"MALE","about":{},"about_public":[{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nS7-NxdkDDt.png","width":40},"text":"Profile · Public figure","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Founder and CEO at Meta","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Works at Biohub","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nDxCDAeszOF.png","width":40},"text":"Studied Computer Science and Psychology at Harvard University","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yA/r/bStXkZOl3Ha.png","width":40},"text":"Lives in Palo Alto, California","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yh/r/k7egJAGHjmH.png","width":40},"text":"From Dobbs Ferry, New York","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yk/r/exk40A1bzjc.png","width":40},"text":"Married to Priscilla Chan","external_url":null}],"verified":true,"delegate_page_id":null,"reels_profile_id":"YXBwX2NvbGxlY3Rpb246cGZiaWQwUHlEa0Y2ZnV0NlFXdjhtS2NlNDR6dnp3OUJ5TnlXOVZXanNmM2hiWjJ1OXZ6cGVzQmh4NWdRd3RrUU1oajhHSGJoMjczN2hXcEMyMWJXWDRLTWw=","influencer_category":"Profile · Public figure","education":"…
Official API response
{"profile":{"name":"Mark Zuckerberg","profile_id":"4","url":"https://www.facebook.com/zuck","image":"https://scontent-atl3-2.xx.fbcdn.net/v/t39.30808-1/632598281_10117314650513371_3238643608998008744_n.jpg?stp=dst-jpg_s480x480_tt6&_nc_cat=105&ccb=1-7&_nc_sid=1d2534&_nc_ohc=LjkvEg7sdw8Q7kNvwEaPsox&_nc_oc=AdmCdyxSpDASES67Y_gDG38HAgX4jHJmTVIhvvCWNAPvPyv-pT2MkqAPjlQhPbHwWrY8uW9gqGX2G_SqONA9jbku&_nc_zt=24&_nc_ht=scontent-atl3-2.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_Aft5Pz5CRJir2D9RSDB9DHeDE2DgVFClZFvg3B_3N3-Rdg&oe=69A18B0B","intro":"Bringing the world closer together.","cover_image":"https://scontent-atl3-3.xx.fbcdn.net/v/t39.30808-6/632550896_10117314656231911_7975049830116595629_n.png?_nc_cat=110&ccb=1-7&_nc_sid=2a1932&_nc_ohc=MK0GxxJ3MnAQ7kNvwGa91zk&_nc_oc=AdkYRmT5nQE8Wy7rtQIQVcsAFZpf2O-AfWgQayQistV8orDCmh3HHLcV1wyBGJ4MhxNmm_SjaJsm_Fhj0K4dUZng&_nc_zt=23&_nc_ht=scontent-atl3-3.xx&_nc_gid=IndkrZ-NXLMaL1RGOJUuzw&oh=00_AfvWwbUzfWNcxPpMjaQEicKtpNeAHrXk8D1zfpIjowyKEw&oe=69A17D22","gender":"MALE","about":{},"about_public":[{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nS7-NxdkDDt.png","width":40},"text":"Profile · Public figure","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Founder and CEO at Meta","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yi/r/Xcm_N7TYfz4.png","width":40},"text":"Works at Biohub","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yW/r/nDxCDAeszOF.png","width":40},"text":"Studied Computer Science and Psychology at Harvard University","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yA/r/bStXkZOl3Ha.png","width":40},"text":"Lives in Palo Alto, California","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yh/r/k7egJAGHjmH.png","width":40},"text":"From Dobbs Ferry, New York","external_url":null},{"icon":{"height":40,"scale":2,"uri":"https://static.xx.fbcdn.net/rsrc.php/v4/yk/r/exk40A1bzjc.png","width":40},"text":"Married to Priscilla Chan","external_url":null}],"verified":true,"delegate_page_id":null,"reels_profile_id":"YXBwX2NvbGxlY3Rpb246cGZiaWQwUHlEa0Y2ZnV0NlFXdjhtS2NlNDR6dnp3OUJ5TnlXOVZXanNmM2hiWjJ1OXZ6cGVzQmh4NWdRd3RrUU1oajhHSGJoMjczN2hXcEMyMWJXWDRLTWw=","influencer_category":"Profile · Public figure","education":"…