Uploading expenses as multipart/form-data
Uploads advertising expenses.
Attention. You don't need to upload Yandex Direct data — it is transmitted to Yandex Metrica automatically. If you upload a file with the data, it will duplicate the automatically transmitted data and the report will become incorrect.
Data is passed as multipart/form-data in the file parameter in CSV format. You must pass the column names in the first line of the request.
Required columns:
- Date: String, date in YYYY-MM-DD format or a range of dates in YYYY-MM-DD/YYYY-MM-DD format.
- UTMSource: String, utm_source tag value.
- Expenses: Number, the cost amount without VAT. Use a full stop (.) as the decimal separator.
Optional columns:
- UTMMedium: String, utm_medium tag value.
- UTMCampaign: String, utm_campaign tag value.
- UTMTerm: String, utm_term tag value.
- UTMContent: String, utm_content tag value.
- Currency: String, a three-letter ISO 4217 currency code.
- Clicks: Number, the count of clicks on ads.
Note. The values of UTM tags are case-sensitive. Keep this in mind when uploading and deleting data.
Request syntax
counterId
: ID of the tag for which you want to upload expenses.
https://api-metrika.yandex.net/management/v1/counter/{counterId}/expense/upload
? [provider=<string>]
& [comment=<string>]
provider | A service that transmits data to Yandex Metrica (provider). |
comment | Comment. |
provider | A service that transmits data to Yandex Metrica (provider). |
comment | Comment. |
In the request body
< multipart_file >
Sample request
POST https://api-metrika.yandex.net/management/v1/counter/{counterId}/expense/upload?provider=no example
Response format
{
"uploading" : < _expense_uploading >
}
Parameters | Description |
---|---|
uploading | Information about expense uploads. |
Parameters | Description |
---|---|
uploading | Information about expense uploads. |
What's next?
To track the status of your expense uploads, use the GET /management/v1/counter/{counterId}/expense/uploading/{uploadingId} method.