Reforest API Documentation
Everything you need to start planting trees with our API
Quick Start
Get started with Reforest API in minutes. Plant your first tree with just a few lines of code.
Make Your First Request
Plant your first tree with a simple POST request:
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"
}'
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
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.
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.
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.
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.
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.
OK
Request successful
Bad Request
Invalid request parameters
Unauthorized
Invalid or missing API key
Too Many Requests
Rate limit exceeded
Internal Server Error
Something went wrong on our end
Need Help?
We're here to help you succeed with Reforest API.