Skip to content
ProspectAPIs

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

Parameters of GET /v1/ads/:id
NameInTypeDescription
id requiredpathstringAn ad id from GET /v1/ads: the platform and the platform's own ad id, for example meta.1234567890.

Responses

Response codes of GET /v1/ads/:id
StatusMeaning
200The ad.
400The request was invalid (e.g. a bad filter or input); nothing was charged.
401The API key is missing or invalid.
402Out of credits. The body carries top_up_url; nothing was charged.
404No such record for this account.
429Too many requests; retry after the window.
503Every 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.

Fields of the 200 response
FieldTypeDescription
data requiredAdOne ad as its library shows it. A field the library does not show is null, never filled in.
data.id requiredstringOur id: the platform, a dot, and the library's own id.
data.platform requiredstring: meta, google, linkedin, tiktok
data.advertiser_name requiredstring or null
data.advertiser_id requiredstring or nullThe library's id for the advertiser (a page id, an advertiser id, a company id). TikTok shows none.
data.advertiser_url requiredstring (uri) or null
data.creative_text requiredstring or nullThe ad's text. Google and TikTok list views show none.
data.media_urls requiredarray of string (uri)Image and video URLs as the library serves them; some expire.
data.first_seen requiredstring (date-time) or nullWhen the library says the ad started.
data.last_seen requiredstring (date-time) or nullWhen the library says the ad was last shown.
data.countries requiredarray of string or nullISO 3166-1 alpha-2 codes, where the library names them (often only on GET /v1/ads/{id}).
data.landing_url requiredstring (uri) or null
data.status requiredstring 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 requiredstring or null
data.source_url requiredstring (uri)The ad on its public library page.
data.read_at requiredstring (date-time) or nullWhen we read it from the library.
Response headers
HeaderMeaning
X-Credits-RemainingUSD credits left after this call settles.
RateLimit-LimitRequests this API key may make per minute.
RateLimit-RemainingRequests left in the current one-minute window.
RateLimit-ResetSeconds 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
curl https://api.prospectapis.com/v1/ads/meta.1234567890 \
  -H "Authorization: Bearer $PROSPECTAPIS_KEY"
JavaScript (fetch)
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);
Python (requests)
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.

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?