Ad Preview

Warning

Deprecation Notice
The Marketing Version 202311 (Marketing November 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 offers an organised way to preview a creative using a creative URN. The two types of previews supported are:

  • Accurate Preview - Preview an existing creative
  • Live Preview - Preview before creating a creative

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
  • w_organization_social Post, comment and like posts on behalf of an organization. Restricted to organizations in which the authenticated member has one of the following company page roles:
  • ADMINISTRATOR
  • DIRECT_SPONSORED_CONTENT_POSTER
  • CONTENT_ADMIN
  • r_organization_social Retrieve organizations' posts, comments, and likes. Restricted to organizations in which the authenticated member has one of the following company page roles:
  • ADMINISTRATOR
  • DIRECT_SPONSORED_CONTENT_POSTER
  • CONTENT_ADMIN
  • w_member_social Post, comment and like posts on behalf of an authenticated member.
    r_member_social (Restricted) Retrieve posts, comments, and likes on behalf of an authenticated member. This is a private permission.

    See Account Access Controls for more information on ad account roles.

    Schema

    Field Name Type Description
    creative SponsoredCreativeUrn URN of the creative that corresponds to the ad preview.
    placement Placement Placement on LinkedIn for which the preview is rendered such as Desktop, Mobile etc.
    preview String HTML 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.

    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

    Accurate Preview

    Preview an existing creative. The formats supported are:

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

    Get Accurate Preview

    Get an accurate preview of the creative by calling the /adPreviews GET API. Partners can embed the iFrame tag returned in the response on their websites and render the preview for both Desktop and Mobile placements.

    Note

    iFrames returned by the API are valid upto 3 hours. When the iFrame expires, partners can fetch another iFrame by calling /adPreviews API.

    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative={sponsoredCreativeUrn}&account={sponsoredAccountUrn}
    

    Sample Request

    GET https://api.linkedin.com/rest/adPreviews?q=creative&creative=urn%3Ali%3AsponsoredCreative%3A123456789&account=urn%3Ali%3AsponsoredAccount%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",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "DESKTOP_WEBSITE"
            }
          }      
        },
        {
          "preview": "<iframe src='https://www.linkedin.com/mwlite/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=375 width=700></iframe>",
          "creative": "urn:li:sponsoredCreative:123456789",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "MOBILE_WEBSITE"
            }
          }      
        }
      ],
      "paging": {
        "count": 10,
        "start": 0,
        "total": 2,
        "links": []
      }
    }
    

    Live Preview

    Preview the content of a creative before it is completely developed. The formats supported are:

    • Single image ad
    • Text ad
    • Article ad

    Live Preview Creative Action

    View the Live Preview of a creative by calling the /adPreviews action=livePreviewForCreative API.

    Schema

    Field Name Type Description
    creative Creatives Schema Creative for which preview is to be rendered. Supports preview for creatives referring existing organic post.

    You can embed the iFrame tag returned in the response on your websites to render live preview for both Desktop and Mobile placements. Additionally, you can fetch another iFrame live when the creative content is updated by calling above method.

    POST https://api.linkedin.com/rest/adPreviews?action=livePreviewForCreative
    
    {
      "creative": {
        "content": {
          "reference": "urn:li:share:7217750428568932352"
        },
        "campaign": "urn:li:sponsoredCampaign:371585095",
        "intendedStatus": "ACTIVE"
      }
    }
    

    Sample Request

    POST https://api.linkedin.com/rest/adPreviews?action=livePreviewForCreative
    
    {
      "creative": {
        "content": {
          "reference": "urn:li:share:7217750428568932352"
        },
        "campaign": "urn:li:sponsoredCampaign:371585095",
        "intendedStatus": "ACTIVE"
      }
    }
    

    Sample Response

    {
      "value": [
        {
          "preview": "<iframe srcdoc='<html>Desktop Preview</html>' height=580 width=650></iframe>",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "DESKTOP_WEBSITE"
            }
          } 
        },
        {
          "preview": "<iframe srcdoc='<html>Mobile Preview</html>' height=375 width=700></iframe>",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "MOBILE_WEBSITE"
            }
          } 
        }
      ]
    }
    

    Live Preview CreativeInline Action

    View the Live Preview of a creative inline content by calling the /adPreviews action=livePreviewForCreativeInline API.

    Schema

    Field Name Type Description
    inlineContent Creatives Inline Schema Creative Inline content for which the preview is to be rendered.

    Partners can embed the iFrame tag returned in the response on their websites to render live preview for both Desktop and Mobile placements. Partners can fetch another iFrame live when creative inline content is updated by calling above method.

    POST https://api.linkedin.com/rest/adPreviews?action=livePreviewForCreativeInline
    
    {
      "creative": {
        "inlineContent": {
          "post": {
            "adContext": {
              "dscAdAccount": "urn:li:sponsoredAccount:520866471",
              "dscStatus": "ACTIVE"
            },
            "author": "urn:li:organization:5515715",
            "commentary": "commentary about the post",
            "visibility": "PUBLIC",
            "lifecycleState": "PUBLISHED",
            "isReshareDisabledByAuthor": false,
            "content": {
              "media": {
                "id": "urn:li:image:D5510AQEPajp6XqYx3w",
                "title":"Vaibhav_Example_Image"
              }
            }
          }
        },
        "campaign": "urn:li:sponsoredCampaign:371585095",
        "intendedStatus": "ACTIVE"
      }
    }
    

    Sample Request

    POST https://api.linkedin.com/rest/adPreviews?action=livePreviewForCreativeInline
    
    {
      "creative": {
        "inlineContent": {
          "post": {
            "adContext": {
              "dscAdAccount": "urn:li:sponsoredAccount:520866471",
              "dscStatus": "ACTIVE"
            },
            "author": "urn:li:organization:5515715",
            "commentary": "commentary about the post",
            "visibility": "PUBLIC",
            "lifecycleState": "PUBLISHED",
            "isReshareDisabledByAuthor": false,
            "content": {
              "media": {
                "id": "urn:li:image:D5510AQEPajp6XqYx3w",
                "title":"Vaibhav_Example_Image"
              }
            }
          }
        },
        "campaign": "urn:li:sponsoredCampaign:371585095",
        "intendedStatus": "ACTIVE"
      }
    }
    

    Sample Response

    {
      "value": [
        {
          "preview": "<iframe srcdoc='<html>Desktop Preview</html>' height=580 width=650></iframe>",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "DESKTOP_WEBSITE"
            }
          }
        },
        {
          "preview": "<iframe srcdoc='<html>Mobile Preview</html>' height=375 width=700></iframe>",
          "placement": {
            "linkedin": {
                "placementName": "FEED",
                "contentPresentationType": "MOBILE_WEBSITE"
            }
          } 
        }
      ]
    }
    

    Warning

    Deprecation Notice
    The Marketing Version 202311 (Marketing November 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 offers an organised way to preview a creative using a creative URN. The formats supported are:

    • 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 selected Beta Partners only. 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 that corresponds to the ad preview.
    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 that corresponds to the ad preview.
    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 a creative calling the /adPreviews API. Partners can embed the iFrame tag returned in the response on their websites to get the preview.

    Note

    • iFrames returned by the API are valid upto 3 hours. When the iFrame expires, partners can get another iFrame by calling /adPreviews API
    • 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": []
      }
    }