Calculate Flight Emissions
curl --request POST \
--url https://external.emissions.bnzgreen.io/api/calculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-body-signature: <x-body-signature>' \
--header 'x-platform-id: <x-platform-id>' \
--data '
{
"flights": [
{
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
}
]
}
'import requests
url = "https://external.emissions.bnzgreen.io/api/calculate"
payload = { "flights": [
{
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
}
] }
headers = {
"x-api-key": "<x-api-key>",
"x-body-signature": "<x-body-signature>",
"x-platform-id": "<x-platform-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-body-signature': '<x-body-signature>',
'x-platform-id': '<x-platform-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
flights: [
{
origin: '<string>',
destination: '<string>',
operatingCarrierCode: '<string>',
flightNumber: 123,
departureDate: {year: 123, month: 123, day: 123}
}
]
})
};
fetch('https://external.emissions.bnzgreen.io/api/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://external.emissions.bnzgreen.io/api/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flights' => [
[
'origin' => '<string>',
'destination' => '<string>',
'operatingCarrierCode' => '<string>',
'flightNumber' => 123,
'departureDate' => [
'year' => 123,
'month' => 123,
'day' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-body-signature: <x-body-signature>",
"x-platform-id: <x-platform-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://external.emissions.bnzgreen.io/api/calculate"
payload := strings.NewReader("{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-body-signature", "<x-body-signature>")
req.Header.Add("x-platform-id", "<x-platform-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.emissions.bnzgreen.io/api/calculate")
.header("x-api-key", "<x-api-key>")
.header("x-body-signature", "<x-body-signature>")
.header("x-platform-id", "<x-platform-id>")
.header("Content-Type", "application/json")
.body("{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.emissions.bnzgreen.io/api/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-body-signature"] = '<x-body-signature>'
request["x-platform-id"] = '<x-platform-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"flight": {
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
},
"emissionsGramsPerPax": {
"first": 123,
"business": 123,
"premiumEconomy": 123,
"economy": 123
}
}
]{
"error": 123,
"message": "<string>"
}Emissions Service
Fetch Flight Emissions
Fetch CO2 emissions for a flight journey
POST
/
api
/
calculate
Calculate Flight Emissions
curl --request POST \
--url https://external.emissions.bnzgreen.io/api/calculate \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-body-signature: <x-body-signature>' \
--header 'x-platform-id: <x-platform-id>' \
--data '
{
"flights": [
{
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
}
]
}
'import requests
url = "https://external.emissions.bnzgreen.io/api/calculate"
payload = { "flights": [
{
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
}
] }
headers = {
"x-api-key": "<x-api-key>",
"x-body-signature": "<x-body-signature>",
"x-platform-id": "<x-platform-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-body-signature': '<x-body-signature>',
'x-platform-id': '<x-platform-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
flights: [
{
origin: '<string>',
destination: '<string>',
operatingCarrierCode: '<string>',
flightNumber: 123,
departureDate: {year: 123, month: 123, day: 123}
}
]
})
};
fetch('https://external.emissions.bnzgreen.io/api/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://external.emissions.bnzgreen.io/api/calculate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flights' => [
[
'origin' => '<string>',
'destination' => '<string>',
'operatingCarrierCode' => '<string>',
'flightNumber' => 123,
'departureDate' => [
'year' => 123,
'month' => 123,
'day' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-body-signature: <x-body-signature>",
"x-platform-id: <x-platform-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://external.emissions.bnzgreen.io/api/calculate"
payload := strings.NewReader("{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-body-signature", "<x-body-signature>")
req.Header.Add("x-platform-id", "<x-platform-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.emissions.bnzgreen.io/api/calculate")
.header("x-api-key", "<x-api-key>")
.header("x-body-signature", "<x-body-signature>")
.header("x-platform-id", "<x-platform-id>")
.header("Content-Type", "application/json")
.body("{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.emissions.bnzgreen.io/api/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-body-signature"] = '<x-body-signature>'
request["x-platform-id"] = '<x-platform-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flights\": [\n {\n \"origin\": \"<string>\",\n \"destination\": \"<string>\",\n \"operatingCarrierCode\": \"<string>\",\n \"flightNumber\": 123,\n \"departureDate\": {\n \"year\": 123,\n \"month\": 123,\n \"day\": 123\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"flight": {
"origin": "<string>",
"destination": "<string>",
"operatingCarrierCode": "<string>",
"flightNumber": 123,
"departureDate": {
"year": 123,
"month": 123,
"day": 123
}
},
"emissionsGramsPerPax": {
"first": 123,
"business": 123,
"premiumEconomy": 123,
"economy": 123
}
}
]{
"error": 123,
"message": "<string>"
}Headers
API key for authentication
Signature of the request body signed with API secret (private key)
Unique identifier for the platform making the request
Body
application/json
List of flights to calculate emissions for
Show child attributes
Show child attributes
⌘I
