Authentication

CLIMeter uses JWT-based authentication. Register or log in to receive an access token, then pass it as Authorization: Bearer <token> on all API requests.

POST /v1/auth/register

Create a new CLIMeter account programmatically.

Bash
curl -X POST https://api.climeter.ai/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "your-password"
  }'

# Response
{
  "access_token": "eyJhbGci...",
  "token_type": "Bearer"
}

POST /v1/auth/login

Obtain a JWT for an existing account.

Bash
curl -X POST https://api.climeter.ai/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "your-password"
  }'

# Response
{
  "access_token": "eyJhbGci...",
  "token_type": "Bearer"
}

POST /v1/auth/refresh

Refresh an expired access token.

Bash
curl -X POST https://api.climeter.ai/v1/auth/refresh \
  -H "Authorization: Bearer <expired-or-valid-token>"

Using the token

Pass the JWT in the Authorization: Bearer header on every authenticated request:

Bash
curl https://api.climeter.ai/v1/billing/account \
  -H "Authorization: Bearer eyJhbGci..."
auth.py
Python
import os, requests

# Step 1: Login
auth = requests.post(
    "https://api.climeter.ai/v1/auth/login",
    json={"email": os.environ["CLIMETER_EMAIL"], "password": os.environ["CLIMETER_PASSWORD"]},
)
token = auth.json()["access_token"]

# Step 2: Use the token
response = requests.post(
    "https://api.climeter.ai/v1/events",
    headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
    json={"tool_id": "my-tool", "duration_ms": 120},
)
print(response.json())
Tip
For programmatic tool metering, use the Python SDK — it handles auth automatically via your CLIMETER_API_KEY.
Authentication — CLIMeter Docs