---
title: "How to get Facebook data"
description: "Get public Facebook Pages, posts, comments, Ad Library ads, events and Marketplace listings as JSON, without Meta app review. What the Graph API allows, code and prices."
canonical_url: https://groundsocial.dev/guides/how-to-get-facebook-data
---
# How to get Facebook data

> Get public Facebook Pages, posts, comments, Ad Library ads, events and Marketplace listings as JSON, without Meta app review. What the Graph API allows, code and prices.

_Checked 2026-11-27._

Reading Facebook Pages you don’t manage through the Graph API needs Meta’s Page Public Content Access feature, which means app review and business verification. A data API reads public Facebook for you: one GET returns a Page with its follower count, category and contact links, 2 credits.

> **Checked 27 November 2026** Every request on this page was run against the live API on that date, and the sample response is from that run. Official-API facts link to the platform’s own pages.

## The official Facebook API

Meta’s Graph API reads the Pages your app’s users manage. Everything else is gated:

- **Page Public Content Access** lets an app read public posts and comments on other Pages, only after App Review and business verification, and possibly extra contracts.
- **CrowdTangle** shut down on 14 August 2024. Its successor, Meta Content Library, is for researchers at academic and non-profit institutions.
- The **Ad Library API** returns political and issue ads everywhere, and other ads only if they reached the EU.

Sources: [Page Public Content Access](https://developers.facebook.com/docs/features-reference/page-public-content-access), [Meta Content Library](https://transparency.meta.com/researchtools/meta-content-library), [Ad Library API](https://developers.facebook.com/docs/graph-api/reference/ads_archive/).

## Quick start

1. **Get a key.** [Sign up](https://groundsocial.dev/app/sign-in?new=1) with an email code: 100 free credits, no card. An agent can sign itself up with `POST https://api.groundsocial.dev/v1/agent/signup`.
2. **Set it in your shell.** `export GROUNDSOCIAL_API_KEY=gs_live_…`
3. **Make the call.** A Page with followers and links: `GET /v1/facebook/pages/nasa`, 2 credits.

cURL:

```bash
curl "https://api.groundsocial.dev/v1/facebook/pages/nasa" \
  -H "Authorization: Bearer $GROUNDSOCIAL_API_KEY"
```

TypeScript:

```ts
const res = await fetch('https://api.groundsocial.dev/v1/facebook/pages/nasa', {
  headers: { Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}` },
})
if (!res.ok) throw new Error((await res.json()).error.hint)
const data = await res.json()
```

Python:

```python
import os, requests

res = requests.get(
    "https://api.groundsocial.dev/v1/facebook/pages/nasa",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
```

## Sample response

Trimmed from the real response on 27 November 2026: lists cut to their first items and long strings shortened. Every field is described in the [tutorial](https://groundsocial.dev/tutorials/facebook/page/python).

```json
{
  "id": "54971236771",
  "name": "NASA - National Aeronautics and Space Administration",
  "url": "https://www.facebook.com/NASA/",
  "category_name": "Government organization",
  "is_verified": true,
  "follower_count": 28000000,
  "following_count": 53,
  "intro": [
    "Page · Government organisation",
    "NATIONAL AERONAUTICS AND SPACE ADMINISTRATION is responsible for this Page",
    "public-inquiries@hq.nasa.gov",
    "nasa.gov/nasa-app",
    "nasa.gov"
  ]
}
```

## Get every page

`/v1/facebook/ads/search` returns ads a page at a time, and each page costs 2 credits. Pass the response’s `page_info.end_cursor` back as `after` until it runs out.

TypeScript:

```ts
// Collect up to 3 pages of ads.
const first = 'https://api.groundsocial.dev/v1/facebook/ads/search?q=running%20shoes&country=US'
const items: unknown[] = []
let cursor: string | undefined
for (let page = 0; page < 3; page++) {
  const url = new URL(first)
  if (cursor) url.searchParams.set('after', cursor)
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}` },
  })
  if (!res.ok) throw new Error((await res.json()).error.hint)
  const data = await res.json()
  items.push(...(data.ads ?? []))
  cursor = data.page_info?.has_next_page ? data.page_info?.end_cursor : undefined
  if (!cursor) break
}
console.log(items.length, 'ads')
```

Python:

```python
import os, requests

# Collect up to 3 pages of ads.
FIRST = "https://api.groundsocial.dev/v1/facebook/ads/search?q=running%20shoes&country=US"
headers = {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"}
items, cursor = [], None
for page in range(3):
    params = {"after": cursor} if cursor else {}
    res = requests.get(FIRST, params=params, headers=headers)
    res.raise_for_status()
    data = res.json()
    items += data.get("ads") or []
    cursor = (data.get("page_info") or {}).get("end_cursor") if (data.get("page_info") or {}).get("has_next_page") else None
    if not cursor:
        break
print(len(items), "ads")
```

## What else you can get from Facebook

| What you get | Endpoint | Credits |
| --- | --- | --- |
| [A Page with followers and links](https://groundsocial.dev/tutorials/facebook/page/python) | `GET /v1/facebook/pages/nasa` | 2 |
| [One post with reactions](https://groundsocial.dev/tutorials/facebook/post/python) | `GET /v1/facebook/posts` | 2 |
| [Comments on a post](https://groundsocial.dev/tutorials/facebook/post-comments/python) | `GET /v1/facebook/posts/comments` | 2 |
| [Ad Library search, any ad type](https://groundsocial.dev/tutorials/facebook/ad-library-search/python) | `GET /v1/facebook/ads/search` | 2 |
| [One advertiser’s ads](https://groundsocial.dev/tutorials/facebook/ad-library-company-ads/python) | `GET /v1/facebook/ads/company` | 2 |
| [Public events](https://groundsocial.dev/tutorials/facebook/event-search/python) | `GET /v1/facebook/events/search` | 1 |
| [Marketplace listings](https://groundsocial.dev/tutorials/facebook/marketplace-search/python) | `GET /v1/facebook/marketplace/search` | 1 |

Each row links to its tutorial. Every Facebook endpoint and price: [Facebook API](https://groundsocial.dev/facebook-api).

## Tips

- Pages take a username (`nasa`), a numeric id or a facebook.com URL.
- Ad Library search covers commercial ads in every country, as the Ad Library website shows them; `sort_by=total_impressions` puts the most-shown ads first.
- `collation_count` on an ad is how many copies of a creative an advertiser runs: a sign it works.

## Use it from Claude or Cursor (MCP)

Every endpoint is also an MCP tool on the remote server `https://api.groundsocial.dev/mcp`. The `?platforms=facebook` below loads only the Facebook tools. The client signs in with OAuth, or send your key as a Bearer token. Tools used in this guide: `facebook_page_get`, `facebook_ads_search`, `facebook_post_get`, `facebook_post_comments`, `facebook_ads_company`, `facebook_event_search`, `facebook_marketplace_search`.

Claude Code:

```bash
claude mcp add --transport http groundsocial "https://api.groundsocial.dev/mcp?platforms=facebook"
```

Cursor:

```json
{
  "mcpServers": {
    "groundsocial": {
      "url": "https://api.groundsocial.dev/mcp?platforms=facebook"
    }
  }
}
```

Claude.ai:

```text
Customize → Connectors → + Add → Add custom connector
URL: https://api.groundsocial.dev/mcp?platforms=facebook
```

> **Then ask** “Find active US ads for “running shoes” in the Meta Ad Library and summarise the hooks of the top 10.”

Setup for ChatGPT, VS Code, Windsurf, n8n and others: [MCP client setup](https://groundsocial.dev/mcp).

## Pricing

Pay per call from prepaid credits; no subscription. 100 free credits cover the examples on this page. Costs below are at the [credit packs](https://groundsocial.dev/pricing)’ highest and lowest rates.

| Job | Credits | Cost |
| --- | --- | --- |
| 1,000 Pages | 2,000 | $2.00 → $0.80 |
| 300 ads for one keyword (10 pages) | 20 | $0.02 → $0.01 |
| Weekly check of 50 competitors’ ads, 4 weeks | 400 | $0.40 → $0.16 |

## FAQ

### Do I get ad spend and impressions?

Only where Meta publishes them: political and issue ads, and EU reach figures. Commercial ads outside the EU show creatives and dates but not spend.

### Can I read private groups or profiles?

No. Only what Facebook shows a logged-out visitor.

### Are failed calls charged?

No. A target that does not exist answers `404 target_not_found`, an upstream failure answers `503`, and neither costs anything. Credits never expire.

### Is Groundsocial official?

No. Groundsocial is an independent API that reads what the platform shows a logged-out visitor. Facebook is a trademark of Meta Platforms, Inc. We are not affiliated with or endorsed by Meta.

## Go deeper

- [Facebook tutorials: 17 endpoints in six languages](https://groundsocial.dev/tutorials/facebook)
- [What replaced CrowdTangle?](https://groundsocial.dev/answers/what-replaced-crowdtangle)
- [Is there a Facebook Ad Library API?](https://groundsocial.dev/answers/facebook-ad-library-api)
- [Ad library API](https://groundsocial.dev/use-cases/ad-library-api)
- [Competitor analysis API](https://groundsocial.dev/use-cases/competitor-analysis-api)

## Related guides

- [How to get Instagram data](https://groundsocial.dev/guides/how-to-get-instagram-data)
- [How to get Threads data](https://groundsocial.dev/guides/how-to-get-threads-data)

Facebook is a trademark of Meta Platforms, Inc. We are not affiliated with or endorsed by Meta.

_Canonical HTML: https://groundsocial.dev/guides/how-to-get-facebook-data_

## Site Navigation

### Global Hub
- [Home](https://groundsocial.dev/index.md)
- [Pricing](https://groundsocial.dev/pricing.md)
- [Endpoints](https://groundsocial.dev/endpoints.md)
- [For agents](https://groundsocial.dev/agents.md)
- [Docs](https://groundsocial.dev/docs.md)
- [Compare](https://groundsocial.dev/compare.md)
- [Blog](https://groundsocial.dev/blog.md)
- [Tutorials](https://groundsocial.dev/tutorials.md)
- [Changelog](https://groundsocial.dev/changelog.md)
- [llms.txt](https://groundsocial.dev/llms.txt)
- [Agent skill](https://groundsocial.dev/SKILL.md)

### On This Topic
- [Groundsocial: Social data in one API call](https://groundsocial.dev/index.md)
- [Pricing](https://groundsocial.dev/pricing.md)
- [Playground](https://groundsocial.dev/playground.md)
- [Use cases](https://groundsocial.dev/use-cases.md)
- [Brand monitoring API](https://groundsocial.dev/use-cases/brand-monitoring-api.md)
- [Social listening API](https://groundsocial.dev/use-cases/social-listening-api.md)
- [Comment scraping API](https://groundsocial.dev/use-cases/comment-scraping-api.md)
- [Influencer discovery API](https://groundsocial.dev/use-cases/influencer-discovery-api.md)
- [Video transcript API](https://groundsocial.dev/use-cases/video-transcript-api.md)
- [Ad library API](https://groundsocial.dev/use-cases/ad-library-api.md)
- [Review monitoring API](https://groundsocial.dev/use-cases/review-monitoring-api.md)
- [Trend detection API](https://groundsocial.dev/use-cases/trend-detection-api.md)
- [Social lead generation API](https://groundsocial.dev/use-cases/lead-generation-api.md)
- [Market research API](https://groundsocial.dev/use-cases/market-research-api.md)

## Structured data

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://groundsocial.dev/"},{"@type":"ListItem","position":2,"name":"Guides","item":"https://groundsocial.dev/guides"},{"@type":"ListItem","position":3,"name":"How to get Facebook data","item":"https://groundsocial.dev/guides/how-to-get-facebook-data"}]}
```
