# Facebook Public Profile Scraper by ID or Username (`karamelo/facebook-public-profile-scraper-by-id-or-username`) Actor

Collect publicly visible profile details from supplied Facebook profile IDs, usernames, or URLs.

- **URL**: https://apify.com/karamelo/facebook-public-profile-scraper-by-id-or-username.md
- **Developed by:** [karamelo](https://apify.com/karamelo) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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.
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

Scrape public Facebook profiles by username, numeric ID, or profile URL. This Actor turns the public details of known profiles into a flat, exportable dataset: identity, category, public audience labels and counts, work and education entries, profile and cover image URLs, and other visible profile information when available. Start with one public profile to check the result, then submit a list for research or monitoring.

### How to scrape a Facebook public profile

1. Open the Actor in Apify Console and enter a known public profile under **Profiles**. A username such as `cnn`, a numeric ID, or a full Facebook profile URL works.
2. Run the Actor and open its **Results** dataset. Each successful target produces a `profile` row. An invalid or unavailable target can produce an outcome row explaining what happened.

Example input:

```json
{
  "startUrls": ["https://www.facebook.com/cnn"]
}
```

Use the dataset in Apify Console or export it for your own analysis. Apify also supports scheduled runs and dataset access through its API.

### What Facebook profile data can you get?

The result is one flat row per processed target, not a copy of the page. This abbreviated example uses identity and count values from a verified public CNN profile result; image URLs are shortened illustrations because public media links can change.

```json
{
  "recordType": "profile",
  "status": "ok",
  "sourceUrl": "https://www.facebook.com/cnn",
  "url": "https://www.facebook.com/cnn",
  "username": "cnn",
  "profileId": "100059479812265",
  "name": "CNN",
  "alternateName": null,
  "accountType": "page",
  "category": "Media/news company",
  "followers": 43828261,
  "followersText": "43M followers",
  "following": 76,
  "followingText": "76 following",
  "friends": null,
  "talkingAbout": null,
  "likes": null,
  "verified": true,
  "profilePictureUrl": "https://example.com/profile-image.jpg",
  "coverPhotoUrl": "https://example.com/cover-image.jpg",
  "linkedPageId": null,
  "isMemorialized": null,
  "workHistory": [],
  "educationHistory": [],
  "websites": [],
  "emails": [],
  "phones": [],
  "introItems": [],
  "inputUrl": "https://www.facebook.com/cnn",
  "errorCode": null,
  "errorMessage": null
}
```

The example omits other fields. Actual `profilePictureUrl` and `coverPhotoUrl` values are public image URLs returned for that profile, not the illustrative `example.com` links above. Media URLs may change or expire; save the images separately if you need a durable copy.

| Fields | Meaning |
| --- | --- |
| `recordType`, `status`, `errorCode`, `errorMessage` | Distinguish a successful `profile` from an `invalid` or `unavailable` outcome, with a reason when present. |
| `sourceUrl`, `inputUrl`, `url`, `username`, `profileId`, `name`, `alternateName` | Supplied target in normalized form and the public profile identity returned. |
| `bio`, `accountType`, `category`, `verified`, `isMemorialized`, `linkedPageId` | Public introduction, record type, category, verification or memorial indicators, and linked Page ID when available. |
| `followers`, `followersText`, `following`, `followingText`, `friends`, `talkingAbout`, `likes` | Visible counts and their public labels when available. |
| `profilePictureUrl`, `coverPhotoUrl` | Public profile-picture and cover-image URLs when available. |
| `work`, `workHistory`, `education`, `educationHistory`, `currentCity`, `hometown`, `relationship` | Other visible profile details. History entries retain the public text plus available title, organization, URL, year, and current-status values. |
| `externalLinks`, `websites`, `emails`, `phones`, `introItems` | Public contact, website, and profile-introduction entries when available. `introItems` contains `text` and an optional `url`. |
| `attempts`, `scrapedAt` | Number of attempts associated with the result and its ISO 8601 processing timestamp. |

Absent scalar values are `null`; list fields such as `workHistory`, `educationHistory`, `websites`, `emails`, `phones`, and `introItems` may be empty arrays. Counts and profile details reflect what was publicly visible at collection time, so use `scrapedAt` when comparing runs.

### Facebook profile scraper input

| Input | Required | What to enter |
| --- | --- | --- |
| `startUrls` | Yes | One or more public profile URLs, usernames, numeric IDs, or objects with a `url` value. |

Supported URL forms include username profiles, `profile.php?id=<numeric-id>`, and `/people/.../<numeric-id>` links. The Actor processes the supplied list without a profile-count or request-count setting; duplicate normalized targets are processed once. Invalid entries can produce outcome rows. Large runs remain subject to Apify's run time and resource allowances.

### Use cases for public profile data

- **Known-profile research:** Supply a list of public usernames or URLs and export `name`, `bio`, `accountType`, `work`, `education`, and `externalLinks` in one dataset. This is useful when reviewing a defined set of profiles rather than discovering new ones.
- **Changes over time:** Run the same known profiles on an Apify schedule and compare `followers`, `following`, and `scrapedAt` between datasets. Counts describe what was publicly visible at each collection time; a missing count is not zero.
- **Profile asset review:** Keep `profilePictureUrl` and `coverPhotoUrl` beside `profileId` and `url` for a catalog or manual review. The links point to public media and may change, so they are not permanent image copies.
- **Application enrichment:** Match `profileId` or `username` to records already held in your application, then use the exported profile fields where present. Handle `invalid` and `unavailable` outcomes separately from successful rows.

This Actor is for known public profiles, not discovery of unknown profiles, private-profile access, posts, comments, or friends lists.

### Use the Apify API

The [Apify API](https://docs.apify.com/api/v2) can start this Actor with the same `startUrls` input used in Console. A run response includes a run ID and `defaultDatasetId`. Check the run status before reading the dataset so an unsuccessful run is not mistaken for a complete result.

```bash
curl -X POST "https://api.apify.com/v2/actors/karamelo~facebook-public-profile-scraper-by-id-or-username/runs" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":["https://www.facebook.com/cnn"]}'

curl "https://api.apify.com/v2/actor-runs/<RUN_ID>?waitForFinish=60" \
  -H "Authorization: Bearer <APIFY_TOKEN>"

curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?format=json" \
  -H "Authorization: Bearer <APIFY_TOKEN>"
```

Replace the placeholders with your token and the IDs returned by the API; keep the token private. Repeat the run-status request while its status is `READY` or `RUNNING`. Read dataset items after `SUCCEEDED`; if the status is `FAILED`, `ABORTED`, or `TIMED-OUT`, inspect the run in Console before using any partial data. See Apify's [run](https://docs.apify.com/api/v2/actors-runs-post), [status](https://docs.apify.com/api/v2/actor-run-get), and [dataset items](https://docs.apify.com/api/v2/dataset-items-get) references for response details.

### Use this Actor with an AI agent

Apify's [MCP server](https://docs.apify.com/mcp) lets compatible AI clients find and run eligible Actors and read their datasets. Connect `https://mcp.apify.com` in your MCP client, authorize the connection, and select `karamelo/facebook-public-profile-scraper-by-id-or-username` in the [MCP configurator](https://mcp.apify.com/) if it is available there. Give the Actor a `startUrls` list of known public profiles. After the run, the agent needs to read the returned dataset ID to obtain the rows; starting a run alone does not return the profile records.

For agents that use [Apify's account-free payment options](https://docs.apify.com/agents/payments), authorization and payment are handled by Apify, not by an input to this Actor. Apify documents prepaid-token access for limited-permission Actors and separate eligibility rules for per-request payment methods. Check the current Apify guidance and this Actor's availability for the method your agent uses.

### Profile availability

Public does not mean every field is available. Private, removed, restricted, or temporarily unavailable profiles may return an `unavailable` outcome, and a public profile may omit particular fields. If a result is missing, confirm the supplied URL or ID and inspect `status`, `errorCode`, and `errorMessage`. Respect Facebook's terms and applicable privacy requirements when using the data.

# Actor input Schema

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

Known public Facebook profile URLs, numeric IDs, usernames, or objects containing a url value.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.facebook.com/zuck"
  ]
}
```

# Actor output Schema

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

View the profile records and input diagnostics returned by this run.

# 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/zuck"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("karamelo/facebook-public-profile-scraper-by-id-or-username").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/zuck"] }

# Run the Actor and wait for it to finish
run = client.actor("karamelo/facebook-public-profile-scraper-by-id-or-username").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/zuck"
  ]
}' |
apify call karamelo/facebook-public-profile-scraper-by-id-or-username --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,karamelo/facebook-public-profile-scraper-by-id-or-username"
        }
    }
}
```

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/MsfexSjrPDa1RCTcr/builds/3LPcuKrl4yvFjzbbl/openapi.json
