API Documentation

Home / Documentation

📡 ReLeaf API Documentation

Easily integrate ReLeaf's powerful deforestation analysis into your applications.

🔗 Base URL

https://api.projectreleaf.xyz/

📍 Available Endpoints

1️⃣ Get Deforestation Prediction

Endpoint: /predict

Method: POST

Description: Get deforestation insights using either map coordinates or a custom image.

Option 1: Map-based Analysis
{
    "email": "user@example.com",
    "watchlist": boolean,
    "timeframe": string,
    "min_lat": float,
    "max_lat": float,
    "min_long": float,
    "max_long": float,
    "zoom": float
}
                            
Python Example - Map Analysis
import requests

data = {
    "email": "your.email@example.com",
    "watchlist": True,
    "timeframe": "2023-2024",
    "min_lat": 12.9716,
    "max_lat": 13.9716,
    "min_long": 77.5946,
    "max_long": 78.5946,
    "zoom": 12.5
}

response = requests.post("https://api.projectreleaf.xyz/predict", json=data).json()
Option 2: Custom Image Analysis
{
    "email": "user@example.com",
    "image": "base64-encoded-image"
}
                            
Python Example - Image Analysis
import requests
import base64

with open("forest_image.jpg", "rb") as image_file:
    encoded_image = base64.b64encode(image_file.read()).decode('utf-8')

data = {
    "email": "your.email@example.com",
    "image": encoded_image
}

response = requests.post("https://api.projectreleaf.xyz/predict", json=data).json()

✅ Example Response

{
        "predicted_mask_base64": "base64_encoded_mask_image",
        "forested_percentage": 65.2,
        "deforested_percentage": 28.7,
        "other_percentage": 6.1,
        "ai_analysis": "The area shows significant deforestation in the northwestern region..."
}
                            
2️⃣ More coming soon!>

Endpoint: /<REDACTED>

Method: N/A

Description: REDACTED

N/A
                            

🔑 Authentication

No authentication is required to use the ReLeaf API, but this may change in the future.