GoClimate API Reference

Introduction

The GoClimate API is organized around REST. It has resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Calculation Model

The GoClimate API uses IATA-airport codes of a route to calculate the CO2-emissions. You can read more about how the calculation is done here.

Client libraries

We do not provide official client libraries. However, here's a list of community libraries:

Authentication

The GoClimate API uses API keys to authenticate requests. Get your API key by requesting one.

Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value and leave the password empty. Authentication is required for all endpoints.

Errors

GoClimate uses conventional HTTP status codes to indicate the success or failure of API requests.

Summary of HTTP status codes used by the GoClimate API:

Resources

Flight Footprint

Calculates estimated footprint per passenger for flights.

Retrieving flight footprint

Retrieve estimated footprint for one flight. If you need to calculate footprint for a trip with multiple legs, retrieve the estimated footprint for each leg and sum estimated footprint for each to create a total for the full trip.

Endpoint:

GET /v1/flight_footprint

Request parameters:

Response attributes:

Errors:

Example

Request:

$ curl https://api.goclimate.com/v1/flight_footprint \
  -u YOUR_API_KEY: \
  -d 'segments[0][origin]=ARN' \
  -d 'segments[0][destination]=BCN' \
  -d 'segments[1][origin]=BCN' \
  -d 'segments[1][destination]=ARN' \
  -d 'cabin_class=economy' \
  -d 'currencies[]=SEK' \
  -d 'currencies[]=USD' \
  -G

Response:

{
  "footprint": 1400,
  "offset_prices": [
    {
      "amount": 4000,
      "currency": "SEK"
      "offset_url":"https://www.goclimate.com/se/flight_offsets/new?offset_params=economy%2CARN%2CBCN%2CBCN%2CARN",
      "locale":"sv-SE"
    },
    {
      "amount":400,
      "currency":"USD",
      "offset_url":"https://www.goclimate.com/us/flight_offsets/new?offset_params=economy%2CARN%2CBCN%2CBCN%2CARN",
      "locale":"en-US"
    }
  ],
  "details_url": "https://www.goclimate.com/flight_offsets/new?offset_params=economy%2CARN%2CBCN%2CBCN%2CARN"
}