# Facebook URL to ID Converter - Page, Profile, Group & Post IDs (`seemuapps/facebook-url-to-id`) Actor

Convert Facebook URLs and usernames to numeric IDs in bulk: page, profile, group, post, video, reel, photo and event IDs, plus owner ID, name and canonical URL.

- **URL**: https://apify.com/seemuapps/facebook-url-to-id.md
- **Developed by:** [Seemu Scraping](https://apify.com/seemuapps) (community)
- **Stats:** 3 total users, 2 monthly users, 83.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 id from urls

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 Converter - Page, Profile, Group & Post IDs

Convert any list of Facebook links or usernames into numeric Facebook IDs, in bulk. Paste page, profile, group, post, video, reel, photo or event URLs, or just usernames like `nike`, and get back the Facebook ID, the classic Page ID, the owner's ID and name, and the canonical URL. You don't need a login, cookies or a Facebook account.

| You paste | You get |
|-----------|---------|
| `facebook.com/nike` or just `nike` | Profile ID `100044541544829`, Page ID `15087023444`, name, category |
| `facebook.com/profile.php?id=4` | Profile ID `4`, plus username `zuck` and name |
| `facebook.com/groups/germtheory.vs.terraintheory` | Group ID `430027810407566`, group name |
| `facebook.com/NintendoAmerica/posts/pfbid0…` | Post ID `1511634000992197`, owner ID and owner name |
| `facebook.com/reel/2166091230582141` | Video ID, owner ID `100044541544829` (Nike) |
| `facebook.com/photo/?fbid=…` | Photo ID, album ID, owner ID |
| `facebook.com/events/268531753332225` | Event ID, event name |

### What you get

One row per input URL, in a flat table that's easy to export:

- **facebookId**: the main numeric ID of whatever the URL points to (profile, group, post, video, photo or event)
- **type**: `profile`, `page`, `group`, `post`, `groupPost`, `video`, `reel`, `photo` or `event`
- **profileId**: the profile ID of a person or page (the ID that works in `facebook.com/profile.php?id=`)
- **pageId**: the classic Facebook Page ID, which Ads Library, Business Manager and older page tools use. It is often different from the profile ID on the newer page layout.
- **groupId**, **postId**, **videoId**, **photoId**, **eventId**, **albumId**
- **ownerId** and **ownerName**: who posted the post, video, reel or photo
- **name**: the page, profile, group or event name
- **username**: the vanity username (for example `NintendoAmerica`)
- **category**: the page category (for example `Sportswear Store`)
- **canonicalUrl**: the clean, resolved URL. Redirects like `facebook.com/nintendo` → `facebook.com/NintendoAmerica` are followed.
- **status**: `ok`, `notFound`, `private` or `invalid`, with an **error** message explaining any failure

Export to JSON, CSV, Excel or Google Sheets from the **Dataset** tab, or pull results through the Apify API.

### Use cases

- **Facebook ads and audience tools**: get the Page ID that Ads Library and Business Manager ask for
- **Lead lists and CRM enrichment**: turn a spreadsheet of Facebook links into stable numeric IDs that survive username changes
- **Deduplication**: `facebook.com/nintendo`, `m.facebook.com/NintendoAmerica` and `profile.php?id=100064368354094` all resolve to the same ID
- **Social listening and research pipelines**: feed numeric page, group and post IDs into other Facebook scrapers and APIs
- **Resolving share links**: expand `pfbid` post links and short links to real post IDs and their authors

### How to use

1. Paste your Facebook URLs or usernames into **Facebook URLs or usernames**, one per line. You can mix full URLs, `m.facebook.com` links, `@username` and bare usernames.
2. Keep **Include names and owner IDs** on to get names, owner IDs, Page IDs and canonical URLs for every row. Turn it off for the fastest conversion: URLs that already contain a numeric ID (`profile.php?id=`, `/groups/123`, `/posts/123`, `/reel/123`, `/photo?fbid=`, `/events/123`) are then converted from the URL alone.
3. Run the actor. Results appear in the **Dataset** tab in the same form as the input list.

Supported URL formats:

- Pages and profiles: `facebook.com/<username>`, `profile.php?id=`, `/people/<name>/<id>`, `/pages/<name>/<id>`, `m.`, `web.` and `mbasic.` hosts, bare usernames
- Groups: `/groups/<name>` and `/groups/<id>`, including `/permalink/` and `/posts/` links inside groups
- Posts: `/<page>/posts/<id>`, `/posts/pfbid…`, `permalink.php?story_fbid=…&id=…`, `story.php`
- Videos and reels: `/<page>/videos/<id>`, `/watch/?v=`, `/reel/<id>`, `fb.watch` links
- Photos: `/photo/?fbid=`, `photo.php?fbid=`, `/<page>/photos/<album>/<id>`
- Events: `/events/<id>` and `/events/<slug>/<id>`
- Share links: `/share/p/…`, `/share/v/…`, `/share/r/…` are followed to the real URL

### Output example

```json
{
  "inputUrl": "nintendo",
  "status": "ok",
  "type": "page",
  "facebookId": "100064368354094",
  "profileId": "100064368354094",
  "pageId": "119240841493711",
  "groupId": null,
  "postId": null,
  "videoId": null,
  "photoId": null,
  "eventId": null,
  "albumId": null,
  "ownerId": null,
  "ownerName": null,
  "name": "Nintendo of America",
  "username": "NintendoAmerica",
  "category": "Video Game",
  "canonicalUrl": "https://www.facebook.com/NintendoAmerica/",
  "resolvedBy": "page",
  "error": null
}
```

`resolvedBy` shows where the ID came from: `url` means it was read from the link itself, and `page` or `api` means it was looked up.

### Pricing

You pay per result that resolves successfully. There are two rates:

- **ID read from the URL** (`id-result`): the link already contained the numeric ID, so no lookup was needed. This is the cheapest rate.
- **ID looked up** (`id-lookup`): the link needed a lookup, such as a username, a `pfbid` post or a share link, or you asked for names and owner IDs.

Invalid URLs, private profiles and links that no longer exist are listed in the results with an `error`, and you are **not charged** for them.

### FAQ

**What's the difference between profileId and pageId?**
On Facebook's newer page layout, every page has a profile ID (for example Nike is `100044541544829`) and a separate classic Page ID (Nike's is `15087023444`). Ads Library, Business Manager and many older tools use the Page ID. Profile links and newer tools use the profile ID. You get both, and `facebookId` is always the profile ID.

**Why do some personal profiles come back as private?**
Facebook doesn't show the ID of a personal profile when the owner has restricted it to logged-in viewers. If you have the `profile.php?id=` link, the ID is read straight from it.

**Does it work with groups?**
Public groups resolve from their name. For any group, a `/groups/<number>` link, or a group post link that contains numbers, is read straight from the URL.

**How fast is it?**
Links with an ID in them convert almost instantly. Lookups take about a second each, and five run in parallel by default (up to 20 with **Parallel lookups**).

# Actor input Schema

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

One per line. Pages, profiles (vanity or profile.php?id=), groups, posts (incl. pfbid links), videos, reels, photos, events, share links, or bare usernames like 'nike'.

## `includeDetails` (type: `boolean`):

On: every URL is looked up to add the name, owner ID, classic Page ID, category and canonical URL. Off: URLs that already contain a numeric ID are converted instantly from the URL alone (fastest); only usernames, pfbid posts and share links are looked up.

## `useFallback` (type: `boolean`):

When a profile, page or post cannot be read directly, try a second lookup method before giving up. Groups and events have no backup lookup.

## `maxConcurrency` (type: `integer`):

How many URLs are looked up at the same time.

## `useResidentialFallback` (type: `boolean`):

If Facebook blocks a lookup through the proxy above, retry it through a residential proxy before giving up.

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

Proxy used for lookups. The default datacenter proxy handles most lookups quickly and cheaply.

## Actor input object example

```json
{
  "urls": [
    "https://www.facebook.com/nike",
    "https://www.facebook.com/groups/germtheory.vs.terraintheory",
    "https://www.facebook.com/NintendoAmerica/posts/pfbid09PPhHDZ1wEi19DBTuZJ8L7ZMxiGGpSyfRXPiPx3gKK17KBh2k53HERZzjK7VYZP7l",
    "https://www.facebook.com/reel/2166091230582141/",
    "zuck"
  ],
  "includeDetails": true,
  "useFallback": true,
  "maxConcurrency": 5,
  "useResidentialFallback": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per input URL: inputUrl, status, type, facebookId, profileId, pageId, groupId, postId, videoId, photoId, eventId, albumId, ownerId, ownerName, name, username, category, canonicalUrl, resolvedBy, error.

# 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/groups/germtheory.vs.terraintheory",
        "https://www.facebook.com/NintendoAmerica/posts/pfbid09PPhHDZ1wEi19DBTuZJ8L7ZMxiGGpSyfRXPiPx3gKK17KBh2k53HERZzjK7VYZP7l",
        "https://www.facebook.com/reel/2166091230582141/",
        "zuck"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("seemuapps/facebook-url-to-id").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/groups/germtheory.vs.terraintheory",
        "https://www.facebook.com/NintendoAmerica/posts/pfbid09PPhHDZ1wEi19DBTuZJ8L7ZMxiGGpSyfRXPiPx3gKK17KBh2k53HERZzjK7VYZP7l",
        "https://www.facebook.com/reel/2166091230582141/",
        "zuck",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("seemuapps/facebook-url-to-id").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/groups/germtheory.vs.terraintheory",
    "https://www.facebook.com/NintendoAmerica/posts/pfbid09PPhHDZ1wEi19DBTuZJ8L7ZMxiGGpSyfRXPiPx3gKK17KBh2k53HERZzjK7VYZP7l",
    "https://www.facebook.com/reel/2166091230582141/",
    "zuck"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call seemuapps/facebook-url-to-id --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,seemuapps/facebook-url-to-id"
        }
    }
}
```

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/cZ0tb1AsQoailD39G/builds/xCJwtjQde5mGKmtKO/openapi.json
