# Facebook URL to ID Scraper (`socialdataapi/facebook-url-to-id-scraper`) Actor

Facebook URL to ID Scraper — Convert Facebook profile, page, group, and video URLs into their corresponding Facebook IDs. Useful for data extraction, automation, lead generation, audience research, and building Facebook scraping workflows.

- **URL**: https://apify.com/socialdataapi/facebook-url-to-id-scraper.md
- **Developed by:** [Social Data API](https://apify.com/socialdataapi) (community)
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Facebook URL to ID Scraper — Page, Group and Post IDs with Metadata

Facebook URL to ID Scraper turns public Facebook page, group and post links **into their Facebook IDs**. Each row also carries the link type, canonical URL, Open Graph title, description and image, plus the group name and member count or the post ID and owner page ID. Every response is structured JSON — ready to pass directly to an LLM, index into a vector store, or feed a CRM enrichment pipeline. No Facebook account or cookies needed. Paste one link to test, then resolve your whole list in one run.

![Facebook URL to ID Scraper output: Facebook ID, link type and Open Graph data as JSON](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/g-fb-url-to-id-hero.webp)

***

### What data can I extract with Facebook URL to ID Scraper?

Using this Facebook ID API, you will be able to extract the following Facebook link data:

| 🆔 Facebook ID | 📂 Link type (page, group or post) | 🔗 Canonical Facebook URL | 🌐 Resolved URL |
|---|---|---|---|
| 📣 Open Graph title and description | 🖼️ Preview image | 🌍 Locale | 📱 App-link IDs (Android and iOS) |
| 👤 Page or profile object (pages) | 📢 Ad Library page ID (when shown) | 👥 Group name and ID | 🔢 Group member count text |
| 🚪 Group join state | 🧾 Post ID | 🏠 Owner page ID of a post | 🧩 Post story details |
| 🧭 Source URL that was fetched | 📄 Text copies of every object for tables and CSV | | |

***

### How to use Facebook URL to ID Scraper

Marketers, ad engineers and data teams use this Facebook ID finder to turn a list of Facebook links into IDs and public metadata in one run.

**Copy to your AI assistant:**

```text
Facebook URL to ID Scraper (Apify Actor ID: socialdataapi/facebook-url-to-id-scraper, https://apify.com/socialdataapi/facebook-url-to-id-scraper) is an Apify Actor that returns the Facebook ID and public metadata behind a Facebook page, group or post link as structured JSON: Facebook ID, link type, canonical URL, Open Graph title, description and image, group name and member count, post ID and the post's owner page ID. Use it whenever someone needs Facebook IDs without cookies, a login, or a browser - mapping vanity page links to numeric page IDs for ad tools, finding group IDs for a list of groups, or getting the post ID and owner page of a post link. Inputs: startUrls (string[], required, one Facebook link or page username per line; text that is not a link becomes https://www.facebook.com/<text>; empty lines are skipped; no default), proxyConfiguration (object, Apify Proxy settings; every request uses Apify Residential proxy, user-picked groups are honoured when set). Each dataset row is billed as one row_result event; there are no summary or error rows. Rows have a type of "page", "group" or "post": a page link returns one row per page or profile object found on the page (usually about five, all with the page's ID), a post link returns every post found on that page (the requested post carries postId), and a group link returns one row. Facebook's encoded story ID is the facebookId of post rows; the numeric post ID is in postId. Links that Facebook puts behind its login wall, and closed groups, return no row; a page that does not exist returns one row with a null Facebook ID.
```

#### Facebook URL to ID Scraper MCP Server: use these Actors from ChatGPT, Claude or Cursor

Point your AI assistant at Apify's MCP server and it can read Facebook links on its own: the server starts with this Actor already loaded as a tool, so your agent runs it and reads the rows. No glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/facebook-url-to-id-scraper"
```

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. [Open Facebook URL to ID Scraper in the Apify Store](https://apify.com/socialdataapi/facebook-url-to-id-scraper).
3. Enter the Facebook page, group or post links, or page usernames, one per line.
4. Click **Start** (or send your API request).
5. Download or stream your results in JSON, CSV or Excel.

#### How to scale Facebook URL to ID Scraper to bulk

Put every link and username into the same list, one per line: one run works through them in order, with a one-second pause between links, and writes all rows into one dataset. That makes it a bulk Facebook ID converter for spreadsheets of mixed links. For a recurring job, save the input as an Apify task and run it on a schedule, or start several runs through the Apify API with different lists. Each saved row is one `row_result` charge event; a page link usually saves about five rows.

***

### ✨ Features

Facebook URL to ID Scraper fetches clean, structured Facebook IDs and link metadata from Facebook ⚡. It's ideal for ad-account setup, CRM enrichment, de-duplicating link lists and mapping vanity links to IDs that survive username changes.

It extracts, per link:

- **Facebook ID** – the numeric page or profile ID (a Facebook profile ID lookup for public profiles), the group ID, or Facebook's story ID for posts
- **Link type** – page, group or post, detected from the link
- **Open Graph data** – title, description, preview image, locale and app-link IDs
- **Group details** – group name, member count text and join state
- **Post details** – the numeric post ID and the ID of the page that owns the post
- **Ad Library page ID** – when Facebook shows one for the page

⚡ No browser and no login: each link is one page fetch through a residential IP, retried on a fresh IP when Facebook blocks it.

***

### Use cases 💡

- **Ads engineer** — find Facebook page ID values for every brand link before building audiences.
- **Community manager** — use it as a Facebook group ID finder and log member count text.
- **Data engineer** — swap vanity links for Facebook IDs so joins survive username changes.
- **Social analyst** — use it as a Facebook post ID extractor next to each owner page ID.
- **AI agent builder** — feed page titles and descriptions to an agent as company context.

Building an AI agent? [Connect Facebook URL to ID Scraper over MCP](#mcp-integration-for-ai-agents) and let it call the actor on its own.

***

### Why choose this actor?

- **Four kinds of input in one list.** A recorded test run resolved 4 links (a page, a profile, a post and a group) into 12 rows in 11 seconds.
- **The ID plus the context around it.** A recorded page row came back with the page ID 100064368354094, the title "Nintendo of America" and a description showing 5,644,661 followers; a recorded group row carried the group ID 270834543757117 and "901.2K members".
- **3 link types, 20 output fields.** Pages, groups and posts are detected automatically, and every row keeps the raw Facebook objects next to plain-text copies for tables.

***

### ⬇️ Input

![Facebook URL to ID Scraper input: Facebook links or usernames and proxy](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/g-fb-url-to-id-input.webp)

The actor accepts a list of Facebook links or page usernames, one per line, so you can get Facebook ID from URL lists in one run. `startUrls` is the only required field.

| Parameter | Required | Type | Description | Example value |
|---|---|---|---|---|
| `startUrls` | Yes | array of strings | Facebook page, group or post links, page usernames or `@usernames`. Text that is not a link becomes `https://www.facebook.com/<text>` (spaces become hyphens); there is no keyword search. Empty lines are skipped. No default. | `["https://www.facebook.com/NintendoAmerica"]` |
| `proxyConfiguration` | No | object | Apify Proxy settings. Every request goes through Apify Residential proxy; groups (and a country) you pick are used when Apify Proxy is on with groups set. Custom proxy URLs are not used. Prefilled with Residential. | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` |

Accepted link formats:

- Pages and profiles: `https://www.facebook.com/NintendoAmerica`, `NintendoAmerica`, `@NintendoAmerica`
- Groups: `https://www.facebook.com/groups/python`
- Posts: `https://www.facebook.com/zuck/posts/10117999199162391` (links with `/posts/`, `/permalink/` or `/photo` are read as posts)

#### Free plan limits

Users on the Apify free plan can fetch up to 20 rows per run (all links together) and 200 rows per month. When the limit is reached, the run finishes successfully with a status message explaining the limit. Upgrade to any paid Apify plan to remove these limits.

#### Example input

```json
{
  "startUrls": [
    "https://www.facebook.com/NintendoAmerica",
    "zuck",
    "https://www.facebook.com/groups/python",
    "https://www.facebook.com/zuck/posts/10117999199162391"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

***

### ⬆️ Output

![Facebook URL to ID Scraper output: one row per page, group or post object](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/g-fb-url-to-id-output.webp)

Every row is one typed JSON item with the same top-level fields on every run, plus the raw Facebook objects that fit its link type (page, group or post). Export formats: JSON (default), CSV, Excel.

#### Example output

Real rows from a test run: a page row and a group row. Long text fields and nested objects are shortened here (`…`).

```json
[
  {
    "facebookUrl": "https://www.facebook.com/NintendoAmerica/",
    "url": "https://www.facebook.com/NintendoAmerica/",
    "facebookId": "100064368354094",
    "user": {
      "profile_type_name_for_content": "PAGE",
      "id": "100064368354094"
    },
    "openGraph": {
      "app_name": "Facebook",
      "package": "com.facebook.katana",
      "url": "https://www.facebook.com/NintendoAmerica/",
      "app_store_id": "284882215",
      "type": "video.other",
      "title": "Nintendo of America",
      "description": "Nintendo of America. 5,644,661 followers · 26,400 talking about this. Welcome to the official Nintendo of America Facebook Page, …",
      "alt": "Nintendo of America",
      "image": "https://scontent.fdac8-1.fna.fbcdn.net/v/t39.30808-1/341845076_543176411300816_4411528477235321747_n.png?…",
      "locale": "en_US",
      "android_url": "fb://profile/100064368354094",
      "ios_url": "fb://profile/100064368354094"
    },
    "type": "page",
    "openGraphText": "{\"app_name\": \"Facebook\", \"package\": \"com.facebook.katana\", …}",
    "groupText": null,
    "nodeText": null,
    "pageAdLibraryText": null,
    "userText": "{\"profile_type_name_for_content\": \"PAGE\", \"id\": \"100064368354094\"}",
    "rawText": "{\"facebookUrl\": \"https://www.facebook.com/NintendoAmerica/\", …}"
  },
  {
    "source_url": "https://www.facebook.com/groups/python",
    "facebookUrl": "https://www.facebook.com/groups/python/",
    "url": "https://www.facebook.com/groups/python/",
    "facebookId": "270834543757117",
    "group": {
      "name": "Python",
      "url": "https://www.facebook.com/groups/python/",
      "profile_picture": { "uri": null },
      "id": "270834543757117",
      "viewer_join_state": "CAN_JOIN",
      "viewer_forum_join_state": "CAN_JOIN",
      "group_member_profiles": { "formatted_count_text": "901.2K members" }
    },
    "node": {
      "__typename": "Story",
      "creation_time": 1790114189,
      "id": "UzpfSTYxNTU3MTQ4Nzk0Mjk1OlZLOjIzMTIxNDk5Mzk2MjU1NTc=",
      "…": "…"
    },
    "openGraph": {
      "url": "https://www.facebook.com/groups/python/",
      "type": "video.other",
      "title": "Python | Facebook",
      "description": "This is a group for Python developers.",
      "…": "…"
    },
    "groupTitle": "Python",
    "type": "group",
    "openGraphText": "{\"app_name\": \"Facebook\", …}",
    "groupText": "{\"name\": \"Python\", …}",
    "nodeText": "{\"__typename\": \"Story\", …}",
    "pageAdLibraryText": null,
    "userText": null,
    "rawText": "{\"source_url\": \"https://www.facebook.com/groups/python\", …}"
  }
]
```

Post rows add the numeric post ID, the owner page ID, the full story details and the source URL that was fetched; their Facebook ID is Facebook's encoded story ID.

***

### How does it work?

This Facebook ID scraper works like a logged-out visitor, so you never need a Facebook account. Every request goes through a rotating residential IP from Apify Proxy, and your link is loaded with plain HTTP requests, without a browser. The actor then reads the public information Facebook shows for that link, including the page, group or post IDs. When Facebook answers with a block or a login wall, the link is retried up to three times, each time on a fresh residential IP. It returns only what any visitor sees without logging in; closed groups and login-walled links return nothing. Every row uses the same field names, and the raw Facebook objects are kept next to their plain-text copies, so you can parse as much or as little as you need.

***

### How do you integrate Facebook URL to ID Scraper into your stack?

It works with what you already use: the Apify REST API from any language, MCP for AI agents, and no-code tools.

#### MCP integration for AI agents

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/facebook-url-to-id-scraper"
```

This registers Apify's MCP server in your client with this Actor already loaded as a tool; your agent calls it directly, passing the same JSON input you would use in the Console. Sign in with your Apify account when the client asks. Compatible clients include Claude Code, Cursor and Windsurf.

#### No-code tools (n8n, Make, LangChain)

**n8n:** add the Apify node, choose "Run an Actor", pick this Actor and pass the same JSON input; the next node receives the dataset rows with each Facebook ID.

**Make:** use the Apify app's "Run an Actor" module, then "Get Dataset Items" to map the Facebook ID, link type and Open Graph title into Google Sheets or a CRM.

**LangChain:** the `langchain-apify` package's `ApifyActorsTool` runs an Apify Actor by its ID (`socialdataapi/facebook-url-to-id-scraper`); the agent then gets the rows back as tool output.

***

### Is it legal to scrape Facebook data?

Collecting publicly available Facebook data, such as page, group and post IDs shown to logged-out visitors, is generally lawful in many jurisdictions. This actor returns only publicly available data: what any user sees without logging in. Some rows can include names of public pages or of people who posted publicly. Under GDPR, scraping public data is generally permissible, but storing and using it must comply with local data-protection law. Consult legal counsel if your use case involves bulk storage of personal data.

***

### Frequently asked questions

#### What fields does Facebook URL to ID Scraper return?

It returns the Facebook ID, the link type, the canonical URL, the Open Graph title and description, and for groups and posts the group details or the post ID. See [the data fields section](#what-data-can-i-extract-with-facebook-url-to-id-scraper) for the full list.

#### Does Facebook URL to ID Scraper require a Facebook account or login?

No. Only public data that Facebook shows to logged-out visitors is extracted. No credentials or cookies are needed.

#### How fast does Facebook URL to ID Scraper run?

A recorded test run resolved 4 links into 12 rows in 11 seconds. Every link is fetched live from Facebook, not from a cache; a link that Facebook blocks takes longer because it is retried on a fresh IP.

#### What happens if a link is private or doesn't exist?

A closed group or a link behind Facebook's login wall returns no row, and the run log shows a warning for it. A page that does not exist returns one row with the Facebook ID set to null, so check for a null ID in your code. A link that cannot be fetched at all also returns no row.

#### Can I scrape multiple Facebook links at once?

Yes. Put as many links and usernames as you need into the list, one per line; the run works through them in order and saves all rows into one dataset.

#### Does Facebook URL to ID Scraper work with Claude, ChatGPT, and other AI agent tools?

Yes — Facebook URL to ID Scraper is available as an MCP tool through Apify's MCP server. Register it in Claude Code, Cursor or Windsurf with `claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/facebook-url-to-id-scraper"`, and the agent gets this Actor as a ready-to-call tool. Any agent that can call an HTTP endpoint can use the Apify REST API directly.

#### Does Facebook URL to ID Scraper return data in a format LLMs can use directly?

Yes. Every row is JSON with consistent field names, and each nested object also comes as a plain-text copy. No HTML parsing, no selectors: pass it straight to an LLM, index it into a vector store, or feed it to an agent tool.

#### What happens when Facebook changes its layout or updates its anti-bot system?

The actor is maintained. When Facebook changes, the actor is updated, and your calls keep returning the same field names with no changes on your end.

#### Can I use Facebook URL to ID Scraper without managing proxies or browser infrastructure?

Yes. Residential proxy rotation and retries on a fresh IP run on the actor's side, and it uses plain HTTP, so there is no browser to run. You send one request and get JSON back.

#### Which Facebook link fields work best for AI training data and RAG indexing?

For RAG, use the Open Graph title and description and the group name as text, keyed by the Facebook ID. For structured data, the Facebook ID, link type, post ID and owner page ID are the most consistent fields across rows. Values come as strings, numbers, booleans and nested objects exactly as Facebook provides them.

***

### Your feedback

Found a bug or missing a field? Let us know on the Issues tab of this Actor's page in Apify Console. Include the links you ran, so the problem can be reproduced quickly; every report is read and fixes are shipped in new versions.

# Actor input Schema

## `startUrls` (type: `array`):

🌐 One item per line: a full Facebook link (page, group or post) or a page username.

✅ Examples: https://www.facebook.com/NintendoAmerica, NintendoAmerica, @NintendoAmerica, https://www.facebook.com/groups/python, https://www.facebook.com/zuck/posts/10117999199162391.

🔤 Text that is not a link is turned into https://www.facebook.com/<text> (spaces become hyphens); there is no keyword search.

📦 One link can return several rows: a page returns one row per profile object found, a post link returns every post found on that page. Empty lines are skipped.

🆓 Free plan: up to 20 rows per run (all links together) and 200 per month; paid plans have no limit.

## `proxyConfiguration` (type: `object`):

🔒 Every request goes through Apify Residential proxy, whatever you set here. If you turn on Apify Proxy and pick proxy groups (and optionally a country), those groups are used; otherwise Residential is used automatically. Custom proxy URLs are not used.

🔄 When Facebook blocks a request, the link is retried up to 3 times, each time on a fresh residential IP.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.facebook.com/NintendoAmerica"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

All scraped items in the Actor's default dataset.

# 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 = {
    "startUrls": [
        "https://www.facebook.com/NintendoAmerica"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdataapi/facebook-url-to-id-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 = {
    "startUrls": ["https://www.facebook.com/NintendoAmerica"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("socialdataapi/facebook-url-to-id-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 '{
  "startUrls": [
    "https://www.facebook.com/NintendoAmerica"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call socialdataapi/facebook-url-to-id-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdataapi/facebook-url-to-id-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/81EGyqnnsBqFIJIuZ/builds/ufpQnIpgNC1PEN9pK/openapi.json
