Sample requests

Let's say your account is already set up, and you need to start delivering ads.

Add an ad campaign

First, add an ad campaign by following these steps:

  1. Add a host request block to the API request:

    https://adfox.yandex.com/api/v1?
    
  2. Go to the API documentation and find a description of the method for adding an ad campaign.

    To do this:

    • Find the context for adding an object. Adding a new object only applies to the account context.
    • Find the action to add a campaign: add.
    • Find the object to add: campaign.

    The result is this path to the page: API version → account → add → campaign.

  3. Add a navigation block to the request string to add a campaign:

    object=account&action=add&actionObject=campaign
    
  4. Add the required method parameters and, if necessary, the optional parameters, and fill them in.

  5. The resulting API request to add an ad campaign looks like this:

    https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=campaign&name=April_16_tea&advertiserID=456&dateStart=2021-12-20 06:30&dateEnd=2021-12-31 22:30
    

    If the campaign is successfully created, the new ad campaign ID is returned in the response.

Campaign placement on the site

After you add a campaign, you need to enable campaign placement on the site where you want to run your ads.

  1. Add a host request block, a login block, and a navigation block to the API request:

    https://adfox.yandex.com/api/v1?object=campaign&action=placing&actionObject=website
    

    Here, the context is the campaign campaign, the action is the placement placing, and the object of the action is the site website.

  2. To place a campaign on a site, you need to know the site ID.

    If you don't know it, get a list of sites, created in the context of the account:

    https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=website
    

    You'll receive a list of sites in this account in response to your request.

  3. Specify the required method parameters in the request. If necessary, specify the optional parameters.

  4. The resulting request to place the campaign on the site:

    https://adfox.yandex.com/api/v1?object=campaign&action=placing&actionObject=website&objectID=474205&actionStatus=1&actionObjectID=3245
    

Add a banner to an ad campaign

Now let's add a banner to the ad campaign created in the previous step:

  1. Add a host request block, a login block, and a navigation block to the API request:

    https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=banner
    
  2. In the document, find the required parameters and, if necessary, the optional parameters for setting up banner delivery.

  3. The resulting request to add a banner is as follows:

    https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=banner&name=aptil2022&campaignID=444444