Get started
Authentication and keys
Every request sends an API key as a bearer token. Sandbox keys (pads_test_) return sample ads for free; live keys (pads_live_) read the platforms and use credits.
Send the key
Every request
GET /v1/meta/ads?q=running+shoes HTTP/1.1 Host: api.publicadsapi.com Authorization: Bearer $PADS_API_KEY
No header, or one that is not Bearer <key>, is 401 UNAUTHENTICATED. A key that is not ours or has been revoked is 401 INVALID_KEY. Neither uses credits.
Sandbox and live keys
| Sandbox key | Live key | |
|---|---|---|
| Starts with | pads_test_ | pads_live_ |
| Answers with | Sample ads from made-up advertisers | The platform's library, read as the call runs |
| Credits | Never | 1 a page with ads or an ad found (LinkedIn 2) |
| Speed | At once | Usually 2 to 15 seconds, at most 60 |
| Rate limit | None | 5 to 50 requests a second, by plan: Rate limits |
| Shown | Any time on the dashboard | Once, when you create it |
Both kinds take the same requests and answer in the same shapes, so code built against the sandbox works live by changing the key.
What the sandbox returns
- Each platform has a few sample ads with every field filled the way that platform fills it: Meta's EU reach, Google's text read from an image, TikTok's reach range, LinkedIn's payer.
- Pages hold 3 ads, so you can test paging with
next_cursor. Meta'sactiveandformat, and Google'sformat, filter the samples; other filters are checked and echoed inquerybut return the same ads. - Every id a sandbox search returns works with
GET /v1/ads/{id}. Any other id is404 AD_NOT_FOUND. - These searches answer as a platform sometimes does:
q=empty,q=blocked,q=timeout,q=changed(also ascompanyor adomain's first part). For one ad, the idsmeta_blocked,google_blocked,tiktok_blocked,linkedin_blockedand the same with_timeoutand_changed. See Test your error handling.
Create, store and revoke keys
- Create and revoke keys on Keys. A revoked key stops working at once.
- Keep a key in an environment variable such as
PADS_API_KEYand call the API from your server. A key in a web page or an app can be read by anyone who has it. - A live key is shown once. Lost one? Create another and revoke the old one.
- Use one key per app or environment, so you can see each one's calls on the dashboard and revoke one without the others.
An AI agent with no key can get a sandbox key, then a live key with free credits, without a person signing up: see Agents.