Carbon Offsetting API Documentation - V1
Explore our endpoints and examples to test, demo, implement, and use Cloverly for carbon offsetting.
NOTE: This is for V1 of the API. For V2 of the API, please visit https://docs.cloverly.com/
ACCOUNT
Account Info Account StatsOFFSETS
List Offsets Show Offset How to Match Offsets Offset typesPURCHASES
List Purchases Show Purchase Convert Estimate to Purchase Create Fixed Price Purchase Purchase Offset for Carbon Purchase Offset for Shipping Purchase Offset for Transportation Purchase Offset for Flight Purchase Offset for Electricity Cancel PurchasesESTIMATES
List Estimates Show Estimate Create Fixed Price Estimate Create Estimate for Carbon Create Estimate for Shipping Create Estimate for Ground Transportation Create Estimate for Flight Create Create Estimate for Electricity Cancel Estimate Account InfoMISC
Error Codes Get helpAccount Info
Account Info
Use this to retrieve information about and the status of your account.
curl https://api.cloverly.com/2019-03-beta/account \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/account' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/account', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/account", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/account'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php $ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/account");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "name": "string", "owner": { "name": "string", "email": "string" }, "balance_in_usd_cents": "number", "production_enabled?": "boolean", "environment": "string"}
Path attributes
none
Message body attributes
none
Account Stats
Account Stats
Retrieve offset statistics for your account.
curl https://api.cloverly.com/2019-03-beta/account/stats \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/account/stats' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request'');const options = { url: 'https://api.cloverly.com/2019-03-beta/account/stats', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/account/stats", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/account/stats'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/account/stats");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "environment": "string", "total_grams_of_carbon": "string", "transaction_count": "string", "purchased_count": "string", "cancelled_count": "string" "daily_stats": "string" "offset_stats": "string"}
Path attributes
none
Message body attributes
none
List Offsets
List offsets
Get a list of all currently available offsets. Any purchase or estimate call below accepts targeting a specific offset via an offset_slug value.
curl https://api.cloverly.com/2019-03-beta/offsets \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/offsets' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/offsets', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/offsets", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/offsets'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/offsets");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
[ { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string" "offset_type": "string" "offset_type_slug": "string" "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }]
Path attributes
none
Message body attributes
none
Show Offset
Show the details of a specific offset
Get the details of a specific offset.
curl https://api.cloverly.com/2019-03-beta/offsets/:offset_slug \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/offsets/:offset_slug' req.headers['Content-Type' = 'application/json' req.headers['Authorization' = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/offsets/:offset_slug', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/offsets/:offset_slug", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/offsets/:offset_slug'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/offsets/:offset_slug");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string"}
Path attributes
Required | |
---|---|
offset_slug | The slug for the offset |
Message body attributes
none
How to Match Offsets
How to Match Offsets
Use this matching functionality when creating an estimate or purchase to match offsets by type, location, or exact slug.
By default, the Cloverly API matches based on low cost. The Cloverly API will match anywhere in the world with low cost. Using offset matching changes that behavior. If you include a "type," then the Cloverly API will require a particular offset type, and then sort by low cost. If a location is included, then the API will sort by closest offset to that location first.
Examples
Matching solar closest to Mountain View, California
"offset_match": {"type": "solar", "location":{"postal_code":"94043","country":"US"}
Matching solar to a latitude/longitude in Pennsylvania
"offset_match": {"type": "solar", "location":{"latlng": [41.1609216,-76.6826642]}
Matching offset to an airport
"offset_match": {"location": {"airport": "sfo"}}
Matching biomass (For a full list of available offset types, see offset types below.)
"offset_match": {"type": "biomass"}
Full example
Matching solar closest to Mountain View, California, for 200 kilowatt-hours of electricity
curl https://api.cloverly.com/2019-03-beta/purchases/electricity \-X POST \-d '{"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}' \-H Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/electricity' req.body = '{"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/electricity', body: JSON.stringify({"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/electricity", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/electricity'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/electricity");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"energy":{"value":200,"units":"kwh"},"offset_match":{"type":"solar","location":{"postal_code":"94043","country":"US"}}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Path attributes
none
Message body attributes
none
Offset types
List the offset types that can be used for filtering
Get a full list of offset types that can be used for filtering offsets. Use the "slug" returned here in the "offset_match" syntax above.
curl https://api.cloverly.com/2019-03-beta/offset-types \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/offset-types' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/offset-types', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/offset-types", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/offset-types'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/offset-types");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
[ { "slug": "string", "name": "string", "description": "string" }]
Path attributes
none
Message body attributes
none
List Purchases
List all purchases for your account
Get the full list of purchases for the account.
curl https://api.cloverly.com/2019-03-beta/purchases \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/purchases' req.headers['Content-Type' = 'application/json' req.headers['Authorization' = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/purchases', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/purchases", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
[ { "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": ""number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string" }]
Path attributes
none
Message body attributes
Optional | |
---|---|
`offset_slug` | Filter to a specific offset |
`before` | epoch to choose the latest before a certain time (used for pagination) |
Show Purchase
Show the details for a specific purchase
Get the full details of a specific purchase.
url https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/purchases/:purchase_slug' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string"}
Path attributes
Required | |
---|---|
`purchase_slug` | The slug for the purchase |
Message body attributes
none
Convert Estimate to Purchase
Convert an estimate into a purchase
After creating an estimate, use this endpoint to convert that estimate to a purchase.
curl https://api.cloverly.com/2019-03-beta/purchases \-X POST \-d '{"estimate_slug":"{estimate_slug}"}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases' req.body = '{"estimate_slug":"{estimate_slug}"}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases', body: JSON.stringify({"estimate_slug":"{estimate_slug}"}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"estimate_slug":"{estimate_slug}"}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"estimate_slug":"{estimate_slug}"}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"estimate_slug":"{estimate_slug}"}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`estimate_slug` | The slug for a previously created estimate to be converted to a purchase |
Create Fixed Price Purchase
Purchase an offset with a fixed price
Set the price you would like to pay. We'll calculate the amount of an offset available at that price.
curl https://api.cloverly.com/2019-03-beta/purchases/currency \-X POST \-d '{"currency":{"value":357,"units":"usd cents"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/currency' req.body = '{"currency":{"value":357,"units":"usd cents"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/currency', body: JSON.stringify({"currency":{"value":357,"units":"usd cents"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main]import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"currency":{"value":357,"units":"usd cents"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/currency", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/currency'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"currency":{"value":357,"units":"usd cents"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/currency");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"currency":{"value":357,"units":"usd cents"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`currency: {value: INTEGER, units: STRING}` | The fixed amount to be spent on this purchase, where "units" can be one of `usd` or `usd cents`. |
Purchase Offset for Carbon
Purchase an offset for carbon
Use this to offset a specific amount of carbon (CO2e) by weight.
curl https://api.cloverly.com/2019-03-beta/purchases/carbon \-X POST \-d '{"weight":{"value":35,"units":"kg"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/carbon' req.body = '{"weight":{"value":35,"units":"kg"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/carbon', body: JSON.stringify({"weight":{"value":35,"units":"kg"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"weight":{"value":35,"units":"kg"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/carbon", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/carbon'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"weight":{"value":35,"units":"kg"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/carbon");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"weight":{"value":35,"units":"kg"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`weight: {value: INTEGER, units: STRING}` | The fixed amount to be spent on this purchase, where "units" can be one of `usd` or `usd cents`. |
Purchase Offset for Shipping
Purchase a shipping offset
Use this to offset emissions from shipping something.
curl https://api.cloverly.com/2019-03-beta/purchases/shipping \-X POST \-d '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"},"mode":"air"}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/shipping' req.body = '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/shipping', body: JSON.stringify({"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/shipping", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/shipping'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/shipping");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string" }
Path attributes
none
Message body attributes
Required | |
---|---|
`weight: {value: INTEGER, units: STRING}` | The amount of carbon to offset |
Optional | |
---|---|
`offset_match: {...}` |
See "How to Match Offsets" section of documentation. |
`mode: [air, ground]` |
Specify if the item is shipped by air or by ground. If not passed, defaults to ground. |
Choose 1 of the following methods for calculating distance:
Using ZIP Codes | |
---|---|
`from: {zip: STRING}` | The origin zip code |
`to: {zip: STRING}` | The destination zip code |
Using UK Postal Codes | |
---|---|
`from: {uk_postal_code: STRING}` | The origin UK postal code |
`to: {uk_postal_code: STRING}` | The destination UK postal code |
Using Latitude-Longitude | |
---|---|
`from: {latlng: [FLOAT, FLOAT]}` | The origin latitude and longitude |
`to: {latlng: [FLOAT, FLOAT]}` | The destination latitude and longitude |
Using Distance | |
---|---|
`distance: {value: INTEGER, units: STRING}` | The distance where units can be "km" or "miles" |
Purchase Offset for Transportation
Purchase a vehicle offset
Offset emissions from transportation in a vehicle that uses gasoline or diesel fuel.
curl https://api.cloverly.com/2019-03-beta/purchases/vehicle \-X POST \-d '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/vehicle' req.body = '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/vehicle', body: JSON.stringify({"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/vehicle", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/vehicle'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/vehicle");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string" }
Path attributes
none
Message body attributes
Required | |
---|---|
`fuel_efficiency: {value: INTEGER, units: STRING, of: STRING}` | The fuel efficiency of the vehicle, where "units" is one of 'mpg' or 'km/l' and "of" is one of "gasoline" or "diesel". |
`distance: {value: INTEGER, units: STRING}` | The distance to offset, where "units" is one of "miles" or "km". |
Purchase Offset for Flight
Purchase a flight offset
Offset emissions from airplane travel.
curl https://api.cloverly.com/2019-03-beta/purchases/flight \-X POST \-d '{"airports":["sfo","atl","fra"]}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/flight' req.body = '{"airports":["sfo","atl","fra"}'] req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/flight', body: JSON.stringify({"airports":["sfo","atl","fra"]}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"airports":["sfo","atl","fra"]}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/flight", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/flight'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"airports":["sfo","atl","fra"]}'r = requests.post(url, headers=headers, data=data)print(r.text)
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/flight");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"airports":["sfo","atl","fra"}']);curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string" }
Path attributes
none
Message body attributes
Required | |
---|---|
`airports: ["array", "of", "airport", "codes"] | An array of airport codes for the trip. The first airport should be the starting airport followed by the sequence of airports in the order of travel. |
Purchase Offset for Electricity
Purchase an electricity offset
Purchase Renewable Energy Credits to offset electricity use.
curl https://api.cloverly.com/2019-03-beta/purchases/electricity \-X POST \-d '{"energy":{"value":200,"units":"kwh"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/purchases/electricity' req.body = '{"energy":{"value":200,"units":"kwh"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/purchases/electricity', body: JSON.stringify({"energy":{"value":200,"units":"kwh"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = [] byte(`{"energy":{"value":200,"units":"kwh"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/purchases/electricity", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/electricity'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"energy":{"value":200,"units":"kwh"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/electricity");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"energy":{"value":200,"units":"kwh"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string" }
Path attributes
none
Message body attributes
Required | |
---|---|
`energy: {value: INTEGER, units: STRING}` | The energy used, where "units" is one of 'kwh' or 'wh' for "kilowatt-hours" and "watt hours," respectively. |
Cancel Purchases
Cancel an offset purchase
Cancel the purchase of an offset. It is not possible to cancel offsets once they have been retired.
curl https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug \-X DELETE \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.delete do |req| req.url '/2019-03-beta/purchases/:purchase_slug' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'delete', url: 'https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("DELETE", "https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.delete(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/purchases/:purchase_slug");curl_setopt($ch, CURLOPT_DELETE, 1);curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "purchased_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "pretty_url": "string"}
Path attributes
Required | |
---|---|
`purchase_slug` | The slug for the purchase |
Message body attributes
none
List Estimates
List all estimates for your account
Get the full list of estimates for the account.
curl https://api.cloverly.com/2019-03-beta/estimates \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/estimates' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/estimates', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/estimates", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
[ { "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string" }]
Path attributes
none
Message body attributes
Optional | |
---|---|
`offset_slug` | Filter to a specific offset |
`before` | epoch to choose the latest before a certain time (used for pagination) |
Show Estimate
Show details for a specific estimate
Get the full details of a specific purchase.
curl https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.get do |req| req.url '/2019-03-beta/estimates/:estimate_slug' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { url: 'https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("GET","https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.get(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
none
Create Fixed Price Estimate
Estimate an offset with a fixed price
Set the price you would like to pay. We'll calculate the amount of offsets available at that price.
curl https://api.cloverly.com/2019-03-beta/estimates/currency \-X POST \-d '{"currency":{"value":357,"units":"usd cents"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/currency' req.body = '{"currency":{"value":357,"units":"usd cents"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/currency', body: JSON.stringify({"currency":{"value":357,"units":"usd cents"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"currency":{"value":357,"units":"usd cents"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/currency", bytes.NewBuffer(requestData)) req.Header.Add("Content-type"], "application/json"]) req.Header.Add("Authorization"], "Bearer public_key:47800ea0ee541b4c"]) resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/currency'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"currency":{"value":357,"units":"usd cents"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/currency");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"currency":{"value":357,"units":"usd cents"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`currency: {value: INTEGER, units: STRING}` | The fixed amount to be estimated, where "units" can be one of `usd` or `usd cents`. |
Create Estimate for Carbon
Estimate an offset
Estimate an offset amount.
curl https://api.cloverly.com/2019-03-beta/estimates/carbon \-X POST \-d '{"weight":{"value":35,"units":"kg"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/carbon' req.body = '{"weight":{"value":35,"units":"kg"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/carbon', body: JSON.stringify({"weight":{"value":35,"units":"kg"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"weight":{"value":35,"units":"kg"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/carbon", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/carbon'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"weight":{"value":35,"units":"kg"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/carbon");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"weight":{"value":35,"units":"kg"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`weight: {value: INTEGER, units: STRING}` | The amount of carbon to offset where "units" can be `kg`, `grams`, or `pounds`. |
Create Estimate for Shipping
Estimate a shipping offset
Estimate an offset for emissions resulting from shipping something.
curl https://api.cloverly.com/2019-03-beta/estimates/shipping \-X POST \-d '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/shipping' req.body = '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/shipping', body: JSON.stringify({"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/shipping", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/shipping'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/shipping");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"from":{"zip":"35209"},"to":{"zip":"94043"},"weight":{"value":94,"units":"kg"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`weight: {value: INTEGER, units: STRING}` | The amount of carbon to offset |
Choose 1 of the following methods for calculating distance:
Using ZIP Codes | |
---|---|
`from: {zip: STRING}` | The origin zip code |
`to: {zip: STRING}` | The destination zip code |
Using Latitude-Longitude | |
---|---|
`from: {latlng: [FLOAT, FLOAT]}` | The origin latitude and longitude |
`to: {latlng: [FLOAT, FLOAT]}` | The destination latitude and longitude |
Using Distance | |
---|---|
`distance: {value: INTEGER, units: STRING}` | The distance where units can be "km" or "miles" |
Create Estimate for Ground Transportation
Estimate a vehicle offset
Estimate the offset for emissions from transportation in a vehicle that uses gasoline or diesel fuel.
curl https://api.cloverly.com/2019-03-beta/estimates/vehicle \-X POST \-d '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/vehicle' req.body = '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/vehicle', body: JSON.stringify({"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/vehicle", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/vehicle'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/vehicle");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"distance":{"value":55,"units":"km"},"fuel_efficiency":{"value":25,"units":"mpg","of":"gasoline"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`fuel_efficiency: {value: INTEGER, units: STRING, of: STRING}` | The fuel efficiency of the vehicle, where "units" is one of 'mpg' or 'km/l' and "of" is one of "gasoline" or "diesel". |
`distance: {value: INTEGER, units: STRING}` | The distance to offset, where "units" is one of "miles" or "km". |
Create Estimate for Flight
Estimate a flight offset
Estimate the offset for emissions from airplane travel.
curl https://api.cloverly.com/2019-03-beta/estimates/flight \-X POST \-d '{"airports":["sfo","atl","fra"]}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/flight' req.body = '{"airports":["sfo","atl","fra"}'] req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/flight', body: JSON.stringify({"airports":["sfo","atl","fra"]}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"airports":["sfo","atl","fra"]}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/flight", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/flight'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"airports":["sfo","atl","fra"]}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/flight");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"airports":["sfo","atl","fra"}']);curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`airports: ["array", "of", "airport", "codes"] | An array of airport codes for the trip. The first airport should be the starting airport followed by the sequence of airports in the order of travel. |
Create Create Estimate for Electricity
Estimate an electricity offset
Estimate the amount of Renewable Energy Credits needed to offset electricity use.
curl https://api.cloverly.com/2019-03-beta/estimates/electricity \-X POST \-d '{"energy":{"value":200,"units":"kwh"}}' \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.post do |req| req.url '/2019-03-beta/estimates/electricity' req.body = '{"energy":{"value":200,"units":"kwh"}}' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'post', url: 'https://api.cloverly.com/2019-03-beta/estimates/electricity', body: JSON.stringify({"energy":{"value":200,"units":"kwh"}}), headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt"import "bytes" func main() { client := &http.Client{} var requestData = []byte(`{"energy":{"value":200,"units":"kwh"}}`) req, _ := http.NewRequest("POST", "https://api.cloverly.com/2019-03-beta/estimates/electricity", bytes.NewBuffer(requestData)) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/electricity'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}data = '{"energy":{"value":200,"units":"kwh"}}'r = requests.post(url, headers=headers, data=data)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/electricity");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"energy":{"value":200,"units":"kwh"}}');curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
none
Message body attributes
Required | |
---|---|
`energy: {value: INTEGER, units: STRING}` | The energy used, where "units" is one of 'kwh' or 'wh' for "kilowatt hours" and "watt hours" perspectively. |
Cancel Estimate
Cancel an offset estimate
Cancel the estimate of an offset.
curl https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug \-X DELETE \-H "Content-type: application/json" \-H "Authorization: Bearer public_key:47800ea0ee541b4c"
require 'faraday'conn = Faraday.new(:url => 'https://api.cloverly.com')conn.delete do |req| req.url '/2019-03-beta/estimates/:estimate_slug' req.headers['Content-Type'] = 'application/json' req.headers['Authorization'] = 'Bearer public_key:47800ea0ee541b4c'end
const request = require('request');const options = { method: 'delete', url: 'https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug', headers: { 'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c' }};request(options, function(error, response, body) { console.log(body);});
package main import "net/http"import "io/ioutil"import "fmt" func main() { client := &http.Client{} req, _ := http.NewRequest("DELETE", "https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug", nil) req.Header.Add("Content-type", "application/json") req.Header.Add("Authorization", "Bearer public_key:47800ea0ee541b4c") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Printf(string(body[:]))}
import requestsurl = 'https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug'headers = {'Content-type': 'application/json', 'Authorization': 'Bearer public_key:47800ea0ee541b4c'}r = requests.delete(url, headers=headers)print(r.text)
< ?php$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "https://api.cloverly.com/2019-03-beta/estimates/:estimate_slug");curl_setopt($ch, CURLOPT_DELETE, 1);curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Authorization: Bearer public_key:47800ea0ee541b4c'));$r = curl_exec($ch);curl_close($ch);echo $r;
Response
{ "slug": "string", "environment": "string", "state": "string", "renewable_energy_certificate": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "renewable_type": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "deprecated": "string" }, "micro_rec_count": "number", "micro_units": "number", "offset": { "slug": "string", "name": "string", "city": "string", "province": "string", "country": "string", "offset_type": "string", "offset_type_slug": "string", "total_capacity": "string", "latlng": "string", "technical_details": "string", "available_carbon_in_kg": "string", "pretty_url": "string" }, "total_cost_in_usd_cents": "number", "estimated_at": "string", "equivalent_carbon_in_kg": "number", "electricity_in_kwh": "string", "rec_cost_in_usd_cents": "number", "transaction_cost_in_usd_cents": "number", "cost": { "currency": "string", "total": "string", "transaction": "string", "offset": "string" }, "pretty_url": "string"}
Path attributes
Required | |
---|---|
`estimate_slug` | The slug for the estimate |
Message body attributes
none
Account Info
Account Info
Use this to retrieve information about and the status of your account.
Response
{ "name": "string", "owner": { "name": "string", "email": "string" }, "balance_in_usd_cents": "number", "production_enabled?": "boolean", "environment": "string"}
Path attributes
none
Message body attributes
none
Error Codes
Error Codes
These are the possible error codes you might see and what they mean:
HTTP Status Code | Meaning | Cloverly Errors |
400 | Bad request | Insufficient credits for purchase |
Card error from Stripe | ||
Invalid currency amount | ||
Invalid airport code | ||
Invalid zip code | ||
Invalid postal code and country code | ||
Invalid request format | ||
Invalid units | ||
403 | Forbidden | Invalid API Key |
Account disabled | ||
404 | Not Found | Tranche not found |
Offset Type not found | ||
Offset Project not found | ||
Estimate not found | ||
Purchase not found | ||
No matching offset found to fulfill request |
Path attributes
none
Message body attributes
none