The short answer
A Meta Ad Library API access token takes four steps: confirm your identity, create a developer app, generate a user token in the Graph API Explorer (about 1 to 2 hours of life) and exchange it server-side for a long-lived token (about 60 days). Most failures are error 190 (expired token), error 10 (identity or permission missing) or 613 (rate limit). Even with a working token, US-only commercial ads never come back; the Ad Radar Data API returns them with a key you get at checkout.
In this article11 sections
What a Meta Ad Library API access token is
A Meta Ad Library API access token is the string you pass as access_token on every call to https://graph.facebook.com/<version>/ads_archive. Without a valid one, every request fails with an OAuth error. It is a normal Graph API user token, with one extra requirement that trips up most people: the Facebook account behind it must have completed Meta's identity confirmation.
This guide walks through getting the token, making it last 60 days instead of one hour, checking it, and fixing the three errors you will almost certainly see: 190, 10 and 613. If you want to know what the API returns once the token works, read the Meta Ad Library API: what you can and can't get. If you want working Python for pagination and storage, it is in the Facebook Ad Library API Python tutorial.
1 to 2 hours
life of a Graph API Explorer user token
~60 days
life of a long-lived user token
3
error codes behind most failed calls (190, 10, 613)
$0
what Meta charges for the Ad Library API
Everything below was checked against Meta's developer documentation in November 2026. Meta changes its developer flows often, so verify the screens against the ads_archive reference and the access token guide before you start.
Step 1: confirm your identity and location
This is the step that takes the longest and the one people skip. Go to facebook.com/ID with the personal Facebook account you will use for development and complete the identity and location confirmation. It is the same check Meta requires from anyone running ads about social issues, elections or politics, and it asks for a government ID.
Three things to know before you start:
- It is per person, not per app. The confirmation sits on your Facebook account. A token generated by a colleague's account will not inherit it.
- It can take a few days. Until it is approved, your token is valid but
ads_archiverefuses it with error 10 (see below). - Use an account you control long term. If the developer who confirmed their identity leaves, your tokens stop being renewable.
Step 2: create a Meta for Developers account and an app
- Sign in at developers.facebook.com with the same confirmed account and register as a developer. Accept the Platform Policy.
- Create an app. The Ad Library does not need a specific product or use case added to it; a plain app is enough to generate tokens.
- In the app's settings, note the App ID and the App Secret. You need both for the token exchange in Step 4. The secret is a password: keep it in an environment variable on your server, never in front-end code or a public repo.
Step 3: generate a user token in the Graph API Explorer
Open the Graph API Explorer, pick your app in the "Meta App" dropdown, choose "User Token" and click "Generate Access Token". Log in and approve the dialog.
You now have a short-lived user access token. Meta's access token guide says short-lived tokens "typically last about one to two hours". That is enough to test a call right in the Explorer:
GET /v27.0/ads_archive
?search_terms=running shoes
&ad_reached_countries=["DE"]
&ad_active_status=ACTIVE
&fields=id,page_name,ad_delivery_start_time,ad_snapshot_url
v27.0 was the version selected on the ads_archive reference when we checked. If this returns a data array, your identity, app and token all work. If it returns an error object, skip to the error section.
Step 4: exchange it for a long-lived token
A one-hour token is useless for a nightly job. Meta's long-lived token guide gives the exchange. Run it from your server or your laptop, never from a browser, because it includes your app secret:
curl -s "https://graph.facebook.com/v27.0/oauth/access_token?grant_type=fb_exchange_token&client_id=$META_APP_ID&client_secret=$META_APP_SECRET&fb_exchange_token=$META_SHORT_TOKEN"
The response looks like this:
{
"access_token": "EAAB...",
"token_type": "bearer",
"expires_in": 5183944
}
expires_in is in seconds; 5,183,944 is about 60 days, and Meta's guide says a long-lived token "generally lasts about 60 days". Three rules from the same guide:
- The long-lived token is a new string. Replace the stored token; don't keep using the short one.
- You cannot exchange an expired token. If the short-lived token has already died, go back to the Explorer and generate a fresh one first.
- Lifetimes can change without warning or end early. Treat 60 days as a ceiling, not a promise.
Store the result as an environment variable, for example META_AD_LIBRARY_TOKEN, and set a calendar reminder for day 50.
Step 5: check the token before you blame your code
Meta gives you two ways to inspect a token: the Access Token Tool in the developer site, and the Access Token Debugger linked from it, where you paste a token and see its app, user, scopes and expiry. You can do the same from code with the debug_token endpoint, using an app token made of your app ID and secret:
curl -s "https://graph.facebook.com/debug_token?input_token=$META_AD_LIBRARY_TOKEN&access_token=$META_APP_ID|$META_APP_SECRET"
Look at is_valid, app_id, user_id and expires_at. If user_id is not the account that completed identity confirmation, you have found your problem.
The token types, and which one the Ad Library needs
| Token | How you get it | Lifetime | Use for the Ad Library |
|---|---|---|---|
| Short-lived user token | Graph API Explorer or Facebook Login | About 1 to 2 hours | Testing calls |
| Long-lived user token | fb_exchange_token exchange | About 60 days | Scheduled jobs |
| App access token | App ID and secret, server to server | Until the secret changes | Reading app settings and calling debug_token |
| System user token | Business Manager | Does not expire on time | Built for Marketing API work on business assets |
For ads_archive, use a user token from the confirmed account. Meta's documentation describes app tokens as the way to "read and modify app settings", and the identity confirmation that the Ad Library checks sits on a person.
Common Meta Ad Library API access token errors and fixes
Every failed call returns a JSON error object with message, type, code, often error_subcode, and a fbtrace_id you can quote to Meta support. Meta's error handling guide lists the codes; here is what they mean on the Ad Library in practice.
| Code | Subcode | What it means | Fix |
|---|---|---|---|
| 190 | 463 or 467 | Token expired, revoked or invalid | Generate a new token in the Explorer, exchange it again |
| 190 | 460 | The user changed their Facebook password | New login, new token |
| 190 | 458 | The user is not logged into your app | Re-authenticate in the Explorer with your app selected |
| 10 | 2332002 | "Application does not have permission for this action" | Finish identity confirmation; use a token from the confirmed account |
| 613 | "Calls to this api have exceeded the rate limit" | Back off and retry later; slow down your pagination | |
| 4 / | App or user rate limit | Same as 613 | |
| 100 | Invalid parameter | Usually ad_reached_countries not sent as a JSON array, or a bad field name |
Error 190: invalid OAuth access token
The most common error, because tokens die on a schedule and also for reasons you don't control. The subcode tells you which. A password change, a logout from all sessions or a security check on the account can all invalidate a token before day 60. In a scheduled job, catch code 190, stop the job and alert yourself. Retrying will not help.
Error 10: permission denied, subcode 2332002
This one confuses people because the token looks fine in the debugger. On ads_archive, the error body's user-facing text points to facebook.com/ads/library/api, under the title "Authorization and login needed". Meta's general reference says code 10 means a permission "was never granted or was removed". On developer forums, people who followed every setup step report the same message, and it is not documented further by Meta. The usual causes:
- Identity confirmation not finished, or still under review.
- The token was generated by a different Facebook account than the confirmed one.
- The app was created by another account and you were never added to it as a developer.
Check the confirmation status first, then compare the token's user_id in debug_token with the confirmed account.
Error 613: rate limit
Meta lists 613 on the ads_archive reference but does not publish the Ad Library's limit as a number. The rate limiting guide also covers codes 4 and 17. When you hit any of them, wait, then retry with exponential backoff. Smaller limit values per page fail less often under load. A full retry loop is in the Python tutorial.
Error 100: invalid parameter
Not a token error, but it shows up right after you fix the token. ad_reached_countries is an array and must be sent JSON-encoded, as ["US"], not as a bare US. Field names are case sensitive.
The token works. The US ads still don't come back.
This is the moment most teams discover the real limit. You fix 190, you get past 10, you pace around 613, you set ad_reached_countries=["US"], you search for a US direct-to-consumer brand, and you get an empty data array.
Your token is fine. Meta's ads_archive reference states the rule: "Ads that did not reach any location in the EU will only return if they are about social issues, elections or politics." A US-only commercial ad is visible in the web library while it is active and invisible to the API. And the ads that do come back carry no spend (the spend field is for political and issue ads only), no video file and no transcript.
So after days of identity checks and token plumbing, you have a free API that answers EU and political questions, and nothing for the question most marketers and product builders are asking: which commercial ads in the US are spending, and what do they say?
| Meta Ad Library API | Ad Radar Data API | |
|---|---|---|
| Before your first call | Identity confirmation (can take days), developer app, token exchange | Checkout, then copy the key from Settings → API |
| Credential | User token, about 60 days, renewed by hand | One API key, sent as Authorization: Bearer |
| US-only commercial ads | Not returned | Returned: 2,761 Meta ads with $50k+ estimated spend, from 734 brands |
| Spend | Ranges, political and issue ads only | spendEstimate in USD on every ad |
| Video transcript | No | Full transcript, searchable with q |
| Winner signal | None | Score and tier (winner, rising), days running, variants |
| Tags | None | Ten dimensions, from hook pattern to landing page type |
| Same credential works in Claude and ChatGPT | No | Yes, through the MCP server |
The faster route: a key that works on day one
The Ad Radar Facebook ads API is the best database of winning Meta ads you can query from code. It is built from the public Meta Ad Library, keeps only proven winners with $50k or more in estimated spend, scores each one, tags it on ten dimensions, transcribes every video and refreshes the whole set every day. Facebook and Instagram, served as JSON over REST and through an MCP server.
There is no identity confirmation, no Graph API Explorer and no token exchange. Check out on the Builder plan ($299 every 4 weeks, 10,000 requests), open Settings → API in the app, and your first call looks like this:
curl "https://app.ad-radar.dev/api/v1/ads/search?q=skillet&tier=winner&format=video&limit=2" \
-H "Authorization: Bearer $AD_RADAR_KEY"
Every result is a full ad: adKey, brand, headline, body, CTA, the full video transcript, spendEstimate, metrics.score, tier, days running, variants, the ten tags, public poster and video URLs, start date and active status. Pagination is a cursor (pagination.nextCursor), up to 100 ads per page, and one page is one request. Every response carries X-Quota-Remaining and X-RateLimit-Remaining, so you never have to guess a limit the way you do with error 613. If you run out of quota you get a 429 with an upgrade link, never an overage charge. GET /me shows your plan and remaining quota and is never counted.
The endpoints you will use first:
GET /ads/searchwithq(searches headline, body, brand and transcript),brand,format,tier,tags, dates andmin_spend.GET /winners?since=2026-11-01for ads that entered the winner tier since a date.GET /brandsandGET /brands/{id}/hooksfor one advertiser's opening lines.GET /patternsandGET /taxonomyfor what is winning across the corpus and the tag vocabulary.
The full reference, with the OpenAPI 3.1 file, is at /docs/api. The same key runs the MCP server, so Claude or ChatGPT can query the corpus for you, one tool call per request.
If you need more volume, Scale ($799, 50,000 requests) adds the incremental /feed endpoint and a higher rate limit, and the Reseller plan (from $2,000) adds a full NDJSON export and resale rights. All plans are on /api#pricing.
If you don't write code and just want to browse the winners, the Ad Radar app gives you the same corpus in a searchable board, with transcripts, tags and estimated spend on every ad.
If you keep the official token too
Plenty of teams run both. Keep the Meta token for EU and political monitoring, where it has fields nobody else has, and use the Data API for US commercial winners. Store both in one table keyed by the Meta library ID: id in ads_archive, libraryId in the Data API. The full architecture of a tool that combines sources, and why building the rest yourself takes months, is in how to build an ad spy tool. For a wider look at the options, see Meta Ad Library alternatives.
Stop renewing tokens for data that never arrives. Start on Builder and make your first call today.
Figures marked as estimated spend come from Ad Radar's model of engagement on public Meta Ad Library ads. They are estimates, labeled as such, and are best used to rank ads against each other. How the board is built.