POST /v1/trees — Plant Trees and Generate a Certificate

Base URL

https://api.bloomy.earth

Endpoint

/v1/trees

Authentication & Headers

Authentication uses HTTP Basic Auth with your Bloomy Earth API credentials. You must use your Bloomy Earth platform username and application password.

You can find and manage these credentials in your Bloomy Earth dashboard, in the Integration API section:
👉 https://www.bloomy.earth/dashboard/#bloomy-integration-api

Headers

Header Value Required Description
Authorization Basic BASE64(username:pwd) Yes Basic Auth using your Bloomy Earth username and application password.
Accept application/json Optional Specifies that the response should be JSON formatted.
Content-Type application/json Yes Request body is sent in JSON format.

Request Body Parameters (JSON)

{
  "trees": 10,
  "projectId": "2056",
  "sendEmail": true,
  "gift": {
    "giftRecipientName": "John Doe",
    "giftRecipientEmail": "john@example.com",
    "giftMessage": "A gift that grows!"
  }
}

JSON Body Parameter Details

Name Type Required Format Description
trees integer Yes Positive integer (e.g. 1, 5, 10) Number of trees to plant. Must be greater than 0.
projectId string No Example: "2056" ID of the reforestation project. If omitted or invalid, a compatible project is automatically selected.
sendEmail boolean No (default true) true / false Controls whether a planting certificate email is sent.
gift object No JSON object Used to plant trees as a gift for another person/organization.
gift.giftRecipientName string Yes, if gift is provided Example: "John Doe" Recipient’s name shown on the certificate.
gift.giftRecipientEmail string Yes, if gift is provided Example: "john@example.com" Recipient’s email address.
gift.giftMessage string No Example: "A gift that grows!" Optional personal message included in the certificate email.

Request Behavior

  • The organization is determined from the authenticated API user (Basic Auth).
  • If projectId is omitted or invalid, Bloomy Earth automatically selects a random reforestation project with a cost of 1 Tree Credit per tree.
  • Your Dashboard shows the latest list of projects, their credit cost per tree, and your Tree Credits balance.

Example Requests

Minimal example (auto-selected project & email sent by default)

curl -X POST "https://api.bloomy.earth/v1/trees" \
  -u YOUR_API_USER:YOUR_API_PASSWORD \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "trees": 3
  }'

Standard planting (non-gift, explicit project)

curl -X POST "https://api.bloomy.earth/v1/trees" \
  -u YOUR_API_USER:YOUR_API_PASSWORD \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "trees": 10,
    "projectId": "2056",
    "sendEmail": true
  }'

Gift planting

curl -X POST "https://api.bloomy.earth/v1/trees" \
  -u YOUR_API_USER:YOUR_API_PASSWORD \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "trees": 5,
    "projectId": "2067",
    "gift": {
      "giftRecipientName": "John Doe",
      "giftRecipientEmail": "john@example.com",
      "giftMessage": "A gift that grows!"
    },
    "sendEmail": true
  }'


JSON Response (200)

{
  "success": true,
  "certificateId": "C3295146E582",
  "certificateLink": "https://bloomy.earth/certificate/C3295146E582",
  "treesPlanted": 5,
  "creditsUsed": 5,
  "creditBalance": 14,
  "projectInfo": {
    "name": "Lake Victoria Agroforestry Project in Kenya",
    "country": "Kenya",
    "location": "VQ27+Q7C Kisumu, Kenya",
    "quantity": 5,
    "carbonOffsetKg": 250,
    "reforestedAreaHa": 0.005,
    "creditsPerTree": 1,
    "densityTreesPerHa": 1000
  },
  "isVcsCertified": false,
  "giftSentTo": "john@example.com"
}

(Les valeurs sont données à titre d’exemple.)

Response Fields

Field Type Always Returned Description
success boolean Yes Indicates whether the operation was successful.
certificateId string Yes Unique identifier of the generated planting certificate.
certificateLink string Yes Public URL of the planting certificate.
treesPlanted integer Yes Number of trees successfully planted.
creditsUsed integer Yes Total number of Tree Credits used for this planting.
creditBalance integer Yes Remaining Tree Credit balance after the transaction.
projectInfo object Yes Contains detailed information about the selected reforestation project.
name string Yes Project name.
country string Yes Country where the trees were planted.
location string Yes GPS coordinates or area name of the project.
quantity integer Yes Total number of trees assigned to this project for this planting.
creditsPerTree integer Yes Number of Tree Credits required per planted tree in this project.
carbonOffsetKg number Yes Estimated CO₂ offset generated by the planting (in kilograms).
reforestedAreaHa number Yes Estimated reforested area created (in hectares).
giftSentTo string No Email address of the gift recipient (only present if planting was a gift).

Errors

If the request is missing required data, contains invalid parameters, or authentication fails, the API returns a JSON object with an error code and a short message.

Error Format

{
  "error": "unauthorized",
  "message": "Authentication required."
}

HTTP Error code Message Description
400 invalid_request Bad request. Missing or invalid JSON parameters.
401 unauthorized Invalid Basic Auth. Missing header, wrong username (org ID), or wrong API key.
402 insufficient_credits Not enough credits. The organization does not have enough credits to plant the requested trees.
403 unauthorized_plan Plan not allowed. Membership level does not permit API access.
500 server_error Internal server error. Unexpected error occurred during processing.