# Facebook Profile & Posts Scraper (`bornoo/facebook-profile-posts-scraper`) Actor

Extract public Facebook profile and page data at scale. Input profile or page URLs and retrieve details like name, bio, follower count, and recent posts with text, timestamps, likes, and comments. Supports proxy rotation, pagination, and structured JSON/CSV export via Apify datasets.

- **URL**: https://apify.com/bornoo/facebook-profile-posts-scraper.md
- **Developed by:** [Biddut Hossain](https://apify.com/bornoo) (community)
- **Categories:** AI, Agents, Automation
- **Stats:** 3 total users, 2 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Facebook Page Graph API Actor

Fetches public **Facebook Page profile info** and/or **recent posts with
engagement metrics** (likes, comments, shares) using Facebook's official
**Graph API**.

> ⚠️ This actor does **not** scrape Facebook's website. It calls the
> official Graph API using a Page Access Token you provide, and only
> works for Pages you own or have been granted access to. This keeps
> usage compliant with Facebook's Terms of Service.

### What it does

- Accepts one or more Facebook Page IDs / usernames
- Fetches profile fields: `name`, `about`, `category`, `fan_count`,
  `followers_count`, `link`, `website`
- Fetches recent posts: `message`, `created_time`, `permalink_url`,
  like/comment/share counts
- Handles pagination up to a configurable `maxPosts` limit
- Pushes structured results to the Apify dataset (exportable as
  JSON/CSV/Excel)

### Requirements

You need:

1. A **Facebook App** registered at [developers.facebook.com](https://developers.facebook.com)
2. A **Page Access Token** with the following permissions:
   - `pages_read_engagement`
   - `pages_read_user_content`
3. Admin access to the Page(s) you want to query (or the Page must have
   granted your app access)

Facebook access tokens expire — for long-running or scheduled actor
runs, use a **long-lived Page Access Token** or set up a token refresh
flow outside this actor.

### Input

| Field | Type | Description |
|---|---|---|
| `pageIds` | array | Page IDs or usernames to fetch |
| `accessToken` | string (secret) | Your Page Access Token |
| `fetchProfileInfo` | boolean | Fetch profile fields (default: `true`) |
| `fetchPosts` | boolean | Fetch recent posts (default: `true`) |
| `maxPosts` | integer | Max posts per page (default: `20`) |
| `graphApiVersion` | string | Graph API version to call (default: `v19.0`) |

Example input:

```json
{
  "pageIds": ["mypage"],
  "accessToken": "EAAxxxxxYOURTOKENxxxxx",
  "fetchProfileInfo": true,
  "fetchPosts": true,
  "maxPosts": 50,
  "graphApiVersion": "v19.0"
}
```

### Output

Each Page produces one dataset item:

```json
{
  "page_id": "mypage",
  "profile": {
    "id": "1234567890",
    "name": "My Page",
    "about": "...",
    "fan_count": 10234,
    "followers_count": 10500
  },
  "posts": [
    {
      "id": "1234567890_9876543210",
      "message": "Post text...",
      "created_time": "2026-07-20T10:00:00+0000",
      "permalink_url": "https://facebook.com/...",
      "likes_count": 120,
      "comments_count": 15,
      "shares_count": 4
    }
  ]
}
```

If a Page fails (invalid token, insufficient permissions, rate limit),
the item will contain an `error` field instead.

### Notes

- Rate limits are governed by Facebook's Graph API usage tiers — see
  the [Graph API rate limiting docs](https://developers.facebook.com/docs/graph-api/overview/rate-limiting)
- Token expiration and permission errors will show up as `error`
  entries in the dataset per-page, not as a hard actor failure

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("bornoo/facebook-profile-posts-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("bornoo/facebook-profile-posts-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call bornoo/facebook-profile-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bornoo/facebook-profile-posts-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/KUDEPXKdnaBcvSpkv/builds/SEmbH1qWe0wl20PAc/openapi.json
