PeakShiftPeakShiftPeakShiftAPI Referencev1.4
API SandboxSystem StatusChangelog
Run in Postman
Download YAML

Getting Started

  • Introduction
  • Quick Start
  • Authentication
  • Code Examples

Reference

  • Rate Limits
  • Error Codes
  • Sandbox
  • Changelog
  • API Reference

Resources

  • Changelog
  • Status Page
  • Support
REST API · v1.4 · ESPI 1.2

PeakShift API Reference

Programmatic access to normalized Green Button energy consumption data from Ontario's five utilities. REST API, JSON responses, Bearer token auth, <400ms p99 response time, 99.5% uptime SLA.

Base URL
api.peakshift.ca/v1
Auth
Bearer token
Format
JSON
Version header
X-API-Version: 1
Live utilities
Toronto Hydro
Hydro One
Hydro Ottawa
Alectra
Elexicon

Quick Start

1

Get your API key — self-serve, 2 minutes

Sign up at peakshift.ca/signup → verify your email → API keys are available immediately in your dashboard. Sandbox keys are available instantly with no approval required. Production keys require a one-time verification form.

Create account Learn about sandbox
2

Add your key to every request

All API endpoints require a Bearer token in the Authorization header.

Authorization: Bearer pk_live_your_key_here
3

Make your first call

Use the code examples below, or scroll to the API Reference and click Try it out on any endpoint.

Authentication

Sandbox key
pk_test_...

Use for development and testing. Returns mock utility data. No approval required.

Production key
pk_live_...

Returns real Ontario utility data. Requires one-time verification form after signup.

Key security: Never expose API keys in client-side code or public repositories. Use environment variables. Rotate immediately from the dashboard if a key is compromised. Contact parth.patel@peakshift.ca if you suspect a key breach.

Code Examples

Fetching 12 months of usage data for a connected homeowner account.

curl -X GET "https://api.peakshift.ca/v1/accounts/{account_id}/usage" \
  -H "Authorization: Bearer pk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2025-01-01",
    "end_date": "2025-12-31",
    "interval": "monthly"
  }'

Replace account_id with an ID from GET /accounts.

Rate Limits

Rate limits apply per API key. When exceeded, the API returns 429 Too Many Requests with a Retry-After: {seconds} header. Implement exponential backoff starting at the Retry-After value.

EndpointReq/minDaily capBurstPlan
GET /accounts/{id}/usage605,00010/sAll
GET /accounts12010,00020/sAll
POST /accounts/{id}/authorize105002/sAll
GET /accounts/{id}/intervals605,00010/sPro+
POST /webhooks302,0005/sPro+
GET /utilities300Unlimited50/sAll

Pro+ plan includes higher limits. Contact us for enterprise volume pricing.

Error Codes

All errors return JSON with error (machine code) and message (human description) fields. Application-level errors use error_code for programmatic handling.

400invalid_request
Meaning

Missing or malformed request body, invalid date range, or unsupported interval value.

Recommended handling

Validate request parameters before sending. Check required fields in the API reference.

401invalid_api_key
Meaning

API key missing, malformed, or revoked. Key prefix must be pk_live_ (production) or pk_test_ (sandbox).

Recommended handling

Verify the Authorization header format: Bearer pk_live_xxx. Rotate key from dashboard if compromised.

401token_expired
Meaning

OAuth token for a homeowner account has expired or been revoked by the homeowner.

Recommended handling

Re-initiate the OAuth flow for this account. The homeowner must re-authorize access.

403insufficient_scope
Meaning

API key does not have permission for this endpoint. Sandbox keys cannot access production endpoints.

Recommended handling

Upgrade to a plan that includes this endpoint, or use a production key for live data.

404account_not_found
Meaning

Account ID does not exist or belongs to a different API key.

Recommended handling

Verify the account_id from the accounts list endpoint. IDs are not portable across environments.

429rate_limit_exceeded
Meaning

You have exceeded the rate limit for this endpoint. See Retry-After header for wait time in seconds.

Recommended handling

Implement exponential backoff. Read Retry-After header. Consider upgrading plan for higher limits.

503utility_unavailable
Meaning

PeakShift infrastructure is operational but the specific utility API is temporarily unreachable.

Recommended handling

Retry after 60s. Check status.peakshift.ca for utility-specific outage information.

503service_unavailable
Meaning

PeakShift API infrastructure is temporarily unavailable. Rare — target uptime is 99.5%.

Recommended handling

Retry with exponential backoff starting at 5s. Subscribe to status page for incident updates.

Sandbox Environment

The sandbox environment lets you build and test integrations without real Ontario homeowner data. Sandbox keys are available immediately on account creation — no approval required.

How to access

  • Sign up at peakshift.ca/signup
  • Sandbox key (pk_test_...) is in your dashboard immediately
  • Use https://api.peakshift.ca/v1 — same base URL, sandbox is determined by key prefix
  • No separate base URL required

Sandbox behaviour

  • All endpoints behave identically to production
  • Mock data returns realistic Ontario utility usage profiles
  • Pre-seeded test accounts: acct_test_toronto_hydro, acct_test_hydro_one, etc.
  • Rate limits are enforced at 50% of production limits
Sandbox base URL
https://api.peakshift.ca/v1 (with pk_test_ key)

Changelog

Breaking changes are communicated with 30 days advance notice via email and this changelog. Subscribe to status.peakshift.ca for incident updates.

May 2026
v1.4.0NewMay 2026
  • Added GET /accounts/{id}/intervals endpoint for 15-minute interval data (Pro+ plans)
  • Alectra Utilities integration now production-live
  • Added utility field to account objects indicating source utility
March 2026
v1.3.0NewMarch 2026
  • Added webhook support for account authorization events
  • TOU rate breakdown now included in usage response
  • Added pk_test_ sandbox key prefix — sandbox and production environments now fully separated
January 2026
v1.2.1FixJanuary 2026
  • Fixed edge case where Hydro One interval data returned duplicate records on DST boundaries
  • Corrected Retry-After header value on 429 responses (was returning ms, now correctly seconds)
December 2025
v1.2.0NewDecember 2025
  • Hydro One and Hydro Ottawa integrations now production-live
  • Added carbon_intensity field to usage responses
  • Added 12-month historical data access for all plans

Interactive API Reference

Run in PostmanDownload YAML
Loading API Specification...