THG More Trees Logo Login

API

Overview

The More Trees public API with basic authorisation, allows you to retrieve information from More Trees and send tree planting requests.

If you require any support, please email info@moretrees.eco.


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.


Tree list/ tree identifier

Use the appropriate TreeIdentifier when setting up the 'plant a tree' API.

Project Type TreeIdentifier CO2 Credits
Any project Most needed tree any_tree 0.3 1
Madagascar Most needed tree most_needed_madagascar 0.3 1
Kenya Most needed tree most_needed_kenya 0.3 1
Haiti Most needed tree most_needed_haiti 0.3 1

View credits

GET

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

Get total number of available credits.

Headers

Key Value
authorization Public validation key
Additional information

You can find the public validation key under Integration → API on the platform https://plant.moretrees.eco/manage/API

Response

Successful response

200

            
{
  "status": 1,
  "response": "successful",
  "message": "Total {number} credits are available.",
  "data": {
    "credits": {number}
  }
}
            
        

Error response

400

            
{
  "errors": [
    {
      "status": 0,
      "response": "error",
      "message": "{Error message from server}"
    }
  ]
}
            
        

Retrieve total carbon sequestration

GET

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

Get set of total carbon sequestration, including carbon sequestration by self, for others, by others on your behalf, and total.

Headers

Key Value
authorization Public validation key
Additional information

You can find the public validation key under Integration → API on the platform https://plant.moretrees.eco/manage/API

Response

Successful response

200

            
{
    "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

400

            
{
  "errors": [
    {
      "status": 0,
      "response": "error",
      "message": "{Error message from server}"
    }
  ]
}
            
        

View tree types

GET

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

Get all active tree types with details including Project Name, Project ID, Category Name, Category ID, Type ID, Type Name, Type Description, Type Image, CO2 Reduction and required credits to plant this tree type.

Headers

Key Value
authorization Public validation key
Additional information

You can find the public validation key under Integration → API on the platform https://plant.moretrees.eco/manage/API

Query Parameters

Parameter Description
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

Passed page parameter

200

            
{
  "status": 1,
  "response": "successful",
  "message": "Carbon offset found.",
  "data": [
    {
      {List of all types with 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}
    }
  ]
}
            
        

No page parameter

200

            
{
  "status": 1,
  "response": "successful",
  "message": "Carbon offset found.",
  "data": {
      {List of all types with details}
    },
}
            
        

Error response

400

            
{
  "errors": [
    {
      "status": 0,
      "response": "error",
      "message": "{Error message from server}"
    }
  ]
}
            
        

Plant a tree

POST

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

Send a request to plant a tree or multiple trees for the user, or to third parties.

Additional information

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

Headers

Key Value
authorization Public validation key
Additional information

You can find the public validation key under Integration → API on the platform https://plant.moretrees.eco/manage/API

Body

Position: JSON object

Parameter Description
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 1 or 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 as this parameter detailed in the example snippets below.

Single user

            
{
  "first_name": "John",
  "email": "john@example.ecom",
  "quantity": 8,
  "sender_name": "[name] (optional)"
}
            
        

Multiple users

            
[
  {
    "first_name": "John",
    "email": "john@example.ecom",
    "quantity": 8,
    "sender_name": "[name] (optional)"
  },
  {
    "first_name": "Adam",
    "email": "adam@example.ecom",
    "quantity": 5
  }
]
            
        

Response

Successful response

200

            
{
  "status": 1,
  "response": "successful",
  "message": "Plant tree request submitted successfully",
  "data": {
    "certificates": [
      {
        "name": "John",
        "email": "john@example.ecom",
        "certificateID": "e66lq7dwkhbz5959e66lq7dwkhbz595a",
        "certificateURL": "https://login.thgcarboncapture.com/certificate/e66lq7dwkhbz5959e66lq7dwkhbz595a"
      },
      {
        "name": "Adam",
        "email": "adam@example.ecom",
        "certificateID": "e66lq7dwkhbz5959e66lq73rwy5cda3u",
        "certificateURL": "https://login.thgcarboncapture.com/certificate/e66lq7dwkhbz5959e66lq73rwy5cda3u"
      }
    ]
  }
}
            
        

Error response - parameters not passing correctly

400

            
{
  "errors": [
    {
      "msg": "{parameter name} is not valid or missing",
      "param": "error",
      "location": "body"
    }
  ]
}
            
        
Additional information

Error responses will have individual error messages for every missing/invalid parameter.

Error response - 'users' object parameter has errors

400

            
{
  "errors": [
    {
      "status": 0,
      "response": "error",
      "param": "users",
      "msg": "users object is not valid! Or missing parameter (name, email, quantity)"
    }
  ]
}
            
        

Get account information

GET

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

Headers

Key Value
authorization Public validation key
Additional information

You can find the public validation key under Integration → API on the platform https://plant.moretrees.eco/manage/API

Response

Successful response

200

            
{
  "message": "successfully",
  "data": {
    "credits": 19,
    "forest_name": "Alan",
    "saved_co2": 25.2,
    "quantity_planted": 31,
    "quantity_gifted": 53,
    "quantity_received": 88,
    "forest_url": "https://www.moretrees.eco/forest/Alan/"
  }
}
            
        
MoreTrees Logo Copyright by Eco Credits Limited, t/a More Trees by THG Eco - 2023