API Online

Authentication

Learn how to authenticate with the GreenLedger API.

Current Status

The GreenLedger API currently runs without authentication for local development. All endpoints are accessible without an API key.

Future: API Key Authentication

In production, you'll authenticate using an API key in the request headers:

// Include API key in headers
const response = await fetch('http://localhost:8000/api/documents/', {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
})
# Python example
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
}

response = requests.get(
    'http://localhost:8000/api/documents/',
    headers=headers
)
# cURL example
curl -X GET 'http://localhost:8000/api/documents/' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json'

LLM API Keys

GreenLedger requires an LLM API key for AI features. Configure one of the following in your .env file:

OpenAI

OPENAI_API_KEY=sk-...

Google Gemini

GOOGLE_API_KEY=...