Max Request Length Samples for Marketing APIs
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.
LinkedIn will begin rejecting API calls not meeting new length requirements. Requests exceeding these limits must be adjusted and use query tunneling. This page provides sample API requests re-constructed to use query tunneling for Marketing APIs. This page is not designed to be a comprehensive list of all possible examples. If the API you are using is not mentioned on this page, please refer to the other API examples to re-construct your API call. Query tunneling is supported for all APIs.
See the Migration Guide - Updated API Request Maximum Length for the full summary of these changes.
Ad Analytics
Original Request
curl -X GET 'https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&dateRange=(start:(year:2019,month:5,day:28),end:(year:2019,month:9,day:30))&timeGranularity=DAILY&accounts=List(urn%3Ali%3AsponsoredAccount%3A12345)&pivot=MEMBER_COMPANY&projection=(*,elements*(externalWebsiteConversions,dateRange(*),impressions,landingPageClicks,likes,shares,costInLocalCurrency,approximateUniqueImpressions,pivot,pivotValue~(localizedName)))&fields=externalWebsiteConversions,dateRange,impressions,landingPageClicks,likes,shares,costInLocalCurrency,pivot,pivotValue' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adAnalyticsV2' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=analytics&dateRange=(start:(year:2019,month:5,day:28),end:(year:2019,month:9,day:30))&timeGranularity=DAILY&accounts=List(urn%3Ali%3AsponsoredAccount%3A12345)&pivot=MEMBER_COMPANY&projection=(*,elements*(externalWebsiteConversions,dateRange(*),impressions,landingPageClicks,likes,shares,costInLocalCurrency,approximateUniqueImpressions,pivot,pivotValue~(localizedName)))&fields=externalWebsiteConversions,dateRange,impressions,landingPageClicks,likes,shares,costInLocalCurrency,pivot,pivotValue'
Ad Budget Pricing
Original Request
curl -X GET 'https://api.linkedin.com/v2/adBudgetPricing?q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A123&bidType=CPM&optimizationTargetType=MAX_CLICK&objectiveType=WEBSITE_VISIT&campaignType=SPONSORED_INMAILS&matchType=EXACT&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%28501%2C1000%29))))))&dailyBudget=(amount:300,currencyCode:USD)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adBudgetPricing' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A123&bidType=CPM&optimizationTargetType=MAX_CLICK&objectiveType=WEBSITE_VISIT&campaignType=SPONSORED_INMAILS&matchType=EXACT&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%28501%2C1000%29))))))&dailyBudget=(amount:300,currencyCode:USD)'
Ad Campaigns
Original Request
curl -X GET 'https://api.linkedin.com/v2/adCampaignsV2?ids[0]=337643194&ids[1]=141049524' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adCampaignsV2' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'ids[0]=337643194&ids[1]=141049524'
Ad Campaign Groups
Original Request
curl -X GET 'https://api.linkedin.com/v2/adCampaignGroupsV2?ids[0]=337643194&ids[1]=141049524' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adCampaignGroupsV2' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'ids[0]=337643194&ids[1]=141049524'
Ad Creatives
Batch Get
Original Request
curl -X GET 'https://api.linkedin.com/v2/adCreativesV2?ids=List(47771456,47771492)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adCreativesV2' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'ids=List(47771456,47771492)'
Batch Partial Update
Original Request
curl -X POST 'https://api.linkedin.com/v2/adCreativesV2?ids=List(47770196)' \
-H 'Authorization: Bearer redacted' \
-H 'Content-Type: application/json' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'X-RestLi-Method: BATCH_PARTIAL_UPDATE' \
--data '{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}'
Request with Query Tunneling
curl -X POST https://api.linkedin.com/v2/adCreativesV2 \
-H 'X-HTTP-Method-Override: POST' \
-H 'Content-Type: multipart/mixed; boundary=xyz' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'X-RestLi-Method: BATCH_PARTIAL_UPDATE' \
--data $'--xyz\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nids=List(47770196)\r\n--xyz\r\n
Content-Type: application/json\r\n\r\n{"entities": {"47770196": {"patch": {"$set": {"status": "ACTIVE"}}}}}\r\n--xyz--'
Ad Direct Sponsored Contents
Original Request
curl -X GET 'https://api.linkedin.com/v2/adDirectSponsoredContents?owner=urn%3Ali%3Aorganization%3A5590506&q=owner' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adDirectSponsoredContents' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'owner=urn%3Ali%3Aorganization%3A5590506&q=owner'
Ad Form Responses
Original Request
curl -X GET 'https://api.linkedin.com/v2/adFormResponses?q=account&account=urn:li:sponsoredAccount:12345&form=urn:li:adForm:56789&projection=(paging,elements*(id,account,form~(form(hiddenFields)),campaign,creative,leadType,testLead,formResponse(consentResponses,submittedAt,answers*(question~(name),answerDetails))))' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adFormResponses' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=account&account=urn:li:sponsoredAccount:12345&form=urn:li:adForm:56789&projection=(paging,elements*(id,account,form~(form(hiddenFields)),campaign,creative,leadType,testLead,formResponse(consentResponses,submittedAt,answers*(question~(name),answerDetails))))'
Ad Supply Forecasts
Original Request
curl -X GET 'https://api.linkedin.com/v2/adSupplyForecasts?q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A507001111&timeRange=(start:1566284400000,end:1568962800000)&campaignType=SPONSORED_UPDATES&totalBudget=(amount:100.00,currencyCode:USD)&competingBid=(bidType:CPM,bidPrice:(currencyCode:USD,amount:10))&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Ageo%3A101165590))))),exclude:(or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%2810001%2C2147483647%29))))' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adSupplyForecasts' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=criteriaV2&account=urn%3Ali%3AsponsoredAccount%3A507001111&timeRange=(start:1566284400000,end:1568962800000)&campaignType=SPONSORED_UPDATES&totalBudget=(amount:100.00,currencyCode:USD)&competingBid=(bidType:CPM,bidPrice:(currencyCode:USD,amount:10))&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Ageo%3A101165590))))),exclude:(or:(urn%3Ali%3AadTargetingFacet%3AstaffCountRanges:List(urn%3Ali%3AstaffCountRange%3A%2810001%2C2147483647%29))))'
Ad Targeting Entities
Original Request
curl -X GET 'https://api.linkedin.com/v2/adTargetingEntities?facet=urn%3Ali%3AadTargetingFacet%3AcompanyCategory&q=adTargetingFacet&queryVersion=QUERY_USES_URNS&totals=false' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/adTargetingEntities' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'facet=urn%3Ali%3AadTargetingFacet%3AcompanyCategory&q=adTargetingFacet&queryVersion=QUERY_USES_URNS&totals=false'
Audience Counts
Original Request
curl -X GET 'https://api.linkedin.com/v2/audienceCountsV2?q=targetingCriteriaV2&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Ageo%3A102221843))),(or:(urn%3Ali%3AadTargetingFacet%3Askills:List(urn%3Ali%3Askill%3A17))))))' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/audienceCountsV2' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=targetingCriteriaV2&targetingCriteria=(include:(and:List((or:(urn%3Ali%3AadTargetingFacet%3Alocations:List(urn%3Ali%3Ageo%3A102221843))),(or:(urn%3Ali%3AadTargetingFacet%3Askills:List(urn%3Ali%3Askill%3A17))))))'
DMP Segments
Original Request
curl -X GET 'https://api.linkedin.com/v2/dmpSegments?ids=List(10804,10814)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/dmpSegments' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'ids=List(10804,10814)'
Follower Statistics
Original Request
curl -X GET 'https://api.linkedin.com/v2/organizationalEntityFollowerStatistics?q=organizationalEntity&organizationalEntity=urn%3Ali%3Aorganization%3A2414183&timeIntervals=(timeRange:(start:1551398400000,end:1552003200000),timeGranularityType:DAY)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/organizationalEntityFollowerStatistics' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=organizationalEntity&organizationalEntity=urn%3Ali%3Aorganization%3A2414183&timeIntervals=(timeRange:(start:1551398400000,end:1552003200000),timeGranularityType:DAY)'
Shares
Original Request
curl -X GET 'https://api.linkedin.com/v2/shares?ids=List(1234,5678)' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/shares' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'ids=List(1234,5678)'
UGC Posts
Original Request
curl -X GET 'https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A2414183)&sortBy=LAST_MODIFIED' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/ugcPosts' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=authors&authors=List(urn%3Ali%3Aorganization%3A2414183)&sortBy=LAST_MODIFIED'
Video Analytics
Original Request
curl -X GET 'https://api.linkedin.com/v2/videoAnalytics?q=entity&entity=urn:li:ugcPost:6422171828579602432&type=TIME_WATCHED&timeRange=(start:1531165717442,end:1531770742335)&aggregation=DAY' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0'
Request with Query Tunneling
curl -X POST 'https://api.linkedin.com/v2/videoAnalytics' \
-H 'X-HTTP-Method-Override: GET' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Bearer redacted' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
--data 'q=entity&entity=urn:li:ugcPost:6422171828579602432&type=TIME_WATCHED&timeRange=(start:1531165717442,end:1531770742335)&aggregation=DAY'