---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.1
alternate:
  - https://yandex.com/dev/adfox/doc/en/v.1/example.md
  - https://yandex.com/dev/adfox/doc/ru/v.1/example.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/adfox/doc/en/llms.txt

# Sample requests

Let's say [your account is already set up](https://yandex.com/dev/adfox/doc/en/v.1/description.md), and you need to start delivering ads.

## Add an ad campaign {#add-campaign}

First, [add an ad campaign](https://yandex.com/dev/adfox/doc/en/v.1/account/account-add-campaign.md) by following these steps:

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

   ```
   https://adfox.yandex.com/api/v1?
   ```

1. 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.
    
1. Add a navigation block to the request string to add a campaign:

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

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

   ```css
   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 {#add-placing}

After you add a campaign, you need to [enable campaign placement on the site](https://yandex.com/dev/adfox/doc/en/v.1/campaign/campaign-placing-website.md) 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`.
    
1. 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](https://yandex.com/dev/adfox/doc/en/v.1/account/account-list-website.md), 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.
    
1. Specify the required method parameters in the request. If necessary, specify the optional parameters.

1. 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 {#add-banner}

Now let's [add a banner](https://yandex.com/dev/adfox/doc/en/v.1/account/account-add-banner.md) 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
   ```

1. In the document, find the required parameters and, if necessary, the optional parameters for setting up banner delivery.

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

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