Developer API

GridMango API v1

Programmatic access to customer-facing demand response analysis and telemetry processing workflows.

Base URL: https://gridmango.com/.netlify/functions/api-v1

How Authentication Works

  1. Create an account or sign in to GridMango.
  2. Open Profile and go to API Access.
  3. Copy the current bearer token from the profile page.
  4. Send that token in every API request:
    Authorization: Bearer <token>

The bearer token is your current signed-in session token. It is not a long-lived API key. Refresh it from Profile when needed.

Entitlements and Feature Gating

Endpoint Starter Professional Platform
POST /baseline/generate
POST /load-shape/generate
POST /timezone/convert
POST /patching/run
POST /event-replay/run
POST /telemetry-simulator/generate

API access follows your active GridMango subscription. Requests to tools outside your plan will be rejected.

Discovery and Session Endpoints

  • GET /health returns API health.
  • GET /tools returns the public customer-facing endpoint manifest.
  • GET /auth/me returns the authenticated user, current plan tier, subscription status, and entitled tool keys.

Code Examples

curl -X POST "https://gridmango.com/.netlify/functions/api-v1/baseline/generate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-session-token>" \
  -d '{
    "rows": [
      { "Time": "2026-03-10T17:15:00.000Z", "kW": 2.11 },
      { "Time": "2026-03-10T17:30:00.000Z", "kW": 2.03 }
    ],
    "eventDate": "2026-03-18",
    "eventStartTime": "17:00",
    "eventDuration": 60,
    "method": "xofy",
    "x": 5,
    "y": 10,
    "similarDayRule": "match_event_day",
    "excludeHolidays": false
  }'

Example Workflow

  1. Call GET /auth/me to confirm the current session and available access.
  2. Call GET /tools to view the available endpoint catalog.
  3. Submit a tool request with the bearer token.
  4. Store the support reference code returned with any failed request so it can be shared with GridMango support.

Endpoint Reference

GET /auth/me

Returns the current user, plan tier, subscription status, and entitled tools.

{
  "ok": true,
  "data": {
    "userId": "...",
    "email": "[email protected]",
    "isAdmin": false,
    "tokenType": "supabase_session_bearer",
    "planTier": "professional",
    "subscriptionStatus": "active",
    "entitledTools": ["baseline", "loadshape", "timezone", "patching", "eventreplay"]
  }
}

POST /baseline/generate

Generate a demand response baseline and optional event-performance output from interval telemetry.

POST /load-shape/generate

Create synthetic site- or meter-level interval load data for baseline, replay, and analytics testing.

POST /timezone/convert

Convert interval telemetry between named time zones while preserving interval alignment.

POST /patching/run

Patch missing telemetry intervals using interpolation and fallback extrapolation rules.

POST /event-replay/run

Compare two event replay scenarios side-by-side using the same telemetry dataset.

POST /telemetry-simulator/generate

Generate synthetic DER telemetry and an optional weather companion dataset for testing and integration workflows.

Error Handling

When a request fails, GridMango returns a user-safe error and a support reference code. Share that code with support for investigation.

{
  "ok": false,
  "error": "Unable to process request.",
  "code": "GM-API-AB12CD34"
}