# Facebook URL to ID & Entity Resolver (`xyrelith-data/fb-url-id-resolver`) Actor

Resolve public Facebook URLs to numeric IDs and entity details without login: Pages, profiles, groups, posts, videos, reels, photos and Ad Library ads. Returns canonical links, owner IDs, names, usernames, member counts and audit statuses.

- **URL**: https://apify.com/xyrelith-data/fb-url-id-resolver.md
- **Developed by:** [Xyrelith Data](https://apify.com/xyrelith-data) (community)
- **Categories:** Social media, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 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 & Entity Resolver

Turn public Facebook links into stable numeric IDs, canonical URLs and readable entity details — without logging in, without cookies and without an API key.

Facebook hides the same object behind many link shapes: `profile.php?id=…`, vanity names, `pfbid…` post codes, `/share/` codes, `fb.watch` short links, `watch/?v=…`, Reels, mobile subdomains and Ad Library links. This actor reads each link the way a signed-out visitor does, follows the redirects, and returns one flat, consistent row per unique object. Every row says whether it resolved, was not found, needed a login, or was not a Facebook URL, so a bulk list can be audited instead of silently containing blank IDs.

### What you get

- **Numeric entity ID** for Pages, profiles, groups, posts, group posts, videos, Reels, photos and Ad Library ads.
- **Classic Page ID** (`pageId`) beside the current profile ID — the ID that ad tools and Business Manager ask for.
- **Canonical URL**, username / vanity slug, display name and verification flag.
- **Owner details** for posts, videos, Reels and photos: owner ID, owner type, owner name, owner username, owner classic Page ID and verification.
- **Parent group ID** for group posts.
- **Group facts**: privacy, member count (exact when Facebook publishes it), posts today and last month, creation date, description, admin count, rules count, locations and tags.
- **Engagement facts**: post text and reactions; video views, reactions, comments, shares and duration; photo album ID.
- **Ad Library facts**: advertiser Page ID and name, ad status, title, text, CTA, landing link and run dates.
- **Audit status** on every row: `resolved`, `not_found`, `login_required`, `invalid_url` or `error`.

### Supported links

| Link family | Examples | What is returned |
|---|---|---|
| Page or profile | `facebook.com/nintendo`, `profile.php?id=4`, `/people/Name/ID/`, `@zuck` | Entity ID, classic Page ID, canonical URL, name, username, category, followers, talking-about count, verification |
| Group | `facebook.com/groups/OPonemillion`, `/groups/153355514685129` | Group ID, name, vanity, privacy, exact and rounded member counts, activity, creation date, description, admins, rules, locations, tags |
| Page post / permalink | `/Page/posts/123`, `/Page/posts/pfbid…`, `permalink.php?story_fbid=…`, `story.php?…` | Post ID, owner ID/type, text, creation time, reactions, comments, shares |
| Group post | `/groups/Group/posts/123`, `/groups/Group/permalink/123/` | Post ID, author ID/type, parent group ID, text and engagement |
| Video | `/Page/videos/123`, `/watch/?v=123`, `fb.watch/<code>/` | Video ID, owner ID/type, title, views, reactions, comments, shares, duration |
| Reel | `facebook.com/reel/123` | Reel/video ID, owner details, title, views, reactions, duration |
| Photo | `photo?fbid=…`, `photo.php?fbid=…`, `/Page/photos/…/123/` | Photo ID, album ID, owner details |
| Ad Library | `ads/library/?id=…`, `ads/library/?view_all_page_id=…` | Ad archive ID, advertiser Page ID/name, ad status, copy, CTA, landing link, dates |
| Short and share links | `fb.watch/<code>/`, `/share/v/…`, `/share/r/…`, `/share/p/…` | Followed to the underlying video, Reel or post, then the same fields |
| Numeric IDs | `ids: ["4", "100064368354094"]` | Canonical URL and entity type, with the same metadata |

Mobile (`m.`), `mbasic.`, `web.`, locale subdomains, `fb.com`, `http://`, trailing slashes and tracking parameters are accepted and normalised.

### Inputs

| Input | Default | Description |
|---|---|---|
| `urls` | — | One link, vanity name or `@handle` per line. Mixed lists are fine. |
| `ids` | — | Optional bare IDs to turn back into canonical links and typed records. |
| `includeMetadata` | `true` | Adds group About facts, Page category and audience counts, post and video engagement, and Ad Library creative details. Turn it off for the fastest ID-only pass. |
| `maxItems` | `100` | Hard cap. Duplicate inputs are removed before fetching, and different links that resolve to the same entity produce one row. |

### Output fields

Every record always contains `sourceUrl`, `inputUrl`, `recordType`, `entityType`, `status` and `scrapedAt`. Fields that Facebook does not publish for a particular object are omitted rather than filled with placeholders.

| Group | Fields |
|---|---|
| Identity | `numericId`, `canonicalUrl`, `name`, `username`, `pageId`, `isVerified`, `category` |
| Audience | `followersCount`, `talkingAboutCount` |
| Group facts | `groupPrivacy`, `memberCount`, `memberCountText`, `groupPostsToday`, `groupPostsLastMonth`, `groupCreatedAt`, `groupDescription`, `groupAdminCount`, `groupRulesCount`, `groupLocations`, `groupTags` |
| Content owner | `ownerId`, `ownerType`, `ownerName`, `ownerUsername`, `ownerPageId`, `ownerVerified`, `ownerCategory`, `ownerFollowersCount`, `ownerTalkingAboutCount`, `parentGroupId` |
| Content facts | `createdAt`, `text`, `albumId`, `viewCount`, `viewCountText`, `playCount`, `reactionCount`, `reactionCountText`, `commentCount`, `shareCount`, `durationSeconds` |
| Ad Library | `adArchiveId`, `adStatus`, `adTitle`, `adText`, `adCta`, `adLinkUrl`, `adStartDate`, `adEndDate` |

### Example

Input:

```json
{
  "urls": [
    "https://www.facebook.com/nintendo",
    "https://www.facebook.com/reel/1505075088176160",
    "https://www.facebook.com/ads/library/?id=1568983211690149"
  ],
  "includeMetadata": true,
  "maxItems": 10
}
```

Rows (trimmed):

```json
[
  {
    "entityType": "page",
    "numericId": "100064368354094",
    "pageId": "119240841493711",
    "name": "Nintendo of America",
    "username": "NintendoAmerica",
    "category": "Video Game",
    "followersCount": 5643055,
    "isVerified": true,
    "canonicalUrl": "https://www.facebook.com/NintendoAmerica/",
    "status": "resolved"
  },
  {
    "entityType": "reel",
    "numericId": "1505075088176160",
    "ownerId": "100059581807334",
    "ownerType": "page",
    "ownerName": "sneakernews.com",
    "viewCount": 87000,
    "viewCountText": "87K",
    "reactionCount": 37,
    "durationSeconds": 5,
    "status": "resolved"
  },
  {
    "entityType": "ad",
    "numericId": "1568983211690149",
    "adArchiveId": "1568983211690149",
    "pageId": "131840030178250",
    "ownerName": "Booking.com",
    "adStatus": "Active",
    "adCta": "Book now",
    "status": "resolved"
  }
]
```

### How it works

The actor requests the public, logged-out version of each link, follows redirects, and reads the structured data that Facebook itself embeds in those pages: canonical URLs, entity IDs, profile headers, story objects, video objects and group About data. Public Graph oEmbed pages are used as a metadata fallback, and Ad Library pages are handled with their public challenge flow. No account, cookie or access token is involved. The actor selects its connection automatically; no proxy setup is required from you.

### Status values

| Status | Meaning |
|---|---|
| `resolved` | The entity ID and type were read from public data. Optional metadata may still be absent when Facebook does not publish it. |
| `login_required` | Facebook served a login wall or a private-content notice. The numeric ID may still be present when it was readable from the link itself. |
| `not_found` | The link is valid but Facebook does not expose the object to signed-out visitors, or it was deleted. |
| `invalid_url` | The value is not a Facebook URL, handle or numeric ID. |
| `error` | A transient network or parsing error survived the retries. Re-run the same link. |

### Limitations

- **Event pages** are login-walled on Facebook. Event links return their numeric ID and a `login_required` status, but not event details.
- **Private profiles, friends-only posts and private group content** return `login_required` or `not_found`. Only public data is read.
- **Share links** only work while Facebook still resolves the code. Expired or made-up codes return `login_required`.
- **Exact group member counts** come from Facebook's public About data. When that data is not available, the rounded member text from the group page is returned instead.
- **Optional fields** such as a group description, rules, locations or a Page category are omitted when Facebook does not publish them for that object.
- **Facebook changes its page markup** from time to time. The actor retries and uses several extraction paths, but a very small number of links may need a re-run after a Facebook change.
- This actor resolves and enriches **links and IDs**. It does not bulk-scrape posts, comments or member lists.

### FAQ

**Do I need to log in or provide cookies?**
No. The actor reads only what a signed-out visitor can see. There is no cookie, login or API-key input.

**How do I get the Page ID used in Ads Manager or the Ad Library?**
Use the `pageId` field. It is the classic Page ID. `numericId` is the profile ID Facebook routes on today.

**Can I paste bare IDs instead of links?**
Yes. Put them in **Numeric IDs to reverse**, or paste them into the URL list. Page, profile, group, post, video, Reel and photo IDs are recognised.

**Why did an event return `login_required`?**
Facebook does not show event pages to signed-out visitors. The event ID is still returned so your list stays auditable.

**Why is a group member count rounded?**
Facebook publishes an exact total only on some public group About pages. When it does, `memberCount` is exact and `memberCountText` is the full count. Otherwise only the rounded text is available.

**Does it follow `fb.watch` and `/share/` links?**
Yes. Redirects are followed and the resulting video, Reel or post is parsed. A short link that Facebook refuses to resolve is reported as `login_required`.

**Can I use it for several thousand links?**
Yes, up to the maximum-records limit. Duplicate links are removed before fetching, and links that resolve to the same entity are collapsed into one row.

**Why did I get zero records?**
Check the run status message. An empty URL and ID list returns zero rows with a message; a list of login-walled or deleted links returns rows with `login_required` or `not_found` rather than silently dropping them.

# Actor input Schema

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

One public Facebook link per line. Pages, profiles, groups, group posts, Page posts and permalinks, videos, watch links, Reels, photos, events, Ad Library links, fb.watch and /share/ links, vanity names and @handles are accepted. Mobile, mbasic, web, locale subdomains, fb.com and tracking parameters are normalised automatically.

## `ids` (type: `array`):

Optional numeric Facebook IDs (Page, profile, group, post, video, Reel or photo). Each ID is resolved to its canonical URL and entity type, so a list of IDs can be audited or turned back into links.

## `includeMetadata` (type: `boolean`):

Add Page category, followers and talking-about counts; group privacy, exact member count, activity, creation date, description, rules count, locations and tags; post text and engagement; video views, reactions and duration; and Ad Library creative details. Turn this off for the fastest ID-only runs.

## `maxItems` (type: `integer`):

Hard cap on returned records. One record is emitted for every unique input, and duplicate inputs resolving to the same entity are collapsed.

## Actor input object example

```json
{
  "urls": [
    "https://www.facebook.com/nintendo"
  ],
  "ids": [],
  "includeMetadata": false,
  "maxItems": 1
}
```

# Actor output Schema

## `entities` (type: `string`):

Dataset containing every resolved Facebook URL or numeric ID.

# 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/nintendo"
    ],
    "ids": [],
    "includeMetadata": false,
    "maxItems": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("xyrelith-data/fb-url-id-resolver").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/nintendo"],
    "ids": [],
    "includeMetadata": False,
    "maxItems": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("xyrelith-data/fb-url-id-resolver").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/nintendo"
  ],
  "ids": [],
  "includeMetadata": false,
  "maxItems": 1
}' |
apify call xyrelith-data/fb-url-id-resolver --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xyrelith-data/fb-url-id-resolver"
        }
    }
}
```

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/DOOE3pFl8cveau93b/builds/Y6CYjHnD8iJscqi63/openapi.json
