Partager via


Ad Preview

Warning

Deprecation Notice
The Marketing Version 202310 (Marketing October 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details. If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.

Try in Postman

The Ad Preview API provides a programmatic way for LinkedIn partners to preview a creative given a creative urn. The following formats are supported by the API

  • Single image ad
  • Carousel ad
  • Video ad
  • Single job ad
  • Event ad

Permissions

Permission Description
rw_ads Manage and read an authenticated member's ad accounts. Restricted to ad accounts in which the authenticated member has one of the following ad account roles:
  • ACCOUNT_BILLING_ADMIN
  • ACCOUNT_MANAGER
  • CAMPAIGN_MANAGER
  • CREATIVE_MANAGER
  • VIEWER
  • r_ads Read an authenticated member's ad accounts. Restricted to ad accounts in which the authenticated member has one of the following ad account roles:
  • ACCOUNT_BILLING_ADMIN
  • ACCOUNT_MANAGER
  • CAMPAIGN_MANAGER
  • CREATIVE_MANAGER
  • VIEWER
  • See Account Access Controls for more information on ad account roles.

    Note

    Ad Preview is currently available to select Beta partners. Please request access to this API by reaching out to your partner technical support channel or https://developer.linkedin.com/support.

    Schema

    Field Name Type Description
    creative SponsoredCreativeUrn Urn of the creative this ad preview corresponds to.
    account SponsoredAccountUrn Urn of the ad account of the creative.
    preview String HTML that when rendered will point to the actual ad preview. This will have an iFrame for Sponsored Content Ads where iFrame parameters will embed the information needed for preview.
    Field Name Type Description
    creative SponsoredCreativeUrn Urn of the creative this ad preview corresponds to.
    preview String HTML that when rendered will point to the actual ad preview. This will have an iFrame for Sponsored Content Ads where iFrame parameters will embed the information needed for preview.

    Get Ad Preview

    Preview of a creative can be viewed by calling the /adPreviews API. Partners can embed the iFrame tag returned in the response on their websites to get the preview. iFrames returned by the API are valid upto 3 hours. When the iFrame expires, partners can get another iFrame by calling /adPreviews API.

    Note

    • X-Restli-Protocol-Version: 2.0.0 must be passed as the header in your API requests.
    • LinkedIn-Version: {yyyymm} must be passed as the header in your API requests as this API is released with Versioning.
    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative={sponsoredCreativeUrn}&account={sponsoredAccountUrn}
    
    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative={sponsoredCreativeUrn}
    

    Sample Request

    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative=urn%3Ali%3AsponsoredCreative%3A123456789&account=urn%3Ali%3AsponsoredAccount%3A123456789
    
    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative=urn%3Ali%3AsponsoredCreative%3A123456789
    

    Sample Response

    {
      "elements": [
        {
          "preview": "<iframe src='https://www.linkedin.com/ads/ad-preview/?d=AgG8IZKRWCDwsgAAAYSBxhWaXM9Xs4hh2Njhw1ekfm2Eyr05mBTNWzdzfSylfS1cDaqWUQ_YAabYbHv732izWxTnvFoA0K-mn9TcNvxgv3vLzOE7y8rMypk-bjC8Dxt9FvJeTnCqCVox33jWMcT0ZfoJRIjn-gMOz0qpjNG3Q7d1dXkTTqlFpNHYLIFPru90DClj5pcJ4WrHFSEp4vYMhpxZPRDoBuwUMOHblRBUWT-uUW3cujvgWKPnQmm00f4lak-cMdqRthM6cRxvEwUEUHMQxzG-TOs8Fr_V53E9mLOQWsUV3KRlCOrjjULns5-bVgRC7IjeuudmVqc5MrtTJXZ0mIaF-c7ZmSFVugScKCdU8Tu3xIFEiKiG3aMu_do92weqD9iKj6gKcCjZ3oicSlD3wuw2IthbTPNTum2xnbnBZokpsuSLWPAAuRfwWajFtC_0IBdh-dlSfm2SUyQXESaZgCJFTjSlGztPizAWfYxXYWgwV6PH6tEokQg5PPubGieG-vdMHCq6ydYstezmQSBTEf5oYXo3Qpg9JTTLPdtJOYcbUFrSG93tZBalw-D8Y1uvYJoTZ06lRWxeSu5HjAqqiJcs1qeFXSyinVfE41Jehz_cVjF3w2OxBjowZQ2roWQfVZQnELzqLfoamRVMujIPqJGnQ_-wnG_tZH_aHqq4csFpsIq6AsKVdqGoZr_qAcbp4Q' height=580 width=650></iframe>",
          "creative": "urn:li:sponsoredCreative:123456789",
         
            "linkedin": {
              
              "contentPresentationType": "DESKTOP_WEBSITE"
            }
          
        }
      ],
      "paging": {
        "count": 10,
        "start": 0,
        "total": 1,
        "links": []
      }
    }