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

Find the Facebook ID of any URL in bulk: page ID and profile ID, post ID, video and reel ID, photo ID and group ID, plus owner name and canonical URL. No login or Graph API token. Unresolved links are free. Export to CSV, Excel or JSON.

- **URL**: https://apify.com/piotrv1001/facebook-url-to-id-scraper.md
- **Developed by:** [FalconScrape](https://apify.com/piotrv1001) (community)
- **Categories:** Social media, Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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/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

Find the **Facebook ID** behind any Facebook URL, in bulk. The **Facebook URL to ID Scraper** turns page, profile, post, video, reel, photo and group links into their numeric IDs: the Facebook page ID, the profile ID, the post ID, the video ID and the group ID, plus the owner's name and ID and the canonical URL. Paste thousands of links and get one clean row per link, with no login, no Graph API token and no browser extension. It is a fast Facebook ID finder for ads and Conversions API setups, CRM and data matching, and any tool that needs a Facebook numeric ID instead of a vanity URL.

### ✨ Features

- 🔢 **Every ID a link carries**: page ID and profile ID for pages, post ID, video ID, photo ID and the owner's IDs for content, group ID for groups.
- 🔗 **Any kind of link**: `facebook.com/nike`, `profile.php?id=…`, `/posts/pfbid…`, `/videos/…`, `/reel/…`, `/watch/?v=…`, `/photo/?fbid=…`, `/share/…` and `/groups/…`.
- 📦 **Bulk lookups**: hundreds or thousands of URLs per run, one row per URL; duplicate URLs are merged.
- ✅ **Pay only for found IDs**: links that cannot be resolved get a row with the reason and are not charged.

### 🛠️ How It Works

1. **Paste Facebook URLs**: one per line, any mix of pages, posts, videos, reels, photos and groups.
2. **Run the scraper**: each URL is opened the way a logged-out visitor sees it and its IDs are read from the page.
3. **Download the IDs**: JSON, CSV or Excel, or fetch them through the API.

### ⚙️ Input

| Field | What it does |
| --- | --- |
| **Facebook URLs** | Links to convert, one per line. Each URL gives one row. |

```json
{
    "urls": [
        "https://www.facebook.com/nike",
        "https://www.facebook.com/NintendoAmerica/videos/432168259120897/",
        "https://www.facebook.com/groups/874728723021553/"
    ]
}
```

### 💰 Pricing

You pay per Facebook ID found, with no monthly rental.

| Event | Price | What you get |
| --- | --- | --- |
| **Result** | $0.0005 per resolved URL ($0.50 per 1,000) | One row with the IDs of that URL |
| **Actor start** | $0.00005 per run | Charged once when the run starts |

Examples: 1,000 URLs cost $0.50 and 10,000 URLs cost $5. URLs that cannot be resolved (personal profiles, private groups, removed posts, links that are not Facebook) are saved with `resolved: false` and a reason, and are free.

### 📊 Sample Output Data

A page:

```json
{
    "inputUrl": "https://www.facebook.com/nike",
    "resolved": true,
    "type": "page",
    "id": "15087023444",
    "name": "Nike",
    "pageId": "15087023444",
    "profileId": "100044541544829",
    "groupId": null,
    "postId": null,
    "videoId": null,
    "photoId": null,
    "ownerId": null,
    "ownerName": null,
    "url": "https://www.facebook.com/nike",
    "reason": null,
    "scrapedAt": "2026-10-26T15:21:50.035Z"
}
```

A video, and a link that could not be resolved:

```json
[
    {
        "inputUrl": "https://www.facebook.com/NintendoAmerica/videos/432168259120897/",
        "resolved": true,
        "type": "video",
        "id": "432168259120897",
        "postId": "5830990180318720",
        "videoId": "432168259120897",
        "ownerId": "100064368354094",
        "ownerName": "Nintendo of America",
        "pageId": "119240841493711",
        "profileId": "100064368354094",
        "url": "https://www.facebook.com/reel/432168259120897/",
        "reason": null
    },
    {
        "inputUrl": "https://www.facebook.com/profile.php?id=100004",
        "resolved": false,
        "type": null,
        "id": null,
        "reason": "not available: removed, private, or visible to logged-in users only"
    }
]
```

| Field | Meaning |
| --- | --- |
| `type` | `page`, `profile`, `group`, `post`, `video`, `reel` or `photo` |
| `id` | The main numeric ID for that type: the page ID, group ID, post ID, video ID or photo ID |
| `pageId` / `profileId` | For pages: the classic Facebook page ID (the one Ads Manager and the Graph API use) and the profile ID that `profile.php?id=` links use. For content: the owner's |
| `ownerId` / `ownerName` | Who posted the post, video, reel or photo |
| `url` | Facebook's canonical URL for the link |
| `reason` | Why a URL could not be resolved (free rows only) |

### 🎯 Use Cases

- **Find a Facebook page ID** for Meta Ads, the Conversions API, the Ad Library or a Graph API call.
- **Find a Facebook ID in bulk**: turn a spreadsheet of vanity URLs into numeric IDs for CRM matching and deduplication.
- **Facebook group ID lookup** for monitoring and moderation tools.
- **Post and video IDs** for analytics, embeds and the [Facebook Comments Scraper](https://apify.com/piotrv1001/facebook-comments-scraper).

### ❓ FAQ

**How do I find a Facebook ID?** Paste the link (page, post, video, reel, photo or group) and run. The `id` column is the numeric Facebook ID; pages also get both the page ID and the profile ID.

**Why does a page have two IDs?** Pages on Facebook's current page layout have a page ID (used by Ads Manager, the Ad Library and the Graph API) and a profile ID (used in `profile.php?id=` links). Both are returned.

**Do personal profiles work?** Mostly not. Facebook shows personal profiles only to logged-in users, so they come back as `resolved: false` and are free. Public figures and creators with a public profile do resolve.

**Do private groups work?** A group whose page is visible to logged-out visitors resolves to its group ID. Groups Facebook hides from logged-out visitors come back unresolved, free.

**Do I need a Facebook account, cookies or a Graph API token?** No.

**How fast is it?** Several URLs are looked up at once: 77 page URLs took about a minute in our tests, so 1,000 URLs take roughly 15 minutes.

### 🔗 More Facebook Actors

- [Facebook Posts Scraper](https://apify.com/piotrv1001/facebook-posts-scraper): posts of any public page with engagement counts.
- [Facebook Pages Scraper](https://apify.com/piotrv1001/facebook-pages-scraper): page profile, followers, contact details and rating.
- [Facebook Reviews Scraper](https://apify.com/piotrv1001/facebook-reviews-scraper): recommendations and reviews of any public page.

# Actor input Schema

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

Facebook URLs to convert, one per line: pages, public profiles, posts, videos, reels, photos and groups, e.g. `https://www.facebook.com/nike` or `https://www.facebook.com/groups/874728723021553/`. Each URL gives one row; URLs that cannot be resolved are listed free with the reason.

## Actor input object example

```json
{
  "urls": [
    "https://www.facebook.com/nike",
    "https://www.facebook.com/groups/874728723021553/"
  ]
}
```

# 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/nike",
        "https://www.facebook.com/NintendoAmerica/posts/pfbid02JESEPSvyiLGjvewuFYhviAwQjTdxZW1ZfnWTeCzxVWgZLT3xgoLHVDwvuenVRyKKl",
        "https://www.facebook.com/NintendoAmerica/videos/432168259120897/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/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 = { "urls": [
        "https://www.facebook.com/nike",
        "https://www.facebook.com/NintendoAmerica/posts/pfbid02JESEPSvyiLGjvewuFYhviAwQjTdxZW1ZfnWTeCzxVWgZLT3xgoLHVDwvuenVRyKKl",
        "https://www.facebook.com/NintendoAmerica/videos/432168259120897/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("piotrv1001/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 '{
  "urls": [
    "https://www.facebook.com/nike",
    "https://www.facebook.com/NintendoAmerica/posts/pfbid02JESEPSvyiLGjvewuFYhviAwQjTdxZW1ZfnWTeCzxVWgZLT3xgoLHVDwvuenVRyKKl",
    "https://www.facebook.com/NintendoAmerica/videos/432168259120897/"
  ]
}' |
apify call piotrv1001/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,piotrv1001/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/spzIqA17hcp9btLJV/builds/8GSDQb6L19RRFsvQa/openapi.json
