Skip to main content

LinkedIn Ad Search API

Written by Kadri - RichAPI Support Team

POST /linkedin_ad_search • Credits: 0.2 credit per ad returned

LinkedIn Ad Search finds ads in the public LinkedIn Ad Library. Send a POST request with a keyword, an advertiser name, a country list or a date range. The response holds one page of up to 24 ads with the headline, the image, the advertiser and the detail URL. Each call costs 0.2 credit for every ad in the elements array.

What does LinkedIn Ad Search do?

Every LinkedIn ad is public data. LinkedIn publishes each one in the LinkedIn Ad Library, and LinkedIn Ad Search reads that library through RichAPI. The endpoint accepts a keyword, an advertiser name, a country list, a date range or a full ad library search URL. It returns one page of matched ads in a single synchronous response. Sales teams and product teams use the endpoint to see which ads a competitor runs, and what message each ad carries. To read the creative variants, the impression counts and the targeting of one ad, send the ad detail URL to LinkedIn Ad Details.

Which endpoint does LinkedIn Ad Search use?

  • Method: POST

  • URL: https://api.richapi.ai/api/v1/linkedin_ad_search

  • Authentication: x-api-key header

  • Response: Synchronous JSON

  • Credits: 0.2 credit per ad returned

  • Page size: Up to 24 ads per page

  • Pagination: Cursor, through pagination_token

CAUTION: LinkedIn Ad Search accepts POST only. A GET request returns status 405 with the error linkedin_ad_search only supports POST.

How to send a LinkedIn Ad Search request

  1. Copy your API key from the RichAPI dashboard.

  2. Choose the filters for the ad search.

  3. Put every filter in the JSON request body. Never put a filter in the query string.

  4. Send at least one filter. An empty request body returns no useful match.

  5. Send a POST request to https://api.richapi.ai/api/v1/linkedin_ad_search.

  6. Send the API key in the x-api-key header.

  7. Read the ads from the elements array of the response.

  8. Read pagination.paginationToken to request the next page.

CAUTION: Each ad in the elements array costs 0.2 credit. A full page of 24 ads costs 4.8 credits.

cURL

curl -X POST https://api.richapi.ai/api/v1/linkedin_ad_search   
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"keyword": "marketing automation",
"countries": "US",
"date_option": "last-30-days"
}'

Python

import requests

response = requests.post(
"https://api.richapi.ai/api/v1/linkedin_ad_search",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"keyword": "marketing automation",
"countries": "US",
"date_option": "last-30-days",
},
timeout=60,
)
response.raise_for_status()
print(response.json())

Node.js

const response = await fetch("https://api.richapi.ai/api/v1/linkedin_ad_search", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
keyword: "marketing automation",
countries: "US",
date_option: "last-30-days",
}),
});

const data = await response.json();
console.log(data);

What parameters does LinkedIn Ad Search accept?

Every LinkedIn Ad Search parameter goes in the JSON request body. Every parameter is optional, and each one narrows the search.

Parameter

Type

Required

Default

Description

keyword

string

No

""

Free text to search for in the ad text.

account_owner

string

No

""

The advertiser or company name, for example UX Pilot AI.

countries

string

No

""

One country code, or a comma-separated list, for example US,GB,FR. The value ALL searches every country.

date_option

string

No

""

The date range of the ad. See the value table below.

start_date

string

No

""

The start date for the custom-date-range filter, in YYYY-MM-DD format.

end_date

string

No

""

The end date for the custom-date-range filter, in YYYY-MM-DD format.

pagination_token

string

No

""

The token from pagination.paginationToken of the previous response. It returns the next page.

search_url

string

No

""

A full LinkedIn Ad Library search URL. It replaces the individual filters.

CAUTION: LinkedIn Ad Search rejects an unknown body field with status 400 and the error Unknown input field(s). Use the parameter names in the table above, character for character.

Which values does date_option accept?

The date_option parameter accepts five values. Send one value per request.

Value

Meaning

last-30-days

Ads from the last 30 days.

current-month

Ads from the current calendar month.

current-year

Ads from the current calendar year.

last-year

Ads from the previous calendar year.

custom-date-range

Ads between start_date and end_date.

If you send custom-date-range, send start_date and end_date as well.

How do I search with an ad library URL?

The search_url parameter takes a full LinkedIn Ad Library search URL. Build the search in the LinkedIn Ad Library, copy the URL from the browser, then send it as search_url.

{
"search_url": "https://www.linkedin.com/ad-library/search?accountOwner=UX+Pilot+AI&dateOption=custom-date-range&startdate=2026-06-01&enddate=2026-07-31"
}

CAUTION: The search_url parameter replaces the individual filters. Send search_url alone, or send the individual filters alone.

Does LinkedIn Ad Search accept GET?

No. Your request is always a POST request with the body names in the table above.

What does LinkedIn Ad Search return?

The block below is an example response. It shows one ad from a page of 24.

{
"query": {
"keyword": "marketing automation",
"countries": "US",
"date_option": "last-30-days",
"account_owner": "UX Pilot AI"
},
"status": 200,
"elements": [
{
"id": "1440550993",
"content": {
"pageUrl": "https://www.linkedin.com/ad-library/detail/1440550993",
"headline": "Generate wireframes in seconds",
"imageUrl": "https://media.licdn.com/dms/image/v2/D4D10AQHrygtedL9DNQ/image-shrink_1280/0/1743537684174/frame1000002823png",
"description": "Paste your PRD, generate multi-step flows with your actual components, and get screens that look like your product."
},
"advertiser": {
"name": "UX Pilot AI",
"headline": "Promoted",
"imageUrl": "https://media.licdn.com/dms/image/v2/D4E0BAQF14xfiQrSfew/company-logo_100_100/0/1770218938904/uxpilot_ai_logo"
},
"creativeType": "SPONSORED_STATUS_UPDATE"
}
],
"pagination": {
"pageSize": 24,
"pageNumber": null,
"totalPages": 172,
"totalElements": 4128,
"paginationToken": "1460308964-1782143461901",
"previousElements": null
}
}

What does each LinkedIn Ad Search response field mean?

The top level of the LinkedIn Ad Search response holds four fields.

Field

Type

Description

query

object

The echo of the filters that the search used.

status

integer

The HTTP status from the upstream data provider.

elements

array

The matched ads on this page. RichAPI bills 0.2 credit for each item.

pagination

object

The page size, the total match count and the token for the next page.

Each item in the elements array holds four fields.

Field

Type

Description

id

string

The LinkedIn numeric ad ID.

content

object

The creative of the ad.

advertiser

object

The account that paid for the ad.

creativeType

string

The ad format, for example SPONSORED_STATUS_UPDATE or SPOTLIGHT_V2.

The content object holds four fields.

Field

Type

Description

content.pageUrl

string

The LinkedIn Ad Library detail URL of the ad. Send this URL to LinkedIn Ad Details.

content.headline

string

The headline text of the ad.

content.imageUrl

string

The URL of the ad image.

content.description

string

The body text of the ad. LinkedIn truncates long text.

The advertiser object holds three fields.

Field

Type

Description

advertiser.name

string

The name of the advertiser, as shown on the ad.

advertiser.headline

string

The label under the advertiser name, for example Promoted.

advertiser.imageUrl

string

The URL of the advertiser logo or photo.

The pagination object holds six fields.

Field

Type

Description

pagination.pageSize

integer

The number of ads per page. The value is 24.

pagination.pageNumber

integer

The page number. The value is null, because this endpoint pages by token.

pagination.totalPages

integer

The number of pages that match the filters.

pagination.totalElements

integer

The number of ads that match the filters.

pagination.paginationToken

string

The token for the next page. Send it as pagination_token.

pagination.previousElements

integer

The number of ads before this page. The value can be null.

How does pagination work in LinkedIn Ad Search?

LinkedIn Ad Search returns up to 24 ads per page, and one call returns one page. The endpoint pages by token, not by page number.

  1. Send the first request with your filters and no pagination_token.

  2. Read pagination.totalElements to see the size of the full match set.

  3. Read pagination.paginationToken from the response.

  4. Send the same filters again, and add pagination_token with that token value.

  5. Read the new pagination.paginationToken from each response.

  6. Repeat until the elements array is empty.

  7. Keep every filter the same across the pages. A changed filter changes the result set.

CAUTION: Every page costs credits. To walk 10 pages of 24 ads, you pay for 240 ads, that is 48 credits. Narrow the filters before you walk many pages.

How do I see which ads a competitor runs?

LinkedIn Ad Search answers the competitive question directly, because the LinkedIn Ad Library is public. Follow these steps.

  1. Set account_owner to the competitor company name, for example UX Pilot AI.

  2. Set countries to the markets that you track, for example US,GB.

  3. Set date_option to last-30-days.

  4. Send the request.

  5. Read advertiser.name in each item to confirm the advertiser.

  6. Read content.headline and content.description to see the message of each ad.

  7. Read creativeType to see the ad format that the competitor buys.

  8. Read pagination.totalElements to size the whole campaign.

  9. Send content.pageUrl to LinkedIn Ad Details for the audience of one ad.

To compare two competitors, send one request per company name and compare the two elements arrays. To track a message instead of a company, send keyword with the phrase, and leave account_owner empty.

How does LinkedIn Ad Search pair with LinkedIn Ad Details?

LinkedIn Ad Search finds the ads. LinkedIn Ad Details reads one of those ads in full. The two endpoints work as a pair, and the content.pageUrl field joins them.

Item

LinkedIn Ad Search

Input

Filters, or one ad library search URL

One ad library detail URL, in ad_url

Ads per call

Up to 24

1

Purpose

Find the ads of a company or a topic

Read one ad in full

Fields returned

id, content, advertiser, creativeType

element.id, element.variants, element.about, element.impressions, element.targeting

Audience data

No

Yes, in element.targeting

Impression data

No

Yes, in element.impressions

Cost

0.2 credit per ad returned

2 credits per call

To go from a search to the audience of one ad, follow these steps.

  1. Send a LinkedIn Ad Search request with your filters.

  2. Read content.pageUrl for each ad in the elements array.

  3. Choose the ads that you want to study.

  4. Send each pageUrl to LinkedIn Ad Details as the ad_url parameter.

  5. Read element.targeting for the audience segments of the ad.

  6. Read element.impressions for the total and the breakdown by country.

The element.targeting field and the element.impressions field can hold null, because LinkedIn does not publish both values for every ad.

CAUTION:LinkedIn Ad Details costs 2 credits per call. One search page of 24 ads costs 4.8 credits, and 5 detail calls cost 10 credits more. The pair costs 14.8 credits, that is $0.296.

How much does LinkedIn Ad Search cost?

LinkedIn Ad Search charges no base fee per call. It charges 0.2 credit for each ad in the elements array. At $0.02 a credit, the rate on the 1,000 and 5,000 credit packs, one ad costs $0.004. Larger packs cost less per credit. A full page of 24 ads costs 4.8 credits, and 4.8 credits cost $0.096.

Ads returned

Pages at 24 per page

Credits

Cost

24

1

4.8

$0.096

48

2

9.6

$0.192

120

5

24

$0.48

240

10

48

$0.96

1,200

50

240

$4.80

2,400

100

480

$9.60

RichAPI reserves 4.8 credits at the start of each call. That reservation covers one full page of 24 ads. RichAPI then charges for the real number of ads in elements and releases the rest of the reservation. A call that matches no ad returns an empty elements array and costs 0 credits. A failed call costs no credit.

What errors does LinkedIn Ad Search return?

An error response holds an error field with a text message.

Status

Meaning

What to do

400

The request body failed validation, or it holds an unknown field.

Correct the parameter that the message names.

401

The API key is missing, wrong or revoked.

Send your key in the x-api-key header.

402

The organization has too few credits for the reservation, or the team reached its monthly spend limit.

Buy credits in the RichAPI dashboard.

403

This API key has no access to this endpoint (Endpoint not available on your plan).

Call GET /api/v1/my-endpoints to see the endpoints that this key can use. Contact support for access.

404

The endpoint name is wrong.

Send the request to /linkedin_ad_search.

405

The request used a method other than POST.

Send the request again as POST.

429

The rate limit is exceeded.

Wait, then send the request again. For a higher limit, contact support.

500

The API failed.

Send the request again. If the failure repeats, contact support.

502

The upstream data provider failed.

Send the request again after a short wait.

503

The endpoint is down.

Wait, then send the request again.

504

The upstream data provider timed out.

Send the request again after a short wait.

For a retry loop, wait 1 second, then 2 seconds, then 4 seconds between attempts.

Frequently asked questions

What input does the LinkedIn Ad Search API need?

The LinkedIn Ad Search API needs at least one filter in the JSON request body. The filters are keyword, account_owner, countries, date_option, start_date, end_date and search_url.

How much does the LinkedIn Ad Search API cost?

The LinkedIn Ad Search API costs 0.2 credit for each ad that it returns, and it charges no base fee per call. A full page of 24 ads costs 4.8 credits, which is $0.096 at $0.02 a credit.

How many ads does one LinkedIn Ad Search call return?

One LinkedIn Ad Search call returns up to 24 ads, which is one page. To read the next 24 ads, send the same filters again. Set pagination_token to the pagination.paginationToken value of the previous response.

Does the LinkedIn Ad Search API use GET or POST?

The LinkedIn Ad Search API uses POST, and every parameter goes in the JSON request body. A GET request returns status 405 with the error linkedin_ad_search only supports POST.

How do I find every ad that a competitor runs on LinkedIn?

Send a LinkedIn Ad Search request. Set account_owner to the competitor company name, and set date_option to the period that you track. Read pagination.totalElements for the full count, then page through the results with pagination_token.

How do I see who a LinkedIn ad targets?

LinkedIn Ad Search returns no targeting data. Send content.pageUrl from the search result to LinkedIn Ad Details as the ad_url parameter. Read the element.targeting object of that response.

Does an empty LinkedIn Ad Search result cost credits?

No. A LinkedIn Ad Search call that returns an empty elements array costs 0 credits. RichAPI charges 0.2 credit per returned ad and no base fee per call.

Related articles

Did this answer your question?