Help Center Manage Your Account AdSpeed API

Ad

Documentation for API methods to manage one or multiple ads.

API Version

1.4.1 (build 20211111). This page was updated on Mon, 08 Nov 21 12:59:14 -0500. Since the API method and response format can change from one version to another, you should check this page for updates.

API Methods - Ad

AS.Ads.getCounts

Return the number of active, pending, deleted and total ads for this publisher or ad network
Additional Parameters
  • None
Sample Request
Sample Response
<Ads total="6" active="3" pending="3" archived="0" deleted="0"/>

AS.Ads.getList

Return the list of ads for this publisher or ad network
Additional Parameters
ParameterRequiredDescription
statusOptional
Default value is empty
Filter ads with this status. Possible value: 'active','pending','archived'
perpageOptional
Default value is "10"
The number of items per page. Maximum value is 100.
pageOptional
Default value is "1"
The page number
Sample Request
Sample Response
<Ads total="6" page="1" numpage="2" perpage="4">
  <Ad id="35093" name="Sample Text Ad" status="active"/>
  <Ad id="36943" name="Sample Image Ad" status="active" width="468" height="60"/>
  <Ad id="40631" name="Sample Rich HTML Ad" status="pending" width="300" height="250"/>
  <Ad id="54412" name="Sample Text Link Ad" status="pending"/>
</Ads>

AS.Ads.createBanner

Create a new banner ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
nameRequiredName of this ad
clickurlRequiredDestination URL to redirect when the ad is clicked on. Must be URL-encoded properly.
imageurlRequiredURL of an image file (JPG, GIF, PNG, BMP, SWF). Must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="123" name="SampleGIFAd" status="active"></Ad>

AS.Ads.createVideo

Create a new VAST video ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
nameRequiredName of this ad
clickurlRequiredDestination URL to redirect when the ad is clicked on. Must be URL-encoded properly.
videourlRequiredURL of an video file (MP4, MOV, MPG, FLV). Must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="123" name="SampleVASTVideoAd" status="active"></Ad>

AS.Ads.createVASTWrapper

Create a new VAST wrapper video ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
nameRequiredName of this ad
wrapperurlRequiredURL of the VAST wrapper. Must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="123" name="SampleVASTWrapperVideoAd" status="active"></Ad>

AS.Ads.createHTML

Create a new Rich-Media/HTML ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
nameRequiredName of this ad
htmlbase64RequiredThe base64-encoded HTML ad code. Must be encoded using base64_encode.
widthRequiredAd width in pixels
heightRequiredAd height in pixels
Sample Request
Sample Response
<Ad id="123" name="SampleHTMLAd" status="active"></Ad>

AS.Ads.createText

Create a new text-link ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
nameRequiredName of this ad
firstRequiredFirst text line
nextRequiredNext text line(s)
clickurlRequiredDestination URL to redirect when the ad is clicked on. Must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="123" name="SampleTextLinkAd" status="active"></Ad>

AS.Ad.linkToZone

Link this ad to the specified zone
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
zoneRequiredThe zone ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Zone ID][Zone Name]
Sample Request
Sample Response
<Confirmation ad="36943" zone="7607">LINKED</Confirmation>

AS.Ad.unlinkFromZone

Unlink this ad from the specified zone
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
zoneRequiredThe zone ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Zone ID][Zone Name]
Sample Request
Sample Response
<Confirmation ad="36943" zone="7607">UNLINKED</Confirmation>

AS.Ad.linkToGroup

Link this ad to the specified group
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
groupRequiredThe group ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Group ID][Group Name]
Sample Request
Sample Response
<Confirmation ad="36943" group="2600">LINKED</Confirmation>

AS.Ad.unlinkFromGroup

Unlink this ad from the specified group
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
groupRequiredThe group ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Group ID][Group Name]
Sample Request
Sample Response
<Confirmation ad="36943" group="2600">UNLINKED</Confirmation>

AS.Ad.linkToAdvertiser

Link this ad to the specified advertiser
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
advertiserRequiredThe advertiser ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Advertiser ID][Advertiser Username]
Sample Request
Sample Response
<Confirmation ad="36943" advertiser="1772">LINKED</Confirmation>

AS.Ad.placeOrder

(BETA) Place an ad order. Requirements: ad is already linked to the advertiser. Ad dimension matches the chosen rate. Order amount is within the rate range.
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
advertiserRequiredThe advertiser ID
rateRequiredThe media kit rate ID
amountRequiredThe order amount
notesOptional
Default value is empty
Notes or description
couponOptional
Default value is empty
Coupon code
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Advertiser ID][Advertiser Name]
Sample Request
Sample Response
Your advertising order has been placed. Once your payment is received, your order will be processed.

AS.Ad.edit

Edit this ad settings. Submit via POST.
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
nameOptional
Default value is empty
Change to a new ad name
clickurlOptional
Default value is empty
The landing URL to redirect when someone clicks on this ad (must be URL-encoded properly)
imageurlOptional
Default value is empty
The URL of an external JPG/GIF/BMP/SWF file (must be URL-encoded properly)
htmlbase64Optional
Default value is empty
The base64-encoded HTML code for a Rich-Media/HTML ad. Must be encoded using base64_encode
vastxmlbase64Optional
Default value is empty
The base64-encoded XML code for the MediaFiles section of a VAST video ad. Must be encoded using base64_encode
widthOptional
Default value is empty
The ad width in pixel
heightOptional
Default value is empty
The ad height in pixel
weightOptional
Default value is empty
The ad weight
optimizerOptional
Default value is empty
The ad optimization method. Possible value: "none", "rev", "clk", "ctr", "conv"
statusOptional
Default value is empty
The ad status. Possible value: "active", "pending", "deleted"
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="active" width="468" height="60"/>

AS.Ad.addRestriction

Add a restriction to this ad
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
logicOptional
Default value is "and"
The logical operator for this restriction. Possible value: "and", "or"
compareOptional
Default value is "show"
The comparison operator for this restriction. Possible value: "show", "hide"
typeRequiredThe type of restriction can be "continent", "country", "region", "city", "startend", "keyword"
valueRequiredThe value of this restriction. Please contact us for syntax/format.
Sample Request
Sample Response
<Restrictions entity="[Ad] Sample Image Ad"># Conditions
---------------------------------------------------------
1. Show if visitor is from United States, Canada, AND
2. Show during the hours of 08:xx, 09:xx, 10:xx, 11:xx
</Restrictions>

AS.Ad.getAdTag

Return the ad serving tag for this ad
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
widthRequiredThe ad width in pixels
heightRequiredThe ad height in pixels
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="active" width="468" height="60">
  <ServingCode type="regular" format="comprehensive">
    <!-- AdSpeed.com  Tag 8.0.2 for [Ad] Sample Image Ad 468x60 -->
    <script type="text/javascript"><![CDATA[
	var asdate=new Date();var q='&amp;tz='+asdate.getTimezoneOffset()/60 +'&amp;ck='+(navigator.cookieEnabled?'Y':'N') +'&amp;jv='+(navigator.javaEnabled()?'Y':'N') +'&amp;scr='+screen.width+'x'+screen.height+'x'+screen.colorDepth +'&amp;z='+Math.random() +'&amp;ref='+escape(document.referrer.substr(0,255)) +'&amp;uri='+escape(document.URL.substr(0,255));document.write('<ifr'+'ame width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank'+q+'" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0"></ifr'+'ame>');
	]]></script>
    <noscript>
      <iframe width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0">
        <a href="http://g.adspeed.net/ad.php?do=clk&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
          <img style="border:0;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" alt="i" width="468" height="60"/>
        </a>
      </iframe>
    </noscript>
    <!-- AdSpeed.com End -->
  </ServingCode>
</Ad>

AS.Ad.getLinkedZones

Return the list of zones linked to this ad
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
perpageOptional
Default value is "10"
The number of items per page. Maximum value is 100.
pageOptional
Default value is "1"
The page number
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="active" width="468" height="60">
  <Zones total="1" page="1" numpage="1" perpage="4">
    <Zone id="7549" name="Section Travel" status="active" secondary="7607"/>
  </Zones>
</Ad>

AS.Ad.getAdTagForLinkedZones

Return the list of zones linked to this ad and their ad tags
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
perpageOptional
Default value is "10"
The number of items per page. Maximum value is 100.
pageOptional
Default value is "1"
The page number
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="active" width="468" height="60">
  <Zones total="1" page="1" numpage="1" perpage="2">
    <Zone id="7549" name="Section Travel" status="active" secondary="7607">
      <ServingCode type="regular" format="comprehensive">
        <!-- AdSpeed.com  Tag 8.0.2 for [Zone] Section Travel 468x60 -->
        <script type="text/javascript"><![CDATA[
	var asdate=new Date();var q='&amp;tz='+asdate.getTimezoneOffset()/60 +'&amp;ck='+(navigator.cookieEnabled?'Y':'N') +'&amp;jv='+(navigator.javaEnabled()?'Y':'N') +'&amp;scr='+screen.width+'x'+screen.height+'x'+screen.colorDepth +'&amp;z='+Math.random() +'&amp;ref='+escape(document.referrer.substr(0,255)) +'&amp;uri='+escape(document.URL.substr(0,255));document.write('<ifr'+'ame width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank'+q+'" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0"></ifr'+'ame>');
	]]></script>
        <noscript>
          <iframe width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0">
            <a href="http://g.adspeed.net/ad.php?do=clk&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
              <img style="border:0;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" alt="i" width="468" height="60"/>
            </a>
          </iframe>
        </noscript>
        <!-- AdSpeed.com End -->
      </ServingCode>
    </Zone>
  </Zones>
</Ad>

AS.Ad.getStats

Return the stats for this ad. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
metricRequiredThe type of metric can be "impressions", "clicks", "revenue", "expense", "events"
periodRequiredThe time period can be "hourly", "daily", "weekly", "monthly"
Sample Request
Sample Response
<StatRows generated="[Time Stamp]" title="[Entity Name]">
  <StatRow>
    <Monthly>January 2019</Monthly>
    <Unique_Impression>3,156</Unique_Impression>
    <Gross_Impression>6,565</Gross_Impression>
    <Unique_over_Gross_Impression>48.07%</Unique_over_Gross_Impression>
  </StatRow>
  <StatRow>More Rows...</StatRow>
  <StatRow>
    <Monthly>Total</Monthly>
    <Unique_Impression>57,417</Unique_Impression>
    <Gross_Impression>114,979</Gross_Impression>
    <Unique_over_Gross_Impression>49.94%</Unique_over_Gross_Impression>
  </StatRow>
  <StatRow>
    <Monthly>Average</Monthly>
    <Unique_Impression>4,785</Unique_Impression>
    <Gross_Impression>9,582</Gross_Impression>
    <Unique_over_Gross_Impression>49.94%</Unique_over_Gross_Impression>
  </StatRow>
</StatRows>

AS.Ad.getVisitorStats

Return the visitor report for this ad. Limit 50 calls/day.
Additional Parameters
ParameterRequiredDescription
adRequiredThe ad ID
tokenRequiredThe authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
metricRequiredThe type of metric can be "countries", "continents", "areas", "timezones", "regions", "languages", "browsermajor", "browserminor", "platform", "ua", "screen", "cookie"
rangeRequiredThe time range can be "last7days", "last31days", "thismo", "lastmo", "alltime"
Sample Request
Sample Response
<StatRows generated="[Time Stamp]" title="[Entity Name]" range="Alltime" metric="countries">
  <StatRow>
    <Rank>1</Rank>
    <Country>United States</Country>
    <Flag/>
    <Percentage>95%</Percentage>
  </StatRow>
  <StatRow>
    <Rank>2</Rank>
    <Country>Canada</Country>
    <Flag/>
    <Percentage>5%</Percentage>
  </StatRow>
</StatRows>

Other Articles in AdSpeed API

Documentation to use AdSpeed API to integrate AdSpeed AdServer into your own platform.

Cannot find an answer for your question? Ask our Customer Care team

Related