Plant Trees

Looking to plant trees through your app or automate environmental action? Our Tree Planting API enables developers and businesses to plant trees programmatically with a simple API call. Whether you're integrating this into a website, mobile app, or backend system, this endpoint makes it easy to contribute to global reforestation.

You can plant trees for your own organization or on behalf of your customers. To engage customers and help them see their personal contribution, include the customer_email in your request. After planting, we'll automatically send them an email with a secure link to track their impact in real time via a personalized dashboard.


POST/v1/plant_tree

Plant trees

This endpoint enables you to plant a tree. To plant a tree on behalf of your customers, you must provide the customer_email. customer_name is optional. However, if you plan to make an impact on behalf of your customers or give them the ability to track their impact, you need to provide the customer_email.

Required request body attributes

  • Name
    amount
    Type
    integer
    Description

    The number of trees you wish to plant in a single request. The value must be between 1 and 10,000,000.

Optional request body attributes

  • Name
    customer_email
    Type
    string
    Description

    The email of the customer if you are sending a request to plant a tree on their behalf. Must be a valid email address.

  • Name
    customer_name
    Type
    string
    Description

    The name of the customer if you are sending a request to plant a tree on their behalf. customer_email must be present.

  • Name
    category
    Type
    string
    Description

    Specify the type of trees to plant. If not specified, standard reforestation trees will be planted. Currently supported values: "food" - Plants food bearing trees that provide nutrition and income for local communities while also allowing you to participate in exclusive live planting sessions to witness your impact firsthand.

Request

POST
/v1/plant_tree
 curl --location 'https://api.1clickimpact.com/v1/plant_tree' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {PRODUCTION API KEY}' \
--data '{
    "amount": 5
}'

Response

{
  "user_id": "U123",
  "tree_planted": 5,
  "time_utc": "2024-09-16T20:34:04.429Z"
}

Request (for Customer)

POST
/v1/plant_tree
curl --location https://api.1clickimpact.com/v1/plant_tree \
--header 'Content-Type: application/json' \
--header 'x-api-key: {PRODUCTION API KEY}' \
--data '{
    "amount": 5,
    "customer_email": "sample-customer@email.com",
    "customer_name": "Sample Customer",
    "category": "food"
}'

Response (for Customer)

{
  "user_id": "U123",
  "tree_planted": 5,
  "category": "food",
  "customer": {
    "customer_id": "U12345",
    "customer_email": "sample-customer@email.com",
    "customer_name": "Sample Customer"
  },
  "time_utc": "2024-09-16T20:34:04.429Z"
}

GET/v1/records

Retrieve your tree planted records

This endpoint allows you to query your tree planted records. Refer to customer records at the bottom to see how to query customer tree planted records.

Optional query params

  • Name
    filter_by
    Type
    string
    Description

    The impact type of the records you want to query. To retrieve the tree planted records filter_by should be "tree_planted".

  • Name
    start_date
    Type
    string
    Description

    The start date after which you want to query the records. The start_date should be in the format yyyy-mm-dd.

  • Name
    end_date
    Type
    string
    Description

    The end date up to which you want to query the records. The end_date should be in the format yyyy-mm-dd.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of records returned. The default value is 10. The value must be between 0 and 1000.

  • Name
    cursor
    Type
    string
    Description

    The cursor from the response can be used as query parameter in the next request to fetch the subsequent list of records. Refer to Pagination section for more details.

Request

GET
/v1/records
curl --location 'https://api.1clickimpact.com/v1/records?filter_by=tree_planted' \
--header 'x-api-key: {PRODUCTION API KEY}'

Response

{
  "user_records":
  [
    {
        "user_id": "U123",
        "time_utc": "2024-09-16T20:30:13.391Z",
        "tree_planted": 5
    },
    {
        "user_id": "U123",
        "time_utc": "2024-09-17T13:24:04.429Z",
        "tree_planted": 15
    },
    {
        "user_id": "U123",
        "time_utc": "2024-09-17T14:32:01.638Z",
        "tree_planted": 10,
        "category": "food"
    },
    {...},
    {...}
  ],
  "cursor": "fNJjcmV32dGVkTiOiIyMDI0LTA3LTidXNlcklE3UiVTk2OTQ0MDcwIpT"
}

GET/v1/customer_records

Retrieve customer tree planted records

This endpoint allows you to query customer tree planted records for all or a specific customer.

Optional query params

  • Name
    customer_email
    Type
    string
    Description

    The email of the customer whose records you want to retrieve.

  • Name
    filter_by
    Type
    string
    Description

    The impact type of the records you want to query. To retrieve the tree planted records filter_by should be "tree_planted".

  • Name
    start_date
    Type
    string
    Description

    The start date after which you want to query the records. The start_date should be in the format yyyy-mm-dd.

  • Name
    end_date
    Type
    string
    Description

    The end date up to which you want to query the records. The end_date should be in the format yyyy-mm-dd.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of records returned. The default value is 10. The value must be between 0 and 1000.

  • Name
    cursor
    Type
    string
    Description

    The cursor from the response can be used as query parameter in the next request to fetch the subsequent list of records. Refer to Pagination section for more details.

Request

GET
/v1/customer_records
curl --location 'https://api.1clickimpact.com/v1/customer_records?filter_by=tree_planted' \
--header 'x-api-key: {PRODUCTION API KEY}'

Response

{
  "customer_records":
  [
     {
        "user_id": "U123",
        "customer": {
            "customer_id": "U1234",
            "customer_email": "sample-customer-1@email.com",
            "customer_name": "Sample Customer 1"
        },
        "time_utc": "2024-06-12T15:22:14.753Z",
        "tree_planted": 40
    },
    {
        "user_id": "U123",
        "customer": {
            "customer_id": "U789",
            "customer_email": "sample-customer-2@email.com",
            "customer_name": "Sample Customer 2"
        },
        "time_utc": "2024-06-15T16:41:58.323Z",
        "tree_planted": 50,
        "category": "food"
    },
    {
        "user_id": "U123",
        "customer": {
            "customer_id": "U5678",
             "customer_email": "sample-customer-3@email.com",
            "customer_name": "Sample Customer 3"
        },
        "time_utc": "2024-06-21T18:16:02.083Z",
        "tree_planted": 10
    },
    {
        "user_id": "U123",
        "customer": {
            "customer_id": "U3456",
            "customer_email": "sample-customer-4@email.com",
            "customer_name": "Sample Customer 4"
        },
        "time_utc": "2024-06-21T20:34:35.913Z",
        "tree_planted": 150
    },
    {...},
    {...}
  ],
  "cursor": "eyJjcmVhdGVkT24iOiIyMDI0LTA3LTidXNlcklEIjoiVTk2OTQ0MDcwIn0="
}