Meta AdsHow-to

How to find a Facebook Page ID

Facebook lists a Page's numeric ID in its transparency section. A free finder reads it from a link, and our API resolved 10 Page links in 22 seconds.

4 min read

Short answer

  • Facebook lists a Page's ID under Transparency and privacy policy, and a profile.php?id= link carries it in the address.
  • Paste a Page link into our free Facebook Page ID Finder to get the ID, the creation date and whether the Page runs ads.
  • For a list, our API turns each link into its ID for 1 credit, and a short Python script writes them to a CSV.
On this page

Every Facebook Page has a numeric ID, and Facebook shows it in the Page's transparency section. Our free Facebook Page ID Finder reads it from a link in one paste. For a list of Pages, our API resolves each link in one call, and the script below writes a CSV.

Find it on Facebook

Open the Page, click its name under the cover photo, then click Transparency and privacy policy. The Page ID is listed there with the date the Page was created. Facebook's help page gives these steps for a Page you manage, but the transparency section is public, so the same clicks work on any Page.

Some links already contain the ID: in facebook.com/profile.php?id=100064..., the number is the ID. A link with a username, such as facebook.com/nike, doesn't contain it.

Find it with one paste

Paste the Page's link or username into the Page ID Finder. You get the ID with a copy button, the date the Page was created, whether it runs ads right now, the owner Facebook lists, and a link to its ads in the Ad Library. A bare username such as nike works too, as does a mobile m.facebook.com link. It works without a Facebook login and gives you a few lookups a day.

What one call returns

We make ToolzerHub. Our Meta Ad Library API returns public Facebook and Ad Library data as JSON with one API key. /v1/meta/page-id takes a Page link or username:

bash
curl "https://api.toolzerhub.com/v1/meta/page-id?url=https://www.facebook.com/nike" \
  -H "x-api-key: $TOOLZERHUB_API_KEY"
json
{
  "page_id": "15087023444",
  "input": "https://www.facebook.com/nike",
  "source": "resolved_from_url"
}

A profile.php?id= link or a bare number comes back as-is, with source set to provided_id. For the creation date, ad status and owner, /v1/facebook/page/transparency?slug=nike returns the whole Page transparency section. Each line there is a field with a field_type, such as page_id, creation_date, ad_status or confirmed_owner, and the text Facebook displays, so Nike's comes back as May 21, 2008 and NIKE, Inc.

Look up a list of Pages

The script reads links from a file (one per line) or a comma-separated list, makes one call per link and writes link,page_id rows. A link can be a full address, an m.facebook.com link, a link with a tracking tail such as ?ref=share, or the bare username. It needs Python 3 and requests.

python
import csv
import os
import sys
import time

import requests

API = "https://api.toolzerhub.com/v1/meta/page-id"
KEY = os.environ.get("TOOLZERHUB_API_KEY")


def page_id(link, tries=4):
    # 429 and 503 are worth a retry; the body says how long to wait.
    for attempt in range(tries):
        r = requests.get(API, params={"url": link}, headers={"x-api-key": KEY}, timeout=90)
        if r.status_code in (429, 503) and attempt < tries - 1:
            wait = int(((r.json().get("error") or {}).get("details") or {}).get("retryAfter") or r.headers.get("Retry-After") or 5 * (attempt + 1))
            time.sleep(min(wait, 60))
            continue
        if r.status_code >= 400:
            return None
        data = r.json()["data"]
        return data["page_id"] if data else None


def main(src, out="page_ids.csv"):
    links = open(src).read().split() if os.path.exists(src) else src.split(",")
    links = [l.strip() for l in links if l.strip()]
    found = 0
    with open(out, "w", newline="") as f:
        writer = csv.writer(f)
        writer.writerow(["link", "page_id"])
        for link in links:
            pid = page_id(link)
            found += pid is not None
            writer.writerow([link, pid or ""])
    print(f"{found} of {len(links)} links resolved, saved to {out}")


if __name__ == "__main__":
    if not KEY or len(sys.argv) < 2:
        sys.exit("usage: TOOLZERHUB_API_KEY=... python facebook_page_ids.py LINKS_FILE_OR_LIST [out.csv]")
    main(*sys.argv[1:])
bash
export TOOLZERHUB_API_KEY=your_key
python facebook_page_ids.py pages.txt

What came out

Given 10 brand Pages, the script printed 10 of 10 links resolved after 22 seconds. The transparency route returned the same 10 IDs.

Page Page ID Created
Spotify 6243987495 Nov 11, 2007
Red Bull 14226545351 Nov 15, 2007
Starbucks 22092443056 Mar 11, 2008
Nike 15087023444 May 21, 2008
National Geographic 23497828950 Aug 7, 2008
Coca-Cola 40796308305 Dec 15, 2008
Duolingo 141935472517297 Sep 28, 2010
adidas 182162001806727 Jan 13, 2011
Humans of New York 102099916530784 Jan 13, 2011
Netflix 475822799216240 Jun 20, 2014

In these 10 Pages, the ones created in 2007 and 2008 have 10- or 11-digit IDs, and those from 2010 on have 15 digits. The transparency route also showed 7 of them running ads, and Humans of New York as the one with no owner listed. The Ad Library's view of a Page's ads takes this number, not the username.

What it costs

Each link costs 1 credit, so the 10-Page run cost 10 credits and 1,000 Pages cost 1,000. The transparency route is also 1 credit a Page. You get 100 free credits a month; $19 buys 10,000 credits that never expire, and plans for higher volume cover larger lists. Set your key and your list is a CSV of IDs in under a minute.

With an ID in hand, the Meta Ad Library API guide lists a Page's ads, and downloading Ad Library videos saves their video files.

We are not affiliated with Meta or Facebook.

Get this data from your own code

The Meta Ad Library API returns it as JSON with one x-api-key header. 100 free credits monthly.