CSV
Send a csv, and get back a carbon-scored csv. For easy processing of csvs - such as reports from a DSP.
Endpoint
Method
POST
Parameters
Name | Description | Type | Required |
---|---|---|---|
schema | Use for special schemas, like "meta" (for reports from Facebook and Instagram) | string | No |
store | Set true to store the rows in your Green Dashboard account | boolean | No |
Request Body
A csv file, which MUST have the columns: domain
, format
, country
, and can have any other columns (see the /score
endpoint for details). Arbitrary other columns can also be included - these don't affect the calculation and are simply returned as part of the rows.
Example contents of a csv file
date domain,device,country,region,impressions,format
2023-08-14,example.com,mobile,US,NY,1000,video
2023-08-14,example.com,desktop,US,CA,500,display
Example
curl --header 'Authorization: token <your-api-key>' \
--location 'https://api.good-loop.com/v0/csv' \
--form 'csv=@"gl_api_example_report.csv"'
To save the csv result:
curl --header 'Authorization: token <your-api-key>' \
--location 'https://api.good-loop.com/v0/csv' \
--form 'csv=@"gl_api_example_report.csv"' \
-o 'result.csv'
Response
date,domain,device,country,region,impressions,format,co2,co2_publisher,co2_creative,co2_supply,domain_measured
2023-08-14,example.com,mobile,US,NY,1000,video,2.1518886558426544,0.043978239569060586,1.2982668914200781,0.8096435248535158,false
2023-08-14,example.com,desktop,US,CA,500,display,1.6443849069161116,0.033606363964861184,0.9920822230293751,0.6186963199218751,false