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, in your account, under Settings.


API Request Headers

Key Value Description
Idempotency-Key [string] (optional) Unique token that guarantees that only one resource will be created regardless of how many times a request is sent
Accept application/json
Content-Type application/json
Accept-Encoding gzip, deflate

API Response Codes

Code Description
200 OK Standard response for successful HTTP requests.
201 Created The request has been fulfilled, resulting in the creation of a new resource.
400 Bad Request The server cannot or will not process the request due to an apparent client error. The client SHOULD NOT repeat the request without modifications.
401 Unauthorized Indicates that the request requires user authentication information. The client MAY repeat the request with a suitable Authorization header field.
403 Forbidden Client access to the requested resource was forbidden. Unlike 401 Unauthorized, the client's identity is known to the server.
404 Not Found The server can not find the requested resource.
429 Too Many Requests The user has sent too many requests in a given amount of time (“rate limiting”).
500 Internal Server Error The server encountered an unexpected condition that prevented it from fulfilling the request

GET Account Information

GET

https://user-management-service.platform.moretrees.eco/user-management-api/external/accounts/{account_code}

Additional Headers

Key Value
X-API-KEY API Key
Additional information

You can find your API key & Account code under Settings → Account Settings on the platform https://platform.moretrees.eco/settings/?tab=account-settings

Response

Successful response

200

            
{
    "account_name": "More Trees",
    "credit_balance": 123,
    "forest_name": "Forest_name",
    "forest_slug": "Forest_slug"
}
            
        

Get Forest Information

GET

https://user-management-service.platform.moretrees.eco/user-management-api/external/forest/{forest_slug_or_account_code}

Get forest data including branding and plantation statistics.

Additional information

You can find your Account code or Forest Slug under Settings → Account Settings on the platform https://platform.moretrees.eco/settings/?tab=account-settings

Response

Successful response

200

            
{
    "forest_name": "THG",
    "logo_url": "https://example.com/123.png",
    "brand_color": "#000000",
    "totals": {
      "trees_planted": 123,
      "trees_gifted": 12,
      "trees_received": 1,
      "co2_captured": 21,
      "projects_supported": 2
    }
}
            
        

Get Project Information

GET

https://project-management-service.platform.moretrees.eco/project-management-api/external/projects

Get all active Projects with details including name, ID, description and Country. Along with a list of trees you can plant for that project.

Additional information

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

Response

Successful response

200

            
[
    {   
        "id": 1
        "name": "Green Tree Reforestation",
        "description": "abc...",
        "country": "Germany",
        "project_type": "Mangrove",
        "supplier_name": "Eden",
        "default": true,
        "project_image":"https://url"
        "trees": [
            {
              "id": 1,                
              "name": "Bald cypress",
              "description": "Look out for the female catkins - small brown cones that stay on the tree all year round.",
              "tonnes_c02": 0.3,
              "credits_required": 2,
              "default": true,
              "tree_image":"https://url"
            }
        ]
    }
]
            
        

Plant a tree

POST

https://transaction-management-service.platform.moretrees.eco/transaction-management-api/external/plant

Send a request to plant a tree or multiple trees for the yourself or for others.

Additional Headers

Key Value
X-API-KEY API Key
Additional information

You can find your API key under Settings → Account Settings on the platform https://platform.moretrees.eco/settings/?tab=account-settings

Request Body

JSON object

Parameter Type Description
payment_account_code (required) [String] Account code of the payment account.
test (optional) [Boolean] FALSE => Disable test mode - requests will be evaluated & actioned. TRUE => Enable test mode - the request will be evaluated as normal, however, no changes will be persisted (e.g. dry run). Default value = FALSE.
plant_for_others (required) [Boolean] FALSE => Plant trees for the payment_account_code (e.g. plant for self). TRUE => Plant trees for others (e.g. gifts)
quantity (required if plant_for_others = FALSE) [Integer] The total quantity of trees to be planted - must be greater than 0.
project_id (optional - if omitted, the default project will be selected) [Integer] The id of the project you want to plant - See GET Project Details for more info.
tree_id (optional - if omitted, the default tree will be planted) [Integer] The id of the tree to be planted - see GET Project Information for more info.
recipients (required if plant_for_others = TRUE) [Array] An array of objects containing recipient details - see Recipient Details for more info.

Recipient Details

Parameter Type Description
account_code (required if not using email parameter) [String] The corresponding account code for the recipient of the tree.
email (required if not using account_code parameter) [String] The email address for the recipient of the tree.
name (required) [String] The recipients name.
quantity (required) [Integer] The quantity of trees to be planted for the recipient.

Example Requests

Plant for self

            
{
  "payment_account_code":"TL14MD",
  "test": false,
  "plant_for_others": false,
  "quantity": 1,
  "project_id": 1,
  "tree_id": 1
}
            
        

Plant for others

            
{
  "payment_account_code":"TL14MD",
  "test": true,
  "plant_for_others": true,
  "project_id": 1
  "recipients": 
  [
    {
      "email": "janedoe@email.com",
      "name": "Frank",
      "quantity": 1
    },
    {
      "account_code": "ACE2MK",
      "name": "Jim",
      "quantity": 1
    },
  ]
}
            
        

Response

Successful response - plant for self

201

            
{
  "test": false,  
  "plant_for_others": false,
  "credits_used": 2,
  "credits_remaining": 2,
  "project_id": 1,
  "tree_id": 1
}
            
        

Successful response - plant for others

201

            
{
  "test": true, 
  "credits_used": 2,
  "credits_remaining": 2,
  "project_id": 1,
  "tree_id": 1,
  "recipients": 
  [
    {
      "account_code": "A1AB2B",
      "account_name": "abc",
      "quantity": 1
    },
    {
      "account_code": "ACE2MK",
      "account_name": "def",
      "quantity": 1
    },
  ]
}
            
        
MoreTrees Logo Copyright by Eco Credits Limited, t/a More Trees by THG Eco - 2023