CO2 REMOVAL API

Tutorial and showcase of the basic API functions in our sandbox*

*Note: All requests on this page are done live, using our sandbox environment which does not have a 100% uptime

Tender

Initialization of the API always start through the tender offer request, which returns available offers for your organization. Offers available are based on your agreement with Removement AB. There are different types of tenders and multiple currencies supported, but in this demo we will only show basic "portfolio" options.

All requests to the API requires a personal api id (linked to your orgaization) and an authorization token. For testing the API in our sandbox environment, use:

  • Header: {'Authorization':'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M','X-Api-Key':'T3ST-T3ST-T3ST-T3ST'}
  • Url: https://dev.removement.org

/tender returns list of tenders with items and prices. While loading this page, you automatically requested the tender for our api test user. Returning:

Javacript

headerParams = {'Authorization':'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M',
                'X-Api-Key':'T3ST-T3ST-T3ST-T3ST'};
$.ajax({
   type: 'GET',
   url: 'https://dev.removement.org/tender/',
   data: '',
   crossDomain: true,
   dataType: 'json',
   cache: false,
   headers: headerParams,
}).done(function(response) {
  console.log(response.data);
});
      
Python

import requests
url = 'https://dev.removement.org'
header = {'Authorization': 'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M',
          'X-Api-Key':'T3ST-T3ST-T3ST-T3ST'}
r = requests.get(url+'/tender/',
                verify=True,
                headers=header,
                params={})
print(r.json()['data'])
      
Console

curl --location --request GET 'https://dev.removement.org/tender/' \
--header 'Authorization: Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M' \
--header 'X-Api-Key: T3ST-T3ST-T3ST-T3ST' \
--header 'Content-Type: application/json' \
--data-raw '{}'
      

Sell carbon removal through your platform

After initalization using /tender, the api can return portfolio content for display or storage. Below we supply the code for a simple purchase box.

By parsing the tender object to extract the porfolio id, we use get /portfolio to get the porfolio constituents and details.
/portfolio returns both weights and descriptions in multiple languages. All information shown in the order form below:

  • Portfolio name
  • Portfolio description
  • Methods in the porfolio as well as weights
  • Detailed information on each method
  • Note: the price and available portfolios was returned in /tender

Portfolio price /

Your tonnage

Your price

Change portfolio










NOTE: DESIGN WORK IN PROGRESS
Javacript

/* Get tenders applicable for the user */
headerParams = {'Authorization':'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M',
                'X-Api-Key':'T3ST-T3ST-T3ST-T3ST'};
$.ajax({
   type: 'GET',
   url: 'https://dev.removement.org/tender/',
   data: 'apiId=T3ST-T3ST-T3ST-T3ST&language=EN',
   crossDomain: true,
   dataType: 'json',
   cache: false
}).done(function(response) {
  /* Loop tenders and plot portfolios */
  var i = 0;
  var tenders = Object.keys(response.tenders);
  [portfolioId, uom, price, currency] = parsePortfolio(response,tenders,i);
  updatePortfolio(portfolioId,uom,price,currency);

  $("#next-portfolio").click(function() {
    i = i+1
    if (i == tenders.length) {
      i = 0;
    }
    [portfolioId, uom, price, currency] = parsePortfolio(response,tenders,i);
    updatePortfolio(portfolioId,uom,price,currency);
  });
});
Python

# portfolioId must exist in your tender response
import requests
header = {'Authorization': 'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M'}
url = 'https://dev.removement.org'
param = {'apiId':'T3ST-T3ST-T3ST-T3ST',
         'portfolioId':2}
r = requests.get(url+'/portfolio/', verify=True, headers=header, params=param)
print(r.json())
      

Purchase of CO2 Removal through the API

Using the tender id (from /tender) an order can be placed using the API. Placing an order for CO2 removal is done with the /purchase request with:

  • API Owner (api id) is the owner of the purchase process and the api integration
  • User id (optional) is the owner of the CO2 removal, but can also be a specific cost center within the organization
  • Tender id
  • Amount of the unit of measure (UOM) supplied in the tender, e.g. number of ton
  • External transaction id (optional) is your transaction id. For reporting purposes

There is also an option to make reservations, that later can be committed into purchases. This is not covered in this tutorial



/purchase request content:
Need to press the button...


/purchase confirmation:
Need to press the button...

Javacript

$("#buy-one-ton").click(function() {
  headerParams = {'Authorization':'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M',
                  'X-Api-Key':'T3ST-T3ST-T3ST-T3ST'};
  data = { tenderId:'7',
           userId:'buyOneCustomerName',
           amount: '1' }
  $.ajax({
     type: 'POST',
     url: 'https://dev.removement.org/purchase/',
     data: data,
     crossDomain: true,
     dataType: 'json',
     cache: false,
     headers: headerParams,
  }).done(function(response) {
    console.log(response);
    alert("Allocation has been done")
  });
});

      
Python

import requests
import json
url = 'https://dev.removement.org'
header = {'Authorization': 'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M'}
param = {'apiId':'T3ST-T3ST-T3ST-T3ST',
         'tenderId':7,
         'userId':'buyOneCustomerName',
         'amount':1}
r = requests.post(url+'/purchase/',
                verify=True,
                headers=header,
                params=json.dumps(param))
print(r.json())
      
Console


curl --location --request POST 'https://dev.removement.org/purchase/' \
--header 'Authorization: Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M' \
--header 'X-Api-Key: T3ST-T3ST-T3ST-T3ST' \
--header 'Content-Type: application/json' \
--data-raw '{
 "externalId": "12345667",
 "userId": "abc123",
 "tenderId": "7",
 "amount": 0.9417
}'
      

Reporting of CO2 purchases

The API allows reporting on previous purchases and statuses. This tutorial handles only one basic reporting style, on the transactional level. There are many more reporting options available allowing for e.g. aggregation and time window selection.

After an API purchase is made, the transaction is completed with an invoice sent to your organization/users (not part of the API). When the invoice has been payed, the purchase is allocated to the CO2 removal methods according to the porfolio.

When the purchase process is completed, you can track the order in our ledger (using API or by webpage) exposing each purchase to specific batches with our CO2 removal suppliers with full transparency.



/getHistory returns the raw transactions for your organization id. Press the button for an updated report:



Javacript

        headerParams = {'Authorization':'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M','X-Api-Key':'T3ST-T3ST-T3ST-T3ST'};
$.ajax({
    type: 'GET',
    url: 'https://dev.removement.org/orgTransactions/',
    data: 'language=EN',
    crossDomain: true,
    dataType: 'json',
    cache: false,
    headers: headerParams,
}).done(function(response) {
    console.log(response.data);
    /* print to table ... */
});
      
Python

import requests
url = 'https://dev.removement.org'
header = {'Authorization': 'Token R3M0V3M3NT-R3M0V3M3NT-R3M0V3M3NT-R3M0V3M'}
param = {'apiId':'T3ST-T3ST-T3ST-T3ST'}
r = requests.get(url+'/orgTransactions/',
                verify=True,
                headers=header,
                params=jparam)
print(r.json())
      

Security, Scalability & Deployment

Security

Altough the sandbox version of the API is deployed without high level of security, the production versions are securied with:

  • Additional token requirement in all requests
  • Organization specific id, hash code (API id)
  • HTTPS transfers
  • Option to deploy a dedicated environment

Scaling

The CO2 removment API is built with scaling in mind, using elastic load balancing and cache to improve speed.


Deployment

Our development environment is open for sandbox testing. Contact us for api keys, tokens, url and complete documentation for your deployment.