Help Center Manage Your Account AdSpeed API

Ad

Documentation for API methods to manage one or multiple ads.

API Version

1.3.2 (build 20170915). This page was updated on Thu, 19 Oct 17 03:57:40 -0400. 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

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

AS.Ads.getList

Returns the list of ads for this publisher or ad network
Additional Parameters
  • perpage Optional, default value is "10"
    The number of items per page. Maximum value is 100.
  • page Optional, default value is "1"
    The page number
Sample Request
Sample Response
<Ads total="7" page="1" numpage="2" perpage="4">
  <Ad id="35093" name="Sample Text Ad" status="pending"/>
  <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="46102" name="test" status="archived"/>
</Ads>

AS.Ads.createBanner

Create a new banner ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
  • name Required
    Name of this ad
  • clickurl Required
    Destination URL to redirect when the ad is clicked on. URL starts with http://, must be URL-encoded properly.
  • imageurl Required
    URL of an image file (JPG, GIF, PNG, BMP, SWF). URL starts with http://, must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="123" name="SampleSWFAd" status="active"></Ad>

AS.Ads.createVideo

Create a new VAST video ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
  • name Required
    Name of this ad
  • clickurl Required
    Destination URL to redirect when the ad is clicked on. URL starts with http://, must be URL-encoded properly.
  • videourl Required
    URL of an video file (MP4, MOV, MPG, FLV). URL starts with http://, 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
  • name Required
    Name of this ad
  • wrapperurl Required
    URL of the VAST wrapper. URL starts with http://, 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
  • name Required
    Name of this ad
  • htmlbase64 Required
    The base64-encoded HTML ad code. Must be encoded using base64_encode.
  • width Required
    Ad width in pixels
  • height Required
    Ad height in pixels
Sample Request
Sample Response
<Ad id="456" name="SampleHTMLAd" status="active"></Ad>

AS.Ads.createText

Create a new text-link ad. Submit via POST. Limit 50 calls/day.
Additional Parameters
  • name Required
    Name of this ad
  • first Required
    First text line
  • next Required
    Next text line(s)
  • clickurl Required
    Destination URL to redirect when the ad is clicked on. URL starts with http://, must be URL-encoded properly.
Sample Request
Sample Response
<Ad id="456" name="SampleTextLinkAd" status="active"></Ad>

AS.Ad.linkToZone

Links this ad to the specified zone
Additional Parameters
  • ad Required
    The ad identification
  • zone Required
    The zone identification
  • token Required
    The 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

Unlinks this ad from the specified zone
Additional Parameters
  • ad Required
    The ad identification
  • zone Required
    The zone identification
  • token Required
    The 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

Links this ad to the specified group
Additional Parameters
  • ad Required
    The ad identification
  • group Required
    The group identification
  • token Required
    The 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

Unlinks this ad from the specified group
Additional Parameters
  • ad Required
    The ad identification
  • group Required
    The group identification
  • token Required
    The 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

Links this ad to the specified advertiser
Additional Parameters
  • ad Required
    The ad identification
  • advertiser Required
    The advertiser identification
  • token Required
    The 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
  • ad Required
    The ad ID
  • advertiser Required
    The advertiser ID
  • rate Required
    The media kit rate ID
  • amount Required
    The order amount
  • notes Optional, default value is empty
    Notes or description
  • coupon Optional, default value is empty
    Coupon code
  • token Required
    The 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

Edits this ad settings. Submit via POST.
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • clickurl Optional, default value is empty
    The destination URL to redirect when someone clicks on this ad (start with http://, must be URL-encoded properly)
  • imageurl Optional, default value is empty
    The URL of an external JPG/GIF/BMP/SWF file (start with http://, must be URL-encoded properly)
  • htmlbase64 Optional, default value is empty
    The base64-encoded HTML code for a Rich-Media/HTML ad. Must be encoded using base64_encode
  • vastxmlbase64 Optional, default value is empty
    The base64-encoded XML code for the MediaFiles section of a VAST video ad. Must be encoded using base64_encode
  • width Optional, default value is empty
    The ad width in pixel
  • height Optional, default value is empty
    The ad height in pixel
  • weight Optional, default value is empty
    The ad weight/priority
  • optimizer Optional, default value is empty
    The ad optimization method. Possible value: "none", "rev", "clk", "ctr", "conv"
  • status Optional, default value is empty
    The ad status. Possible value: "active", "pending", "deleted"
Sample Request
Sample Response
<!DOCTYPE html>
<html>
  <head>
    <title>AdSpeed.com</title>
    <meta name="viewport" content="width=device-width,initial-scale=1"/>
  </head>
  <body style="margin:0px;background:#E4CBCA">
    <div style="text-align:center;width:100%;margin-top:200px"><img src="//g.adspeed.net/webroot/img/as/as_logo4.png" alt="i"/><br/><h2 style="font-family:Arial,sans-serif;">Input Issue</h2>Sorry! Input contains unsupported characters.<br/> Please go back to check your input before trying again.<br/> If it persists, please email support@adspeed.com for assistance.<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3445984-5', 'auto');
ga('send', 'pageview');
		</script>
</div>
  </body>
</html>

AS.Ad.addRestriction

Adds a restriction to this ad
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • logic Optional, default value is "and"
    The logical operator for this restriction. Possible value: "and", "or"
  • compare Optional, default value is "show"
    The comparison operator for this restriction. Possible value: "show", "hide"
  • type Required
    The type of restriction. Possible value: "keyword", "country", "startend"
  • value Required
    The value of this restriction. For each type, there is a specific format and syntax.
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

Returns the ad serving tag for this ad
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • width Required
    The ad width in pixels
  • height Required
    The 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:0px;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" width="468" height="60"/>
        </a>
      </iframe>
    </noscript>
    <!-- AdSpeed.com End -->
  </ServingCode>
</Ad>

AS.Ad.getLinkedZones

Returns the list of zones linked to this ad
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • perpage Optional, default value is "10"
    The number of items per page. Maximum value is 100.
  • page Optional, 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="3" page="1" numpage="1" perpage="4">
    <Zone id="7549" name="Section Travel" status="active"/>
    <Zone id="7681" name="Section Music" status="active"/>
    <Zone id="20852" name="Newsletter 468x60 Ad" status="active"/>
  </Zones>
</Ad>

AS.Ad.getAdTagForLinkedZones

Returns the list of zones linked to this ad and their ad tags
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • perpage Optional, default value is "10"
    The number of items per page. Maximum value is 100.
  • page Optional, 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="3" page="1" numpage="2" perpage="2">
    <Zone id="7549" name="Section Travel" status="active">
      <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:0px;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>
    <Zone id="7681" name="Section Music" status="active">
      <ServingCode type="regular" format="comprehensive">
        <!-- AdSpeed.com  Tag 8.0.2 for [Zone] Section Music 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=7681&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=7681&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=7681&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
              <img style="border:0px;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;zid=7681&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

Returns the stats for this ad. Limit 50 calls/day.
Additional Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • metric Required
    The type of metric can be "impressions", "clicks", "revenue", "expense"
  • period Required
    The time period can be "hourly", "daily", "weekly", "monthly"
Sample Request
Sample Response
<StatRows generated="[Time Stamp]" title="[Entity Name]">
  <StatRow>
    <Monthly>January 2014</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

Returns the visitor report for this ad. Limit 50 calls/day.
Additional Parameters
  • ad Required
    The ad ID
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • metric Required
    The type of metric can be "countries", "continents", "areas", "timezones", "regions", "languages", "browsermajor", "browserminor", "platform", "ua", "screen", "java", "cookie"
  • range Required
    The 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