Direct API

Questions and answers

What is the Yandex.Direct API and what can I use it for?

The API for the Yandex.Direct service provides programmatic access to data and allows you to create applications for managing advertising campaigns. External applications use the API to add and edit campaigns, ads, and phrases, set bids, and get statistics on impressions.

The Direct API is intended primarily for advertising agencies and direct advertisers — commercial companies, businesses in the service sector, and others. Developing their own custom applications allows them to fully implement their own approaches to running advertising campaigns, get timely statistical reports, and more accurately forecast their budgets.

More information about ways to use the API...

Is there a difference in managing an advertising campaign using the API and using the web interface?

The API has more features than the web interface. In particular, you can use the API to create and edit ad groups — multiple variations of an ad with the same set of keywords and other display settings.

All changes made via the API are reflected in your advertising campaigns.

Which technologies are supported in the API?

Requests to the Direct API are made over the HTTPS protocol using the POST method. Input and output data structures are passed in the body of the request and response.

The Direct API supports two formats: JSON and SOAP.

Authentication uses the OAuth 2.0 protocol: requests must specify the access token.

How much does it cost to use the API?

Both connection to the Direct API and usage are free of charge.

How do I connect to the API?

Application access

The application developer must complete the application registration process.

An API request is made on behalf of a Direct user — an advertiser or advertising agency. The request must specify the access token, which is a special code allowing the application to perform operations with this user's data.

User access

To get a token, the application must redirect the user to the access request page. The user authenticates in Yandex (using his username for Direct) and clicks the Confirm button. All other actions are performed automatically by the application and the Yandex server.

Who should register the application?

The application developer registers the application on the Yandex OAuth server and creates a request for access to the Direct API. This only needs to be done once, regardless of the number of copies of the application.

If you purchased or use a ready-made program, you do not need to register the application or submit the access request.

What restrictions are there on API usage?

There are several types of restrictions in the API.

Access restrictions

API access is not available for users of the Light web interface. These users will need to switch to the Professional web interface.

By default, clients of advertising agencies do not have access to the Yandex.Direct API, because the agency acts on their behalf. However, access can be granted at the agency's request. The agency must also set up client rights in the API using the UpdateClientInfo method.

API access may be restricted by IP address, for increased information security. The list of allowed IP addresses can be specified on the Direct API access management page on the Settings tab.

Technical limitations
  1. A maximum of five simultaneous API requests are allowed on behalf of a single user.

  2. For the following methods, a limit is imposed on the number of calls per day (24-hour period).

    Attention! If you have reached the maximum, the method will be available only once every 10 minutes until the start of the next day.
  3. The CreateOrUpdateBanners method creates no more than 1000 ads for a campaign per day.

  4. For the following methods, a limit is imposed on the amount of input data:

  5. Using the CreateNewSubclient method, an advertising agency can register no more than 100 clients per day.

  6. For the following methods, a restriction is applied to the number of reports that can be stored on the server simultaneously:
Point-based limitations

Once per day, points are awarded to each API user. They do not accumulate, and are awarded starting from zero each day. Points are used as a way of paying for certain API operations (see below). If you do not have enough points, you cannot perform these operations. The GetClientsUnits method returns the number of points available to the user.

Points are used when calling the following methods:

  1. CreateOrUpdateBanners:

    • Creating an ad ― 12 points.
    • Editing an ad ― 4 points.
    • Adding a phrase ― 2 points.
    • Editing a phrase ― 1 point.
  2. GetKeywordsSuggestion — 3 points per phrase.

  3. CreateNewWordstatReport — 10 points per phrase.

  4. AdImage (Live) — 2 points per image loaded.
  5. AdImageAssociation (Live):
    • Adding an association between an image and an ad — 2 points.

    • Removing an association — 1 point.

    Note. When adding/removing an association between an image and an ad that has the “Draft” status, points are not deducted.

The more efficiently you use Yandex.Direct, the more points you will be awarded. Inefficient use is generally associated with creating ads that are rejected during moderation or adding phrases that have a low CTR. These sorts of practices waste the resources of Yandex.Direct and are not encouraged.

Efficient use of Yandex.Direct is associated with searching for successful keywords and ad texts that raise the CTR. The number of points also depends on the campaign size and advertising expenditures. This means that more points are awarded to users who have a higher campaign balance and higher bids.

How can I increase the number of points available to me?

You can increase the number of available points by optimizing your advertising campaigns. You can do this by adding and refining keywords, improving the text of your ad to increase the CTR, and increasing your minimum bids. Points are recalculated and awarded every 24 hours.

Show me code examples for Yandex.Direct API clients

Application samples in various programming languages are provided in the documentation:

Perl
PHP
Python
C#
Authentication
Reports

How do I download the report file?

You can use the GetReportList method to get information about available reports. You can refer to the sample provided in the documentation to create a script for downloading a prepared report.

How frequently can I call the GetReportList and GetForecastList methods?

Check report readiness 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. For more information, see the section Requirements for an app.

How frequently can I update bids?

Recommendations on the frequency of updating bids are provided in the section Requirements for an app.

How can I view the XML code of the request and the server response?

For detecting errors and debugging, sometimes you need to output the client's SOAP request and the server's SOAP response.

For Perl:

my $client = SOAP::Lite->service($client->on_debug(sub {print @_}));

Where can I get help if I encounter problems using the API?

If you could not find a comprehensive answer to your question in the documentation, contact the Yandex.Direct API support team.