HTTP headers
Request headers
- Authorization
-
Contains the OAuth token of the Yandex Direct user that the API request is being made on behalf of.
Example:
Authorization: Bearer 0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f
- Accept-Language
-
Language for response messages. The selected language is used when returning textual explanations for statuses of objects (campaigns, ads, and others), and for the texts of errors and warnings. The following languages are supported:
- en — English
- ru — Russian
- en — English
- uk — Ukrainian
Example:
Accept-Language: ru
If this header is omitted or contains a language that is not supported by the Yandex Direct API, response messages are given in English.
- Client-Login
-
The username of an advertiser who is a client of the advertising agency. This is required if the request is made by an agency.
Example:
Client-Login: agrom
- Use-Operator-Units: true
- Spend the agency's points, not the advertiser's, when making a request. See the section Restrictions and points. This header is only allowed in requests from an agency.
- Accept-Encoding: gzip
- Get the response body using GZIP compression.
Request example
POST /json/v5/ads/ HTTP/1.1
Host: api.direct.yandex.com
Authorization: Bearer 0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f
Accept-Language: ru
Client-Login: agrom
Use-Operator-Units: true
Content-Type: application/json; charset=utf-8
{
"method":"add",
"params": {
...
}
}
Response headers
- RequestId
-
Unique request ID (string) assigned by the Yandex Direct API server. Returned for both successful and failed requests.
Please indicate this ID when contacting the Support service.
Example:
RequestId: 8695244274068608439
- Units
-
The number of points: 1) spent on executing the request; 2) available remainder of the daily limit; 3) the daily limit. See the section Restrictions and points.
Example:
Units: 10/20828/64000
- Units-Used-Login
-
The username of the advertiser's representative (if the advertiser's points were spent on the request), or the username of the agency's representative (if the agency's points were spent on the request).
Example:
Units-Used-Login: ttt-agency
Response example
HTTP/1.1 200 OK
Connection:close
Content-Type:application/json; charset=utf-8
Date:Fri, 28 Nov 2014 17:07:02 GMT
RequestId:8695244274068608439
Units:10/20828/64000
Units-Used-Login:ttt-agency
Server:nginx
Transfer-Encoding:chunked
{
"result": {
...
}
}