Knowledge base

API

Overview

The (more:trees) public API with basic authorization, allows you to retrieve information from (more:trees) and send tree planting requests.
 
If you require any support, please email [email protected]

Before you begin

  1. If not already done so, create a (more:trees) account 
  2. Follow the onboarding instructions

API keys

Access the public validation and public API keys via the platform (Integration > API)

Tree list / tree identifier

Use the appropriate TreeIdentifier when setting up the ‘plant a tree’ API

ProjectTypeTreeIdentifierCO2Credits
Any projectMost needed treeany_tree0.31
MadagascarMost needed treemost_needed_madagascar0.31
KenyaMost needed treemost_needed_kenya0.31
HaitiMost needed treemost_needed_haiti0.31

API – view credits

Description

This API will provide the total number of available credits or an error message.

Endpoint

https://api.moretrees.eco/v1/basic/viewCredits

Method
GET

Authorization

Type: API key
Key: authorization
Value: Public validation key (you can find this under Integration > API on the platform (https://plant.moretrees.eco/manageAPI)

Parameters
N/A

Response
Successful Response
{
“status”: 1,
“response”: “successful”,
“message”: “Total {Number of counts } credits are available.”,
“data”: {
“credits”: {Number of count}
}
}

Error Response
{
“errors”: [
{
“status”: 0,
“response”: “error”,
“message”: “{Errors message from server}”
}
]
}

API – retrieve total carbon sequestration

Description

This API will return the result set of total carbon sequestration.

The result set will have carbon sequestration by self, for others, by others on your behalf, and total.

Endpoint
https://api.moretrees.eco/v1/basic/carbonOffset

Method

GET

Authorization

Type: API key,
Key: authorization
Value: Public validation key (you can find this under Integration > API on the platform (https://plant.moretrees.eco/manageAPI)

Parameters
N/A

Response
Successful Response
{
“status”: 1,
“response”: “successful”,
“message”: “Carbon offset found.”,
“data”: {
“carbon_offset_by_self”: carbon offset done by self,
“carbon_offset_for_others”: carbon offset done for others,
“carbon_offset_by_others_for_you”: carbon offset done by others for you ,
“total_carbon_offset”: total carbon offset
}
}

Error Response
{
“errors”: [
{
“status”: 0,
“response”: “error”,
“message”: “{Errors message from server}”
}
]
}

 

API – view types (trees)

Description
This API will provide you with all active types(trees) with details including Project Name, Project ID, Category Name, Category ID, Type ID, Type name, Type Description, Type Image, reducing co2 and required credits to plant this type(tree).

Endpoint
https://api.moretrees.eco/v1/basic/viewTypes

Method

GET

Authorization

Type: API key,
Key: authorization
Value: Public validation key (you can find this under Integration > API on the platform (https://plant.moretrees.eco/manageAPI)

Parameters
Position: Query Parameters
Parameter:

Page:

(optional)

You can pass integer value in this or “all” string. If integer value is passed then API considers this as a page number. This parameter enables paginating functionality for API and API will behave according to the page number. If you want all records without paginating results then simply pass “all” or don’t pass the page parameter.

Response

Successful Response

If Page parameter passing correctly

{

“status”: 1,

“response”: “successful”,

“message”: “Carbon offset found.”,

“data”: {

[

List of All Types with its details, 

],

[

{

“total_records”: total records found,

“current_page”: page parameter value,

“total_pages”: total number of page available

“records_per_page”: per page displaying records

}

]

}

}

 If Page parameter don’t pass correctly

 {

“status”: 1,

“response”: “successful”,

“message”: “Carbon offset found.”,

“data”: {

List of All Types with its details.

}

}

Error Response

{

“errors”: [

{

“status”: 0,

“response”: “error”,

“message”: “{Errors message from server}”

}

]

}

 

API – plant a tree

Description
This API will send a request to plant a tree, or multiple trees for the user or to third parties.

Note that when planting a tree for a third party, the third party will receive an email about their tree. This email can be customized in the platform settings (settings > email template).

Endpoint
https://api.moretrees.eco/v1/basic/planttree

Method

POST

Authorization

Type: API key,
Key: authorization
Value: Public validation key (you can find this under Integration > API on the platform (https://plant.moretrees.eco/manageAPI)

Parameters

Position: body – JSON object

Parameters

type_slug

(Required)

This parameter will accept tree slug (you can download the tree slug list from the platform (Integration > API > Tree list). If the wrong slug is passed it will return an error message in response. The type_slug is also called treeidenitfier on some files

request_type

(Required)

There are two types available for request_type parameter. You need to pass 1 if you are planting tree for self or pass 2 if you are planting tree for others. If you pass any other number (except 1or 2) then error message will be returned in response.

quantity

(Required if request_type is 1)

If planting trees for self, the quantity of the trees pass with this parameter. This will only accept numerical values greater than zero. If 0, null and any other string will not be accepted.

users

(Required if request_type is 2)

If planting tree for others, you must pass a json object in this parameter like:-

{

{

“first_name”:”John”,

“email”:”[email protected]”,

“quantity”:8,

“sender_name”:[name] (optional),

}

}

if planting tree for multiple users, you can pass multiple value in JSON object like

{

{

“first_name”:”John”,

“email”:”[email protected]”,

“quantity”:8

“sender_name”:[name] (optional),

},

{

“first_name”:”Adam”,

“email”:”[email protected]”,

“quantity”:5

}

}

  

Response

Successful Response
{
“status”:1,
“response”:”successful”,
“message”:”Plant tree request submitted successfully”,
“data”: {
“certificates”:[
{
“name”:”John”,
“email”:”[email protected]”,
“certificateID”:”e66lq7dwkhbz5959e66lq7dwkhbz595a”,
“certificateURL”:”https://login.thgcarboncapture.com/certificate/e66lq7dwkhbz5959e66lq7dwkhbz595a”
},
{
“name”:”Adam”,
“email”:”[email protected]”,
“certificateID”:”e66lq7dwkhbz5959e66lq73rwy5cda3u”,
“certificateURL”:”https://login.thgcarboncapture.com/certificate/e66lq7dwkhbz5959e66lq73rwy5cda3u”
}]
}
}

Error Response

If parameters are not passing correctly
{
“errors”: [
{
“msg”: {parameter name} is not valid or missing,
“param”: “error”,
“location”: “body”
}
]
}
error response will have individual error messages for every missing/invalid parameter.

If request is sending for multiple users and “users” parameter (JSON object) has errors
{
“errors”: [
{
“status”:0
“response”: “error”,
“param”: “users”,
“msg”: “users object is not valid! Or missing parameter (name, email, quantity)”
}
]
}

 

API – get account information

 

API endpoint: API endpoint: https://api.moretrees.eco/v1/basic/getInfo 
Method: GET
Authorization headers:
Type: API key
Key: authorization
Value: Public validation key

Success response:
{
“message”: “successfully”,
“data”: {
“credits”: 19,
“forest_name”: “Alan”,
“saved_co2”: 25.2,
“quantity_planted”: 31,
“quantity_gifted”: 53,
“quantity_received”: 88,
“forest_url”: https://moretrees.eco/forest/Alan/
}
}

 

Still need help?

Please email [email protected] and we’ll be happy to assist.