ESGentle API Documentation

Using the API

Getting Started

The ESGentle API allows users to retrieve detailed environmental scores by simply inputting a product's barcode. This service provides a comprehensive analysis of the product's environmental impact, including metrics such as carbon footprint, water usage, and overall sustainability rating.

Accessing the API

The API is designed for integration with retail systems, consumer apps, and sustainability platforms. You can start using the API by accessing the following base URL:

https://us-central1-esg-score-536c4.cloudfunctions.net

Authentication

All requests to the ESGentle API must include an x-api-key header with your API key. If you have lost your API key or need a new one, please contact support.

Examples:

Shell

curl --header "x-api-key: YOUR-API-KEY" --header "Content-Type: application/json" --request POST --data '{"barcode": "123456789013"}' "<https://us-central1-esg-score-536c4.cloudfunctions.net/apiV1GetEnvironmentalScoresExternal>"

JavaScript (Node.js)

const axios = require('axios');
const fetchEnvironmentalScores = async () => {
  try {
    const response = await axios.post(
      '<https://us-central1-esg-score-536c4.cloudfunctions.net/apiV1GetEnvironmentalScoresExternal>',
      { barcode: '123456789013' },
      { headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' } }
    );
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
};
fetchEnvironmentalScores();

Endpoints

POST /apiV1GetEnvironmentalScoresExternal

Fetch environmental scores for a product based on its barcode.

Request

Headers

x-api-key: <your_api_key>
Content-Type: application/json