Api Documentation

Authentication

The API uses an key to authenticate requests.

You must include an API key with every API request. In the following example, replace YOUR_API_KEY with your API key.

If you account is set to invoice. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code etc.

In order to make a request the API key must be passed with the request as part of the header . Curl example url -X --header 'apiKey: YOUR_API_KEY'

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Call Flow INVOICE

To make a successful purchace you need to make 3 calls. Calculation, Customer Update, Final Purchace

In order to make a susccess offset the following calls need to be made.

Call Flow Pay As You Go

To make a successful purchace you need to make 3 calls. Calculation, Customer Update, Redirect to cart (Url returned via the update call)

In order to make a susccess offset the following calls need to be made.

Calculation

The calcualtion request can be any of the end points currently supported, see the interactive API for an example.

Request example
{
"Description": "What to offset",
"Unit": "Kg",
"Co2Amount": 1000,
"Reference": "My Ref",
"CurrencyCode": "GBP"
}

Response example
{
"QuoteId": "carbon-36eecede-dbea-bd54-9acfc6dd9fd5-clevel",
"Co2Total_Kg": 1000,
"Co2Total_Tonne": 1,
"TotalPrice": 14.37,
"CurrencyCode": "GBP",
"QuoteExpiry": "2024-05-20 05:38:34Z"
}

Customer Update

Request example
{
"QuoteId": "carbon-36eecede-dbea-bd54-9acfc6dd9fd5-clevel",
"CertificateSendEmail": "[email protected]",
"Personalisation": "certificate name",
"SendCertificate": true,
"Reference": "my ref"
}

Response example
{
"QuoteId": "carbon-36eecede-dbea-bd54-9acfc6dd9fd5-clevel",
"Updated": true,
"CheckOutUrl": "https://stripe?verylongquerystring",
"TransactionSuccessUrl": "localhost?oid=123",
"TransactionCanclledUrl": "localhost?c=y"
}

Purchace

Request example
{ "QuoteId": "carbon-36eecede-dbea-bd54-9acfc6dd9fd5-clevel" }

Please note on the sandbozx the certificates are not generated and the link will not work.

Response example
{
"QuoteId": "carbon-36eecede-dbea-bd54-9acfc6dd9fd5-clevel",
"StripeSessonId": null,
"Description": "What to offset",
"CertificatePdfBuilt": false,
"CertificateDownloadUrl": "https://certificate.c-level.earth/certificate/index/7341d403-0222-41a0-9234-05cfc5721490",
"Co2Total_Kg": 1000,
"Co2Total_Tonne": 1,
"TotalTrees": 0,
"QuoteUniqueNumber": 1,
"QuoteUniqueDiscription": "Tonnes of CO2 offset",
"TotalPrice": 14.37,
"CurrencyCode": "GBP",
"PurchaseDate": "2022-02-09T18:14:25.9494429+00:00",
"Approved": true
}

The download certificate is not genberated at the response time, but will be built within 15 mins, you can poll the certificate status via a Get request

Certificate Status

Request example
http://localhost:57096/v1/certificate/status/carbon-36eecede-dbea-418c-bd54-9acfc6dd9fd5-clevel Response example
{
"PurchaseDate": "2022-02-10T12:49:32.3280914+00:00",
"CertificateDownloadUrl": "https://certificate.c-level.earth/certificate/index/carbon-36eecede-dbea-418c-bd54-9acfc6dd9fd5-clevel",
"Downloadable": false
}

Combine

This allows an array of quotes to be combined and processed as a single transaction, it is also possable to add quotes to an already prodcued combined quote.

It is not possable to combine one or more combined quotes

This function is still in development and may not be fully functional, if you encounter any bugs please report them back to CLevel

C Level Carbon Balance Api, for access and an api key contact [email protected]

Part of C Level

About C Level

Created the term Carbon Footprint Carbon Balanced is deeper than Carbon Offsetting Natural powers of indigenous forests & peoples Creating Narrative & Film

Learn more »

Our Projects

Balancing carbon footprints with the world's best indigenous forest & community projects

Learn more »

Contact Us

Carbon Balanced by C Level means projects bringing together the natural powers of ecosystems and people to bring CO2 down to earth.

Learn more »