The GreenSwapp Trial API
0.8.0

What products can you search for?

This trial API is free to test on any type or brand of milk - from oat milk to full-fat milk, and Nestle to Oatly. The full version can be purchased.

Milk

Product name format

Just search for the full product name as it appears on the package. As long as you clearly state what type of milk it is in English, our AI can figure out what you mean and return the correct carbon footprint per liter of your milk product along with a comparison to the average cow's milk sold in the world. Don’t worry about the format - it is up to you if you want to enter any additional information such as the brand name, the volume of the product, price, barcode number, etc.

What recipes can you search for?

This trial API is free to test on any type of pizza. The full version can be purchased.

Pizza

Recipe name format

Simply search for any pizza's name - such as Quattro formaggi pizza or Tartufo pizza. Two things to keep in mind -

  1. Make sure to use the word "pizza" in the search terms.
  2. Just make sure the search term isn't too generic like "Tony's special pizza" which doesn't tell us what type of pizza it is, we'll be able to find the ingredients, and their quantities.

Free trial limit

You can test our API for free up to 20 milk products (or SKUs) and 5 pizza recipes. If you like it and want more, simply drop your credit card details and get an API key to access our full dataset of product and recipe CO2 values.

REST API

The GreenSwapp API is organized around REST. Our API has predictable resource-oriented URLs, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Want to learn more? → Go to our website: GreenSwapp.

This is the documentation for version 0.8.0 of the API. Last update on Oct 5, 2022.

Base URL
https://trial.greenswapp.com

Authentication

X api key (http_api_key)

Pass x-api-key in your HTTP header

  • The GreenSwapp API uses API keys to authenticate requests. You can get API keys by contacting GreenSwapp.
  • Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
  • Every incoming request to the API must contain an API key. You can use API key by passing the API key as the x-api-key in HTTP header of each incoming HTTP request.
  • All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Example with cURL:

   curl \
   -X GET https://trial.greenswapp.com/product?product=Oatly+Oat+Milk+Barista+Edition \
   -H "x-api-key: wURhYA73Ix6UeJzMv1hDB5mRmD0CU"

Example with Postman:

Postman

Run in Postman


Query parameters

  • product string Required

    Product name in English (any format)

Responses

  • 200 object
    1. Carbon footprint per liter of the milk
    2. Difference in impact (% higher or lower) between the queried product and average milk sold in the world
GET /product
curl \
 -X GET https://trial.greenswapp.com/product?product=Oatly+Oat+Milk+Barista+Edition \
 -H "x-api-key: $API_KEY"
Response example (200)
{
  "product_name": "Oatly Oat Milk Barista Edition",
  "kg_co2_per_kg": 0.36,
  "percentage_impact_difference": "This product has a 87% lower impact than the average regular milk",
  "status": "OK"
}

Query parameters

  • recipe string Required

    Recipe name in English

Responses

  • 200 object
    1. Carbon footprint per serving of the recipe
    2. Is the recipe climate-friendly or not (as per the Paris Climate Agreement)?
GET /recipe
curl \
 -X GET https://trial.greenswapp.com/recipe?recipe=Pizza+Hut+Original+Pan+Pizza \
 -H "x-api-key: $API_KEY"
Response example (200)
{
  "recipe_name": "Pizza Hut Original Pan Pizza",
  "kg_co2_per_kg": 2.65,
  "climate_friendly": "NO",
  "status": "OK"
}