Score
Post data about the campaign, and get back carbon footprint estimates.
This method directly accepts JSON format from the request. It's the simplest and most straightforward way to measure emissions for your data.
Endpoint
Method
POST
Parameters
Name | Description | Type | Required |
---|---|---|---|
store | Set true to store the rows in your Green Dashboard account | boolean | No |
Request Body
User should send a json string of an Array of Map (or a List of Dictionary) inside of the key row
.
Keys/ values in row
Key | Description | Type | Example | Required |
---|---|---|---|---|
country | Country name or ISO-3166 2-letter code. This affects how green the electricity supply is. | string | US | Yes |
domain | The publisher website | string | http://example.com/ | Yes |
format | The type of advert | string | display | video | Yes |
campaignId | Your campaign ID -- if used, this is returned with the results | string | No | |
creativeBytes | Size of the creative in bytes. Leave blank if unknown and an industry average will be used. | number | 150000 | No |
date | When these impressions were served. Use ISO-8601 format of yyyy-mm-dd (date only) or yyyy-mm-ddTHH:mmZ (date and time). For best accuracy use one-hour granularity. If not set, then the current date is assumed. | string | 2023-06-21T13:00Z | No |
device | string | desktop | mobile | tablet | tv | No | |
dsp | Identifies which DSP was used. Contact support to discuss naming/ID options. | string | No | |
duration | Length of the video in seconds. | number | 30 | No |
impressions | Number of advert impressions | number | 1000 | Yes |
region | The region within a country - the state in the US or Australia. Use ISO-3166-2 subdivision codes. | string | US-NY | No |
ssp | Identifies which SSP was used. Contact support to discuss naming/ID options. | string | No | |
misc | Other properties are fine - they are left as-is | string | No |
Example
curl --header 'Authorization: token <your-api-key>' --location 'https://api.good-loop.com/v0/score' \
--data '{
"rows": [
{
"country": "US",
"domain": "example.com",
"format": "display",
"campaignId": "string",
"creativeBytes": 150000,
"date": "2023-06-21T13:00Z",
"device": "desktop",
"dsp": "string",
"duration": 30,
"impressions": 1000,
"region": "US-NY",
"ssp": "string",
"misc": "string"
}
]
}'
Response
{
"status": "success",
"data": {
"rows": [
{
"date": "2023-06-21T13:00Z",
"dsp": "string",
"country": "US",
"campaignId": "string",
"format": "display",
"impressions": 1000,
"duration": 30,
"ssp": "string",
"domain": "example.com",
"creativeBytes": 150000,
"region": "US-NY",
"device": "desktop",
"misc": "string",
"co2": 0.24747587706115529,
"co2base": 2.4830307666733867E-5,
"co2creative": 0.01931818542536349,
"co2supplypath": 0.22813286132812505,
"domainMeasured": false
}
]
},
"message": null,
"code": null
}