{
  "openapi": "3.1.0",
  "info": {
    "title": "LinkedIn Ad Library API",
    "version": "1.0.0",
    "description": "Public LinkedIn ads, creative files, advertisers and EU targeting and impressions transparency exposed through FetchLayer."
  },
  "servers": [
    {
      "url": "https://api.fetchlayer.dev/linkedin-ad-library"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Send your FetchLayer key as Authorization: Bearer ss-your-key."
      }
    }
  },
  "paths": {
    "/search-ads": {
      "post": {
        "operationId": "search-ads",
        "tags": [
          "Ads"
        ],
        "summary": "Search ads by keyword",
        "description": "Search the LinkedIn Ad Library for public ads matching a keyword or phrase — the ads B2B buyers are actually served. Filter by country, date range, payer, impressions band and targeting category, and page through the results with a cursor. Coverage begins 1 June 2023, and dateRange defaults to the last 30 days, so widen it for a historical view.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Keyword or phrase to search the Ad Library for (max 500 characters)."
                  },
                  "advertiser": {
                    "type": "string",
                    "description": "Also restrict the search to advertisers whose name contains this."
                  },
                  "country": {
                    "type": "string",
                    "description": "Two-letter country code, or ALL.",
                    "example": "ALL"
                  },
                  "countries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Several countries at once (max 20). Overrides country."
                  },
                  "payer": {
                    "type": "string",
                    "description": "Name on the ad’s \"paid for by\" line."
                  },
                  "dateRange": {
                    "type": "string",
                    "description": "last-30-days, current-month, current-year, last-year, or custom-date-range. Widen it before concluding an advertiser has gone quiet.",
                    "example": "last-30-days"
                  },
                  "startDate": {
                    "type": "string",
                    "description": "Only ads running on or after this YYYY-MM-DD date. Pair with dateRange custom-date-range."
                  },
                  "endDate": {
                    "type": "string",
                    "description": "Only ads running on or before this YYYY-MM-DD date. Pair with dateRange custom-date-range."
                  },
                  "impressionsMin": {
                    "type": "number",
                    "description": "Only ads with at least this many impressions (max 1000000000). EU-targeted ads only."
                  },
                  "impressionsMax": {
                    "type": "number",
                    "description": "Only ads with at most this many impressions (max 1000000000). EU-targeted ads only."
                  },
                  "includedTargeting": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Only ads that targeted these categories: LANGUAGE, LOCATION, AUDIENCE, DEMOGRAPHIC, COMPANY, EDUCATION, JOB, INTERESTS_AND_TRAITS. EU-targeted ads only."
                  },
                  "excludedTargeting": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Only ads that excluded these targeting categories. EU-targeted ads only."
                  },
                  "sortOrder": {
                    "type": "string",
                    "description": "Orders the whole result set by date: newest or oldest.",
                    "example": "newest"
                  },
                  "limit": {
                    "type": "number",
                    "description": "Maximum ads returned (max 2000), or -1 for everything available.",
                    "example": "30"
                  },
                  "pages": {
                    "type": "number",
                    "description": "Pages of results to collect in one request (max 100), or -1 for the maximum allowed. Each page walked bills as one request."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Resume from a previous response's nextCursor. Only valid for the same filters."
                  },
                  "delayMs": {
                    "type": "number",
                    "description": "Milliseconds to wait between pages (max 30000)."
                  },
                  "sortBy": {
                    "type": "string",
                    "description": "Reorders only the ads in this response: start_date, end_date, advertiser, or none."
                  },
                  "sortDirection": {
                    "type": "string",
                    "description": "asc or desc."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "query"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "query": "marketing automation",
                    "country": "US",
                    "dateRange": "current-year",
                    "limit": 30
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "filters": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "The filters this search actually ran with, after defaults were applied."
                    },
                    "ads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "adId": {
                            "type": "string",
                            "description": "Ad Library id — the handle for ad-detail and ad-media."
                          },
                          "adLibraryUrl": {
                            "type": "string",
                            "description": "Public Ad Library permalink for this ad."
                          },
                          "format": {
                            "type": "string",
                            "description": "Ad format, e.g. SPONSORED_STATUS_UPDATE, SPONSORED_INMAILS, SPONSORED_UPDATE_CAROUSEL, SPOTLIGHT_V2. A newly introduced format is reported as-is."
                          },
                          "formatLabel": {
                            "type": "string",
                            "description": "LinkedIn’s own label for the format, e.g. \"Message Ad\"."
                          },
                          "advertiser": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Name, display name, LinkedIn page URL and id, profile type (company, member, school, showcase), tagline, logo and promotedBy."
                          },
                          "payer": {
                            "type": "string",
                            "description": "The entity named on the ad’s \"paid for by\" line."
                          },
                          "creative": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Body copy, headline, CTA labels, destination link, videos, images and attachments (carousel cards, documents, events, job postings).",
                            "properties": {
                              "bodyTruncated": {
                                "type": "boolean",
                                "description": "True in search results, where the copy is shortened. Call ad-detail for the full text."
                              }
                            }
                          },
                          "startDate": {
                            "type": "string",
                            "description": "YYYY-MM-DD. Published only for ads whose targeting includes the EU; null otherwise."
                          },
                          "endDate": {
                            "type": "string",
                            "description": "YYYY-MM-DD. Published only for ads whose targeting includes the EU; null otherwise."
                          },
                          "runDatesLabel": {
                            "type": "string",
                            "description": "LinkedIn’s own run-dates sentence, verbatim."
                          },
                          "impressions": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Impressions band and per-country share. Null for any ad whose targeting does not include the EU. Always a band, never an exact figure — LinkedIn publishes no spend for any ad."
                          },
                          "targeting": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "The targeting categories and values the advertiser chose, with inclusions and exclusions. Null for any ad whose targeting does not include the EU."
                          }
                        }
                      },
                      "description": "The matching ads, newest first unless sortOrder or sortBy says otherwise."
                    },
                    "adCount": {
                      "type": "number",
                      "description": "Number of ads in this response."
                    },
                    "totalMatchCount": {
                      "type": "number",
                      "description": "Ads matching these filters across every page, when LinkedIn reports it."
                    },
                    "pagesScraped": {
                      "type": "number",
                      "description": "Pages actually walked. Each page counts as one request against your plan."
                    },
                    "nextCursor": {
                      "type": "string",
                      "description": "Pass back as cursor to continue from where this response stopped. Only valid for the same filters."
                    },
                    "hasNextPage": {
                      "type": "boolean",
                      "description": "Whether more results are available beyond this response."
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Caveats about this particular result — a walk cut short, a filter the upstream capped. Read it before treating a result set as complete."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "adCount": 30,
                      "totalMatchCount": 412,
                      "pagesScraped": 1,
                      "hasNextPage": true,
                      "notes": [],
                      "ads": [
                        {
                          "adId": "512345678",
                          "adLibraryUrl": "https://www.linkedin.com/ad-library/detail/512345678",
                          "format": "SPONSORED_STATUS_UPDATE",
                          "formatLabel": "Single Image Ad",
                          "advertiser": {
                            "name": "Acme Software",
                            "profileUrl": "https://www.linkedin.com/company/acme-software",
                            "profileType": "company"
                          },
                          "payer": "Acme Software Inc.",
                          "creative": {
                            "headline": "Cut your reporting time in half",
                            "body": "See how revenue teams…",
                            "bodyTruncated": true,
                            "ctaTexts": [
                              "Learn more"
                            ]
                          },
                          "startDate": "2026-07-14",
                          "impressions": {
                            "totalLabel": "10k-50k",
                            "totalMin": 10000,
                            "totalMax": 50000
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/advertiser-ads": {
      "post": {
        "operationId": "advertiser-ads",
        "tags": [
          "Ads"
        ],
        "summary": "Get every ad one advertiser runs",
        "description": "Return the Ad Library ads for one advertiser, from a company or advertiser name or a linkedin.com/company URL. Advertiser names are matched by substring, so a broad name can return ads from several advertisers — matchedAdvertisers names the ones the results actually cover. Accepts the same filters as a keyword search, plus an optional query to narrow within that advertiser.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "advertiser": {
                    "type": "string",
                    "description": "Advertiser or company name, or a linkedin.com/company/<name> URL (max 500 characters)."
                  },
                  "query": {
                    "type": "string",
                    "description": "Optional keyword to filter within the advertiser's ads."
                  },
                  "country": {
                    "type": "string",
                    "description": "Two-letter country code, or ALL.",
                    "example": "ALL"
                  },
                  "countries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Several countries at once (max 20). Overrides country."
                  },
                  "payer": {
                    "type": "string",
                    "description": "Name on the ad’s \"paid for by\" line."
                  },
                  "dateRange": {
                    "type": "string",
                    "description": "last-30-days, current-month, current-year, last-year, or custom-date-range. Widen it before concluding an advertiser has gone quiet.",
                    "example": "last-30-days"
                  },
                  "startDate": {
                    "type": "string",
                    "description": "Only ads running on or after this YYYY-MM-DD date. Pair with dateRange custom-date-range."
                  },
                  "endDate": {
                    "type": "string",
                    "description": "Only ads running on or before this YYYY-MM-DD date. Pair with dateRange custom-date-range."
                  },
                  "impressionsMin": {
                    "type": "number",
                    "description": "Only ads with at least this many impressions (max 1000000000). EU-targeted ads only."
                  },
                  "impressionsMax": {
                    "type": "number",
                    "description": "Only ads with at most this many impressions (max 1000000000). EU-targeted ads only."
                  },
                  "includedTargeting": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Only ads that targeted these categories: LANGUAGE, LOCATION, AUDIENCE, DEMOGRAPHIC, COMPANY, EDUCATION, JOB, INTERESTS_AND_TRAITS. EU-targeted ads only."
                  },
                  "excludedTargeting": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Only ads that excluded these targeting categories. EU-targeted ads only."
                  },
                  "sortOrder": {
                    "type": "string",
                    "description": "Orders the whole result set by date: newest or oldest.",
                    "example": "newest"
                  },
                  "limit": {
                    "type": "number",
                    "description": "Maximum ads returned (max 2000), or -1 for everything available.",
                    "example": "30"
                  },
                  "pages": {
                    "type": "number",
                    "description": "Pages of results to collect in one request (max 100), or -1 for the maximum allowed. Each page walked bills as one request."
                  },
                  "cursor": {
                    "type": "string",
                    "description": "Resume from a previous response's nextCursor. Only valid for the same filters."
                  },
                  "delayMs": {
                    "type": "number",
                    "description": "Milliseconds to wait between pages (max 30000)."
                  },
                  "sortBy": {
                    "type": "string",
                    "description": "Reorders only the ads in this response: start_date, end_date, advertiser, or none."
                  },
                  "sortDirection": {
                    "type": "string",
                    "description": "asc or desc."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "advertiser"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "advertiser": "https://www.linkedin.com/company/acme-software",
                    "dateRange": "current-year",
                    "pages": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "advertiser": {
                      "type": "string",
                      "description": "The advertiser name that was looked up."
                    },
                    "matchedAdvertisers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The distinct advertisers these ads belong to. A broad name matches by substring and can span several — check this before attributing the ads to one company."
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "The filters this lookup actually ran with, after defaults were applied."
                    },
                    "ads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "adId": {
                            "type": "string",
                            "description": "Ad Library id — the handle for ad-detail and ad-media."
                          },
                          "adLibraryUrl": {
                            "type": "string",
                            "description": "Public Ad Library permalink for this ad."
                          },
                          "format": {
                            "type": "string",
                            "description": "Ad format, e.g. SPONSORED_STATUS_UPDATE, SPONSORED_INMAILS, SPONSORED_UPDATE_CAROUSEL, SPOTLIGHT_V2. A newly introduced format is reported as-is."
                          },
                          "formatLabel": {
                            "type": "string",
                            "description": "LinkedIn’s own label for the format, e.g. \"Message Ad\"."
                          },
                          "advertiser": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Name, display name, LinkedIn page URL and id, profile type (company, member, school, showcase), tagline, logo and promotedBy."
                          },
                          "payer": {
                            "type": "string",
                            "description": "The entity named on the ad’s \"paid for by\" line."
                          },
                          "creative": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Body copy, headline, CTA labels, destination link, videos, images and attachments (carousel cards, documents, events, job postings).",
                            "properties": {
                              "bodyTruncated": {
                                "type": "boolean",
                                "description": "True in search results, where the copy is shortened. Call ad-detail for the full text."
                              }
                            }
                          },
                          "startDate": {
                            "type": "string",
                            "description": "YYYY-MM-DD. Published only for ads whose targeting includes the EU; null otherwise."
                          },
                          "endDate": {
                            "type": "string",
                            "description": "YYYY-MM-DD. Published only for ads whose targeting includes the EU; null otherwise."
                          },
                          "runDatesLabel": {
                            "type": "string",
                            "description": "LinkedIn’s own run-dates sentence, verbatim."
                          },
                          "impressions": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Impressions band and per-country share. Null for any ad whose targeting does not include the EU. Always a band, never an exact figure — LinkedIn publishes no spend for any ad."
                          },
                          "targeting": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "The targeting categories and values the advertiser chose, with inclusions and exclusions. Null for any ad whose targeting does not include the EU."
                          }
                        }
                      },
                      "description": "The matching ads, newest first unless sortOrder or sortBy says otherwise."
                    },
                    "adCount": {
                      "type": "number",
                      "description": "Number of ads in this response."
                    },
                    "totalMatchCount": {
                      "type": "number",
                      "description": "Ads matching these filters across every page, when LinkedIn reports it."
                    },
                    "pagesScraped": {
                      "type": "number",
                      "description": "Pages actually walked. Each page counts as one request against your plan."
                    },
                    "nextCursor": {
                      "type": "string",
                      "description": "Pass back as cursor to continue from where this response stopped. Only valid for the same filters."
                    },
                    "hasNextPage": {
                      "type": "boolean",
                      "description": "Whether more results are available beyond this response."
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Caveats about this particular result — a walk cut short, a filter the upstream capped. Read it before treating a result set as complete."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "advertiser": "Acme Software",
                      "matchedAdvertisers": [
                        "Acme Software",
                        "Acme Software EMEA"
                      ],
                      "adCount": 84,
                      "pagesScraped": 3,
                      "hasNextPage": false,
                      "notes": [],
                      "ads": []
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/search-advertisers": {
      "post": {
        "operationId": "search-advertisers",
        "tags": [
          "Advertisers"
        ],
        "summary": "Find advertisers by name",
        "description": "Find the companies and people running LinkedIn ads whose name matches a brand, each with their LinkedIn page, profile type, tagline, logo and how many of their ads were seen. Use the name it returns with the other routes. The list is built by scanning ads, so adsScanned governs how complete it is — raise pages (max 20) to reach advertisers running fewer ads.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Advertiser or company name to look up (max 500 characters)."
                  },
                  "country": {
                    "type": "string",
                    "description": "Two-letter country code, or ALL.",
                    "example": "ALL"
                  },
                  "countries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Several countries at once (max 20)."
                  },
                  "limit": {
                    "type": "number",
                    "description": "Maximum advertisers returned (max 500), or -1 for everything available.",
                    "example": "30"
                  },
                  "pages": {
                    "type": "number",
                    "description": "Pages of ads to scan for advertisers (max 20), or -1 for the maximum allowed. More pages find advertisers running fewer ads."
                  },
                  "resolveProfiles": {
                    "type": "boolean",
                    "description": "Also look up each advertiser's LinkedIn page.",
                    "example": "true"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "query"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "query": "Acme",
                    "country": "US",
                    "pages": 5,
                    "limit": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "advertisers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Advertiser name — the handle advertiser-ads takes."
                          },
                          "adCount": {
                            "type": "number",
                            "description": "Ads seen for this advertiser in the pages collected, not their lifetime total."
                          },
                          "adLibraryUrl": {
                            "type": "string",
                            "description": "An Ad Library URL listing this advertiser’s ads."
                          },
                          "profileUrl": {
                            "type": "string",
                            "description": "The advertiser’s LinkedIn page."
                          },
                          "profileType": {
                            "type": "string",
                            "description": "company, member, school, or showcase — whether the advertiser is a page or an individual."
                          },
                          "description": {
                            "type": "string",
                            "description": "The tagline shown under the advertiser’s name."
                          },
                          "sampleAdId": {
                            "type": "string",
                            "description": "One of this advertiser’s ad ids, as a starting point for ad-detail."
                          }
                        }
                      },
                      "description": "Matching advertisers."
                    },
                    "advertiserCount": {
                      "type": "number",
                      "description": "Number of advertisers in this response."
                    },
                    "adsScanned": {
                      "type": "number",
                      "description": "Ads examined to build this list, which is what its completeness depends on."
                    },
                    "hasNextPage": {
                      "type": "boolean",
                      "description": "True when more ads remain; raise pages to find advertisers with fewer ads."
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Caveats about this particular result, such as a scan cut short by the page ceiling."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "advertiserCount": 3,
                      "adsScanned": 240,
                      "hasNextPage": true,
                      "notes": [],
                      "advertisers": [
                        {
                          "name": "Acme Software",
                          "adCount": 41,
                          "profileUrl": "https://www.linkedin.com/company/acme-software",
                          "profileType": "company",
                          "sampleAdId": "512345678"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/ad-detail": {
      "post": {
        "operationId": "ad-detail",
        "tags": [
          "Ads"
        ],
        "summary": "Get one ad in full",
        "description": "Read a single LinkedIn ad completely: full copy (search results carry a shortened body, this does not), headline, CTA labels, destination link, format, advertiser, payer and media. For an ad whose targeting includes the EU it also returns run dates, the impressions band, impressions by country, and the targeting the advertiser chose; those fields are null for every other ad. LinkedIn publishes no ad spend.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ad": {
                    "type": "string",
                    "description": "Ad id, or an Ad Library URL containing one."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "ad"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "ad": "512345678"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "adId": {
                      "type": "string",
                      "description": "The resolved ad id."
                    },
                    "ad": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "The full ad record, or null when the ad is no longer published.",
                      "properties": {
                        "creative": {
                          "type": "object",
                          "properties": {
                            "body": {
                              "type": "string",
                              "description": "The ad’s complete copy — not the shortened body a search result carries."
                            },
                            "attachments": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              },
                              "description": "Carousel cards, article previews, document covers, event headers and job postings attached to the creative."
                            }
                          },
                          "additionalProperties": false
                        },
                        "advertiser": {
                          "type": "object",
                          "properties": {
                            "profileUrl": {
                              "type": "string",
                              "description": "The advertiser’s LinkedIn page. Available from this endpoint."
                            }
                          },
                          "additionalProperties": false
                        },
                        "impressions": {
                          "type": "object",
                          "properties": {
                            "totalLabel": {
                              "type": "string",
                              "description": "The band LinkedIn publishes, e.g. \"1k-5k\". Null for any ad whose targeting does not include the EU."
                            },
                            "byCountry": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              },
                              "description": "Share of impressions per country. byCountryPending is true for roughly the first 48 hours of an ad’s life."
                            }
                          },
                          "additionalProperties": false
                        },
                        "targeting": {
                          "type": "object",
                          "properties": {
                            "segments": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              },
                              "description": "Each targeting category the advertiser used, with the values they named."
                            },
                            "facets": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              },
                              "description": "Whether each targeting category was applied as an inclusion or an exclusion."
                            }
                          },
                          "additionalProperties": false
                        }
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Caveats about this particular result."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "adId": "512345678",
                      "notes": [],
                      "ad": {
                        "format": "SPONSORED_STATUS_UPDATE",
                        "creative": {
                          "headline": "Cut your reporting time in half",
                          "body": "See how revenue teams at 400+ companies close the quarter in two days.",
                          "bodyTruncated": false,
                          "ctaTexts": [
                            "Learn more"
                          ]
                        },
                        "impressions": {
                          "totalLabel": "10k-50k",
                          "byCountry": [
                            {
                              "country": "DE",
                              "sharePercent": 62,
                              "shareLabel": "62%"
                            }
                          ],
                          "byCountryPending": false
                        },
                        "targeting": {
                          "segments": [
                            {
                              "facet": "JOB",
                              "label": "Job titles",
                              "values": [
                                "Revenue Operations Manager"
                              ]
                            }
                          ],
                          "facets": [
                            {
                              "facet": "COMPANY",
                              "label": "Company size",
                              "targeted": true,
                              "excluded": false
                            }
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/ad-media": {
      "post": {
        "operationId": "ad-media",
        "tags": [
          "Media"
        ],
        "summary": "Get an ad's videos and images",
        "description": "Resolve a LinkedIn ad's creative into downloadable asset URLs — videos, images and thumbnails, across the main creative and every attachment. LinkedIn's own CDN URLs are signed and expire, so each asset also carries a stable download URL served through this API. Optionally probe each asset to confirm it is still available, or return small assets base64-encoded inline.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ad": {
                    "type": "string",
                    "description": "Ad id, or an Ad Library URL containing one."
                  },
                  "kinds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "video, image, and/or thumbnail.",
                    "example": "all three"
                  },
                  "preferHighQuality": {
                    "type": "boolean",
                    "description": "Pick the largest video rendition.",
                    "example": "true"
                  },
                  "probe": {
                    "type": "boolean",
                    "description": "Confirm each asset is still downloadable and report its size and content type."
                  },
                  "inline": {
                    "type": "boolean",
                    "description": "Return the bytes base64-encoded. Refused for assets over the inline size limit."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "ad"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "ad": "512345678",
                    "kinds": [
                      "video",
                      "image"
                    ],
                    "preferHighQuality": true,
                    "probe": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "adId": {
                      "type": "string",
                      "description": "The resolved ad id."
                    },
                    "assets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "kind": {
                            "type": "string",
                            "description": "video, image, or thumbnail."
                          },
                          "url": {
                            "type": "string",
                            "description": "LinkedIn’s own CDN URL. Signed, and expires."
                          },
                          "downloadUrl": {
                            "type": "string",
                            "description": "Serves the same file through FetchLayer, without the expiry — pass it to GET /media."
                          },
                          "quality": {
                            "type": "string",
                            "description": "hd, sd, original, or preview."
                          },
                          "label": {
                            "type": "string",
                            "description": "Video rendition name, e.g. \"mp4-720p-30fp-crf28\"."
                          },
                          "bitrate": {
                            "type": "number",
                            "description": "Bits per second, for a video asset."
                          },
                          "attachmentIndex": {
                            "type": "number",
                            "description": "Which attachment this asset belongs to, or null for the main creative."
                          },
                          "contentType": {
                            "type": "string",
                            "description": "MIME type. Populated when probe or inline was set."
                          },
                          "contentLength": {
                            "type": "number",
                            "description": "Size in bytes. Populated when probe or inline was set."
                          },
                          "base64": {
                            "type": "string",
                            "description": "The bytes themselves. Populated only when inline was set."
                          }
                        }
                      },
                      "description": "The ad’s media assets."
                    },
                    "assetCount": {
                      "type": "number",
                      "description": "Number of assets in this response."
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Caveats about this particular result, such as an asset that could not be probed."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "adId": "512345678",
                      "assetCount": 2,
                      "notes": [],
                      "assets": [
                        {
                          "kind": "video",
                          "quality": "hd",
                          "label": "mp4-720p-30fp-crf28",
                          "bitrate": 1284000,
                          "contentType": "video/mp4",
                          "contentLength": 4182773
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/media": {
      "get": {
        "operationId": "media",
        "tags": [
          "Media"
        ],
        "summary": "Download an ad media file",
        "description": "Stream a LinkedIn ad's actual video or image bytes, using a url taken from an asset returned by /ad-media. Only LinkedIn CDN hosts are accepted. HTTP Range requests are supported, so video seeking works in a player. This is a GET with query parameters, not a JSON POST, and it bills as one request.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "LinkedIn CDN media URL, as returned on an ad asset. Passed as a query parameter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filename",
            "in": "query",
            "required": false,
            "description": "Content-Disposition filename to serve the file as (max 200 characters).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Range",
            "in": "header",
            "required": false,
            "description": "Standard HTTP Range request header, for example bytes=0-65535. Sent as a header, not a query parameter.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/resolve-url": {
      "post": {
        "operationId": "resolve-url",
        "tags": [
          "Utility"
        ],
        "summary": "Parse an Ad Library URL",
        "description": "Turn any LinkedIn Ad Library URL into the structured filters it encodes — whether it points at one ad or a search, plus the keyword, advertiser, payer, countries, dates, impressions range and targeting filters it carries. Parsing a URL does not consume a credit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Any Ad Library URL, to be parsed into structured filters."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "url"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "url": "https://www.linkedin.com/ad-library/search?companyName=Acme%20Software&countries=%5B%22US%22%5D&dateOption=last-30-days"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "description": "What the URL points at: ad, search, or unknown."
                    },
                    "adId": {
                      "type": "string",
                      "description": "Present when kind is ad."
                    },
                    "query": {
                      "type": "string",
                      "description": "Keyword. Present when kind is search."
                    },
                    "advertiser": {
                      "type": "string",
                      "description": "Advertiser name. Present when kind is search."
                    },
                    "payer": {
                      "type": "string",
                      "description": "Payer name. Present when kind is search."
                    },
                    "countries": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Country filters carried in the URL."
                    },
                    "dateRange": {
                      "type": "string",
                      "description": "Date window carried in the URL, with startDate and endDate when it is a custom range."
                    },
                    "includedTargeting": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Targeting categories the URL filters on."
                    },
                    "excludedTargeting": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Targeting categories the URL excludes."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "kind": "search",
                      "query": null,
                      "advertiser": "Acme Software",
                      "countries": [
                        "US"
                      ],
                      "dateRange": "last-30-days",
                      "includedTargeting": [],
                      "excludedTargeting": []
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  }
}