Reforest API Documentation

Everything you need to start planting trees with our API

v1.0 https://api.reforestapi.com

Quick Start

Get started with Reforest API in minutes. Plant your first tree with just a few lines of code.

1

Get Your API Key

Sign up for a free account and get your API key from the dashboard.

Get API Key
2

Make Your First Request

Plant your first tree with a simple POST request:

Shell
curl -X POST https://api.reforestapi.com/v1/plant \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 5,
    "country": "Brazil",
    "project_type": "rainforest"
  }'
3

Track Your Impact

Get real-time updates and certificates for your planted trees.

Response:

{
  "id": "plt_abc123",
  "quantity": 5,
  "country": "Brazil",
  "project_type": "rainforest",
  "partner": "One Tree Planted",
  "cost_per_tree": 0.12,
  "total_cost": 0.60,
  "status": "confirmed",
  "estimated_planting_date": "2025-03-15",
  "certificate_url": "https://cert.reforestapi.com/plt_abc123",
  "created_at": "2025-02-15T10:30:00Z"
}

Authentication

Reforest API uses API keys for authentication. Include your API key in the Authorization header of all requests.

Authorization Header

Authorization: Bearer YOUR_API_KEY
Keep your API key secure!

Never expose your API key in client-side code or public repositories.

Rate Limiting

API requests are rate-limited based on your plan:

Plan Requests per Hour Burst Limit
Free 100 10
Developer 1,000 50
Business 5,000 100
Enterprise Unlimited Custom

Rate Limit Headers

Every API response includes rate limit information:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

Plant Trees

Plant trees with our partners around the world.

POST /v1/plant

Request Body

quantity required integer

Number of trees to plant (1-10000)

country optional string

Preferred country for planting (ISO country code)

project_type optional string

Type of project: "reforestation", "rainforest", "mangrove", "urban"

metadata optional object

Custom metadata for tracking

Example Request

curl -X POST https://api.reforestapi.com/v1/plant \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 10,
    "country": "BR",
    "project_type": "rainforest",
    "metadata": {
      "user_id": "user_123",
      "campaign": "save-the-rainforest"
    }
  }'
const response = await fetch('https://api.reforestapi.com/v1/plant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    quantity: 10,
    country: 'BR',
    project_type: 'rainforest',
    metadata: {
      user_id: 'user_123',
      campaign: 'save-the-rainforest'
    }
  })
});

const result = await response.json();
console.log(result);
import requests

response = requests.post(
    'https://api.reforestapi.com/v1/plant',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'quantity': 10,
        'country': 'BR',
        'project_type': 'rainforest',
        'metadata': {
            'user_id': 'user_123',
            'campaign': 'save-the-rainforest'
        }
    }
)

print(response.json())

Response

{
  "id": "plt_abc123",
  "quantity": 10,
  "country": "BR",
  "project_type": "rainforest",
  "partner": "One Tree Planted",
  "partner_project": "Amazon Rainforest Restoration",
  "cost_per_tree": 0.12,
  "total_cost": 1.20,
  "status": "confirmed",
  "estimated_planting_date": "2025-03-15",
  "certificate_url": "https://cert.reforestapi.com/plt_abc123",
  "metadata": {
    "user_id": "user_123",
    "campaign": "save-the-rainforest"
  },
  "created_at": "2025-02-15T10:30:00Z"
}

Get Planting Details

Retrieve details about a specific planting order.

GET /v1/plant/{id}

Path Parameters

id required string

The planting ID

Example Request

curl -X GET https://api.reforestapi.com/v1/plant/plt_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

List Plantings

Get a list of all your plantings with optional filtering.

GET /v1/plant

Query Parameters

limit optional integer

Number of results to return (default: 20, max: 100)

offset optional integer

Number of results to skip (default: 0)

status optional string

Filter by status: "pending", "confirmed", "planted", "failed"

Impact Report

Get a summary of your environmental impact.

GET /v1/reports/impact

Response

{
  "total_trees": 1247,
  "total_cost": 149.64,
  "co2_offset_kg": 2494,
  "countries": ["US", "BR", "IN", "KE"],
  "partners": ["One Tree Planted", "TreeApp", "Ecologi"],
  "project_types": {
    "reforestation": 847,
    "rainforest": 300,
    "mangrove": 100
  },
  "planted_trees": 1100,
  "pending_trees": 147,
  "first_planting": "2023-01-15T10:30:00Z",
  "last_planting": "2025-02-15T16:45:00Z"
}

JavaScript SDK

Use our official JavaScript SDK for easier integration.

Installation

npm install planttree-api

Usage

import Reforest from 'planttree-api';

const client = new Reforest('YOUR_API_KEY');

// Plant trees
const planting = await client.plant({
  quantity: 10,
  country: 'BR',
  project_type: 'rainforest'
});

// Get impact report
const impact = await client.getImpact();

console.log(`Total trees planted: ${impact.total_trees}`);

Python SDK

Use our official Python SDK for server-side applications.

Installation

pip install planttree-api

Usage

from planttree import Reforest

client = Reforest('YOUR_API_KEY')

# Plant trees
planting = client.plant(
    quantity=10,
    country='BR',
    project_type='rainforest'
)

# Get impact report
impact = client.get_impact()

print(f"Total trees planted: {impact['total_trees']}")

Error Codes

Reforest API uses conventional HTTP response codes to indicate success or failure.

200

OK

Request successful

400

Bad Request

Invalid request parameters

401

Unauthorized

Invalid or missing API key

429

Too Many Requests

Rate limit exceeded

500

Internal Server Error

Something went wrong on our end

Need Help?

We're here to help you succeed with Reforest API.

Discord Community

Join our developer community for real-time help and discussions.

Join Discord

Email Support

Get help from our support team via email.

Email Us

Status Page

Check the current status of our API and services.

View Status