Example: clicks and cost

This example shows how to get the number of clicks and their cost for campaigns, broken down by day (in the advertiser's currency, including VAT). The report period is determined automatically (see section How to get updated statistics).

Request
curl \
  -H 'Authorization: Bearer 0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f' \
  -H 'Accept-Language: en' \
  -H 'Client-Login: agrom' \
  -H 'returnMoneyInMicros: false' \
  -d '{
    "params": {
      "SelectionCriteria": {
        "Filter": [{
          "Field": "CampaignId",
          "Operator": "IN",
          "Values": [ "10002", "10007" ]
        }]
      },
      "FieldNames": [ "Date", "CampaignId", "Clicks", "Cost" ], 
      "OrderBy": [{
        "Field": "Date"
      }],
      "ReportName": "Actual Data",
      "ReportType": "CAMPAIGN_PERFORMANCE_REPORT",
      "DateRangeType": "AUTO",
      "Format": "TSV",
      "IncludeVAT": "YES",
      "IncludeDiscount": "YES"
    }
  }' \
  https://api.direct.yandex.com/json/v5/reports
Report
"Actual Data (2018-04-01 - 2018-04-03)"
Date CampaignId Clicks Cost
2018-04-01 10002 6 90.20
2018-04-01 10007 397 1496.50
2018-04-02 10002 13 158.60
2018-04-02 10007 314 1181.40
2018-04-03 10002 15 165.10
2018-04-03 10007 447 1619.60
Total rows: 6