API reference / Ads
Get one ad
Written and maintained by The ProspectAPIs team
GET/v1/ads/:id
GET /v1/ads/:id is the ProspectAPIs operation getAd, in the Ads group of the REST API. One ad in full by its id from GET /v1/ads, with the facts its library shows only on the single ad (for example the countries it ran in). Costs $0.006 when found; an unknown id is a free 404; a library that cannot be read is a free 503. Cost: Launching soon. Send your API key as a Bearer token in the Authorization header.
How this fits with the rest of the ads API, with worked examples, is in the ads library guide.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| id required | path | string | An ad id from GET /v1/ads: the platform and the platform's own ad id, for example meta.1234567890. |
Responses
| Status | Meaning |
|---|---|
| 200 | The ad. |
| 400 | The request was invalid (e.g. a bad filter or input); nothing was charged. |
| 401 | The API key is missing or invalid. |
| 402 | Out of credits. The body carries top_up_url; nothing was charged. |
| 404 | No such record for this account. |
| 429 | Too many requests; retry after the window. |
| 503 | Every library asked for is unreadable right now. No list is returned and nothing is charged. Retry after Retry-After seconds. |
Every error answers with the same JSON body, an error string and sometimes a code; the errors page lists each status and when it happens. A per-key 429 carries Retry-After; see rate limits.
200 response fields
The ad.
| Field | Type | Description |
|---|---|---|
| data required | Ad | One ad as its library shows it. A field the library does not show is null, never filled in. |
| data.id required | string | Our id: the platform, a dot, and the library's own id. |
| data.platform required | string: meta, google, linkedin, tiktok | |
| data.advertiser_name required | string or null | |
| data.advertiser_id required | string or null | The library's id for the advertiser (a page id, an advertiser id, a company id). TikTok shows none. |
| data.advertiser_url required | string (uri) or null | |
| data.creative_text required | string or null | The ad's text. Google and TikTok list views show none. |
| data.media_urls required | array of string (uri) | Image and video URLs as the library serves them; some expire. |
| data.first_seen required | string (date-time) or null | When the library says the ad started. |
| data.last_seen required | string (date-time) or null | When the library says the ad was last shown. |
| data.countries required | array of string or null | ISO 3166-1 alpha-2 codes, where the library names them (often only on GET /v1/ads/{id}). |
| data.landing_url required | string (uri) or null | |
| data.status required | string or null: active, inactive, | Meta states it; for Google it is active when last shown within 2 days of the read; LinkedIn and TikTok state none. |
| data.format required | string or null | |
| data.source_url required | string (uri) | The ad on its public library page. |
| data.read_at required | string (date-time) or null | When we read it from the library. |
| Header | Meaning |
|---|---|
| X-Credits-Remaining | USD credits left after this call settles. |
| RateLimit-Limit | Requests this API key may make per minute. |
| RateLimit-Remaining | Requests left in the current one-minute window. |
| RateLimit-Reset | Seconds until the current window resets. |
Code samples
Each sample sends the same request. Set PROSPECTAPIS_KEY in your environment first. Values come from the spec's examples; replace them with your own.
curl https://api.prospectapis.com/v1/ads/meta.1234567890 \
-H "Authorization: Bearer $PROSPECTAPIS_KEY"const res = await fetch("https://api.prospectapis.com/v1/ads/meta.1234567890", {
headers: { Authorization: `Bearer ${process.env.PROSPECTAPIS_KEY}` },
});
if (!res.ok) throw new Error(`${res.status}: ${(await res.json().catch(() => ({}))).error ?? res.statusText}`);
const data = await res.json();
console.log(data);import os, requests
res = requests.get(
"https://api.prospectapis.com/v1/ads/meta.1234567890",
headers={"Authorization": f"Bearer {os.environ['PROSPECTAPIS_KEY']}"},
timeout=30,
)
res.raise_for_status()
data = res.json()
print(data)Billing
Billing reserves before it serves: the call holds what it may cost, serves at most what that hold covers, and refunds the rest when the response closes. Any non-2xx answer refunds the whole hold, so a failed call costs nothing. The response reports your balance in X-Credits-Remaining.
Related
The ads library guide covers this area end to end. Previous operation: Search a company's ads. Next operation: List queued writes. Every operation, grouped by area, is on the API reference index.
Create a free account to get a key, then run the samples above with your own values.
Was this page helpful?