Requirements for an app

This section contains requirements and recommendations for apps that interact with the Yandex Direct API.

General requirements. Error handling

  1. The app must record all requests sent to the Yandex Direct API and store logs of API requests and responses for at least the previous 3 days.
  2. The app must control and handle errors in accessing the API. The app must not send repeated invalid requests.
  3. The app must control the number of simultaneous API requests from a single user (point 1 in Technical limitations).
  4. The app must control the total number of calls of each method from a single user per day (point 2 in Technical limitations).
  5. If errors occur in relation with the limit on the number of requests, the app must stop making requests.
  6. Before calling methods that have point-based restrictions (see the section Point limitations), the app must check that points are available using the GetClientsUnits method.

Setting bids

  1. In general, the SetAutoPrice method should be used for setting bids. Always use the SetAutoPrice method for setting unified bids for an array of keywords or banners, and for setting bids that are equal to the price for displaying in a particular position with a certain markup.
  2. The number of SetAutoPrice calls should be minimized. The optimal number of calls is no more than once per hour and no more than 10 times per day for each campaign.
  3. If the app implements its own logic for changing bids that cannot be implemented using the SetAutoPrice method, bids may be set using the UpdatePrices method.
  4. The number of UpdatePrices calls should be minimized. To achieve this, put the maximum number of keywords in each method call, including those that belong to different ads or ad groups in the same campaign (but following the restrictions listed in point 3 in Technical limitations).
  5. When calling the UpdatePrices method, use the keyword identifiers (PhraseID) that have been previously saved in the cache, rather than getting keyword IDs before setting a bid each time.
  6. We recommend varying the frequency of bid setting depending on the priority of campaigns and ads (groups). See Prioritizing.
  7. You should not continue changing bids for campaigns that are stopped or that have run out of funds.

Updating the cache

  1. Parameters of campaigns, ads (groups), and keywords that are obtained from the server should be saved in a cache (in a local database, in memory, in files on a disk, and so on).
  2. Before updating the data in the cache, use the GetChanges method to check for changes. You should only get data from the Yandex Direct API server again for campaigns and ads (ad groups) that have been changed since the last cache update.
  3. To get a list of campaigns, use the GetCampaignsList method; to get campaign parameters, use the GetCampaignsParams method. The optimal number of calls is once per hour (or less).
  4. To get parameters for ads, use the GetBanners method with the parameter GetPhrases = "Yes" (getting a reduced set of parameters, without auction results). If there are a large number of keywords, call the GetBanners method with the GetPhrases = "No" parameter, then get keywords using the GetBannerPhrasesFilter method (see 5).

    If there are a large number of ads in a campaign (about 1000 or more), use the parameters Limit/Offset when getting ads.

  5. To get keywords, use the GetBannerPhrasesFilter method and list the set of parameters to get in the FieldsNames parameter (for example, FieldsNames = ["PhraseID","BannerID","Phrase","Price","ContextPrice","AutoBudgetPriority"], and set the ad IDs in the BannerIDS parameter (the optimal number is from 100 to 300).
  6. For high-priority campaigns or ads (ad groups), the cache may be updated more often (see Prioritizing ).

Prioritizing

  1. We recommend dividing campaigns, groups, ads and/or keywords into high-priority and low-priority groups. For example, high priority can be assigned to more active and important campaigns with a large number of clicks or a high CPC.

    Priorities can be set manually by the user or assigned automatically using a specific algorithm, such as based on statistics for clicks and impressions.

  2. High-priority objects are allowed to set bids and update the cache more frequently (provided that you follow point 3).
  3. For low-priority objects, reduce the frequency of setting bids and updating the cache to one or two times per day.

Control for expenditure statistics

  1. Use the GetSummaryStat method to get summary statistics for a campaign by days or for a period. The optimal call frequency is a maximum of 5 times per hour for each campaign.
  2. To get statistics for ads and keywords, use the GetBannersStat (Live) method. The optimal call frequency is once per hour for each campaign (or less).
  3. The CreateNewReport method should be used only for getting statistics filtered by display regions, platforms, display position, or reaching Yandex Metrica goals. In addition, the report period should be limited to the minimal value possible (for example, one or two days). The optimal call frequency is a maximum of 5 times per day for each campaign.
  4. If you need to get multiple reports using the CreateNewReport method, start generating the maximum number of reports at once (with consideration for the restrictions given in point 6 in Technical limitations). This speeds up processing the request queue. As reports become available, you should download them, delete them from the server (DeleteReport method) and start generating the next report.
  5. Check report readiness (GetReportList method) in a single thread, no more than once every 10-30 seconds. We recommend increasing the interval before each consecutive check. For example: 10, 20, 40, ... seconds.
  6. If highly precise statistics are needed with consideration for corrections, use the GetChanges method for checking for corrections to statistics. You should only get the statistics again for those campaigns and periods that had corrected statistics.

Budget forecasting and keyword selection

  1. Reports generated using the CreateNewForecast and CreateNewWordstatReport methods are intended for expanding and more precisely defining clients' advertising campaigns in Yandex Direct. Do not generate these reports for other purposes.
  2. If you need to get multiple reports, start generating the maximum number of reports at once (with consideration for the restrictions given in point 6 in Technical limitations). This speeds up processing the request queue. As reports become available, you should download them (GetForecast and GetWordstatReport methods), delete them from the server (DeleteForecastReport and DeleteWordstatReport methods) and start generating the next reports.
  3. Check report readiness (GetForecastList and GetWordstatReportList methods) in a single thread, no more than once every 10-30 seconds.
  4. Before calling the CreateNewWordstatReport and GetKeywordsSuggestion methods, the app must check that points are available using the GetClientsUnits method (see the section Балльные ограничения).

Dictionary data

  1. The list of regions (GetRegions method) and list of time zones (GetTimeZones method) should be requested from the server one time and saved in the cache.
  2. Before updating the data in the cache, use the GetChanges method to check for changes. This check should be made no more than once per day.