# Facebook Posts Scraper (`api-ninja/facebook-posts-scraper`) Actor

📘 Scrape public Facebook page posts, captions, and engagement data in a few clicks.

- **URL**: https://apify.com/api-ninja/facebook-posts-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

### What does Facebook Posts Scraper do?

**Facebook Posts Scraper** lets you extract **posts from public Facebook pages** in a repeatable, API-friendly way. Paste one or more Facebook page URLs or page IDs, choose how many results you want, optionally add a date range, and run the Actor to collect post data into an Apify dataset.

This Actor is built for teams and individuals who need **public Facebook page content**, **engagement metrics**, and **structured output** without building and maintaining their own scraper pipeline. Because it runs on the [Apify platform](https://apify.com/), you also get scheduling, monitoring, logs, integrations, and API access out of the box.

### What can this Facebook Posts Scraper do?

- Extract posts from **public Facebook pages**
- Accept both **Facebook page URLs** and **numeric page IDs**
- Collect paginated results automatically
- Limit output with `maxResults` or keep going with `parseAllResults`
- Filter posts by optional `startDate` and `endDate`
- Return structured post data including message text, author info, URLs, timestamps, and engagement counts
- Save results to an Apify dataset that you can export as JSON, CSV, Excel, XML, or HTML

This Actor is especially useful if you want a Facebook page posts API workflow combined with Apify features such as:

- **Scheduling** recurring runs
- **API access** for automation
- **Run history and logs** for monitoring
- **Integrations** with Make, Zapier, webhooks, and custom systems
- **Scalable execution** without managing infrastructure

### Why use Facebook Posts Scraper?

If you work with social media data, public content monitoring, reporting, or research, this Actor gives you a practical way to turn Facebook page activity into structured data.

Common use cases include:

- Tracking brand pages over time
- Monitoring competitors' posting activity
- Collecting post engagement metrics for reporting
- Building internal dashboards for content analysis
- Archiving public page content for research or audits
- Feeding public Facebook page data into ETL and BI pipelines

Instead of manually checking pages or building your own collection process, you can use this Actor as a reusable data source inside the Apify platform.

### What data can Facebook Posts Scraper extract?

The Actor returns one dataset item per post. Depending on the post, the output can include core content, author fields, engagement totals, media references, and attached objects.

| Field                        | Description                                                            |
| ---------------------------- | ---------------------------------------------------------------------- |
| `post_id`                    | Unique Facebook post identifier                                        |
| `type`                       | Post type                                                              |
| `url`                        | Direct URL to the Facebook post                                        |
| `message`                    | Main post text                                                         |
| `message_rich`               | Rich-text post message when available                                  |
| `timestamp`                  | Post timestamp in Unix seconds                                         |
| `comments_count`             | Number of comments                                                     |
| `reactions_count`            | Total number of reactions                                              |
| `reshare_count`              | Number of reshares                                                     |
| `reactions`                  | Breakdown of reactions such as like, love, care, haha, wow, sad, angry |
| `author.id`                  | Facebook page ID of the author                                         |
| `author.name`                | Facebook page name                                                     |
| `author.url`                 | Facebook page URL                                                      |
| `author.profile_picture_url` | Profile image URL                                                      |
| `image`                      | Attached image data when present                                       |
| `video`                      | Attached video data when present                                       |
| `external_url`               | External link attached to the post when present                        |

### How to scrape Facebook page posts

Using this Actor is straightforward:

1. Open **Facebook Posts Scraper** in Apify Console.
2. In the **Input** tab, add one or more public Facebook page URLs or numeric page IDs.
3. Set `maxResults` if you want to cap the number of saved posts per page.
4. Turn on `parseAllResults` if you want the Actor to paginate until no more posts are available.
5. Optionally set `startDate` and/or `endDate` in `YYYY-MM-DD` format.
6. Click **Start**.
7. Review the dataset in the **Storage** tab or access it via API.

This flow works well for both no-code users and developers. Non-technical users can run it directly in the Apify Console. Developers can trigger runs and download results programmatically through the Apify API.

### Input

The Actor input is designed to be simple:

- `urls`: Required. A list of Facebook page URLs or numeric page IDs.
- `maxResults`: Optional. Maximum number of posts to save per input page.
- `parseAllResults`: Optional. When enabled, the Actor keeps paginating until there are no more results.
- `startDate`: Optional. Start of the date range in `YYYY-MM-DD` format.
- `endDate`: Optional. End of the date range in `YYYY-MM-DD` format.

If both `startDate` and `endDate` are provided, the Actor validates that the start date is not later than the end date.

Example input:

```json
{
    "urls": ["https://www.facebook.com/facebook/", "100064860875397"],
    "maxResults": 100,
    "parseAllResults": false,
    "startDate": "2026-05-08",
    "endDate": "2026-05-14"
}
````

### Output

The Actor stores results in the default dataset. You can download the dataset in various formats such as **JSON, HTML, CSV, Excel, XML, or RSS** depending on your workflow.

Example output:

```json
[
    {
        "post_id": "1486934193478596",
        "type": "post",
        "url": "https://www.facebook.com/facebook/posts/pfbid0YYGLM1J7LhQafNHkQ7HngKyAMVrW1ednAunWsVbTLc6MpDT1Grsmqx48sx626unPl",
        "message": "This is your sign to spend some time outside today 🌏",
        "message_rich": "This is your sign to spend some time outside today 🌏",
        "timestamp": 1776870303,
        "comments_count": 7637,
        "reactions_count": 49639,
        "reshare_count": 4159,
        "reactions": {
            "angry": 45,
            "care": 1109,
            "haha": 331,
            "like": 36638,
            "love": 11356,
            "sad": 39,
            "wow": 121
        },
        "author": {
            "id": "100064860875397",
            "name": "Facebook",
            "url": "https://www.facebook.com/facebook",
            "profile_picture_url": "https://example.com/profile.jpg"
        },
        "external_url": null,
        "comments_id": "1486934193478596",
        "shares_id": "1486934193478596",
        "associated_group_id": null
    }
]
```

### How much does it cost to scrape Facebook page posts?

The cost depends on:

- how many Facebook pages you process
- how many posts you request per page
- whether you enable full pagination with `parseAllResults`
- how often you run the Actor

If you only need recent posts from a small set of pages, costs stay low. If you run large historical collections across many pages with full pagination, usage will increase accordingly.

To keep costs predictable:

- start with a small `maxResults`
- test on one or two pages first
- only enable `parseAllResults` when you need the full archive available through pagination
- use date filters to reduce unnecessary collection

For many users, the fastest way to estimate cost is to run a small sample and then scale up based on the number of pages and posts actually needed.

### Tips and advanced options

- Use **numeric page IDs** when you already have them. This reduces one resolution step before post collection begins.
- Use **date filters** when you need a specific reporting period.
- Use **`maxResults`** when you only need recent or representative samples.
- Use **`parseAllResults`** when completeness matters more than speed.
- Check the **run logs** to review request parameters, pagination progress, retries, and saved item counts.
- Use the **Apify API** if you want to trigger this Actor from your own app or data workflow.

### FAQ

#### Can I scrape personal Facebook profiles?

No. This Actor is designed for **public Facebook pages**.

#### Can I use both URLs and numeric IDs in one run?

Yes. The `urls` input can contain a mix of public Facebook page URLs and numeric page IDs.

#### Can I collect all available posts from a page?

Yes. Turn on `parseAllResults` and the Actor will continue paginating until no more results are available.

#### Can I filter by date?

Yes. You can provide `startDate`, `endDate`, or both. If both are provided, the Actor validates the date range before the run proceeds.

#### What if a request fails?

The Actor includes retry logic and logs request progress so runs are more reliable and easier to troubleshoot.

#### Can I export the data to spreadsheets or BI tools?

Yes. Dataset results can be exported in common formats, and you can also consume them through the Apify API.

### Disclaimers and support

This Actor is intended for collecting **publicly available Facebook page data**. Make sure your use complies with the target website terms and with the laws and regulations that apply in your jurisdiction.

If you run into an issue, check:

- the Actor input for invalid URLs or date ranges
- the run logs for request and pagination details
- the **Issues** tab for feedback and known limitations

If you need custom fields, custom transformations, or a broader Facebook data workflow, this Actor can be extended into a more tailored solution.

# Actor input Schema

## `urls` (type: `array`):

Add one or more public Facebook page URLs, such as https://www.facebook.com/humansofnewyork/, or paste numeric Facebook page IDs directly. Personal profiles are not supported.

## `maxResults` (type: `integer`):

Choose how many posts to save for each Facebook page. Ignored when Parse all posts is enabled.

## `parseAllResults` (type: `boolean`):

When enabled, the Actor keeps paginating until there are no more posts available for the page.

## `startDate` (type: `string`):

Optional. Only collect posts published on or after this date in YYYY-MM-DD format.

## `endDate` (type: `string`):

Optional. Only collect posts published on or before this date in YYYY-MM-DD format.

## Actor input object example

```json
{
  "urls": [
    "https://www.facebook.com/facebook/"
  ],
  "maxResults": 100,
  "parseAllResults": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "urls": [
        "https://www.facebook.com/facebook/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/facebook-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 = { "urls": ["https://www.facebook.com/facebook/"] }

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

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

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

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.facebook.com/facebook/"
  ]
}' |
apify call api-ninja/facebook-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=api-ninja/facebook-posts-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Posts Scraper",
        "description": "📘 Scrape public Facebook page posts, captions, and engagement data in a few clicks.",
        "version": "0.0",
        "x-build-id": "2E9u9xJBnzGXysJzb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/api-ninja~facebook-posts-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-api-ninja-facebook-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/api-ninja~facebook-posts-scraper/runs": {
            "post": {
                "operationId": "runs-sync-api-ninja-facebook-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/api-ninja~facebook-posts-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-api-ninja-facebook-posts-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "🔗 Facebook page URLs or IDs",
                        "type": "array",
                        "description": "Add one or more public Facebook page URLs, such as https://www.facebook.com/humansofnewyork/, or paste numeric Facebook page IDs directly. Personal profiles are not supported.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "📌 Maximum posts per page",
                        "minimum": 20,
                        "type": "integer",
                        "description": "Choose how many posts to save for each Facebook page. Ignored when Parse all posts is enabled.",
                        "default": 100
                    },
                    "parseAllResults": {
                        "title": "♾️ Parse all posts",
                        "type": "boolean",
                        "description": "When enabled, the Actor keeps paginating until there are no more posts available for the page.",
                        "default": false
                    },
                    "startDate": {
                        "title": "Start date",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
                        "type": "string",
                        "description": "Optional. Only collect posts published on or after this date in YYYY-MM-DD format."
                    },
                    "endDate": {
                        "title": "End date",
                        "pattern": "^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
                        "type": "string",
                        "description": "Optional. Only collect posts published on or before this date in YYYY-MM-DD format."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
