ANSOL API v2: What's New and How to Migrate from v1

API v2 introduces GraphQL support, webhook subscriptions, improved pagination, and stricter rate limiting. This guide covers everything developers need to migrate from v1.

Product 9 min read
#API #developer #GraphQL #ANSOL #migration
Home / Blog /ANSOL API v2: What's New and How to Migrate from v1
ANSOL 9 min read

Why We Built API v2

API v1 has served us well since 2021, but it was designed for a different product. As our platform grew from 10,000 to 2 million meters under management, v1's REST-only design created friction for complex data queries and real-time integrations.

What's New in v2

GraphQL Endpoint

query GetMeterReadings($meterId: ID!, $from: DateTime!, $to: DateTime!) {
  meter(id: $meterId) {
    id
    location { lat lng }
    readings(from: $from, to: $to, interval: HOURLY) {
      timestamp
      value
      unit
    }
    anomalies(from: $from, to: $to) {
      detectedAt
      severity
      description
    }
  }
}

Webhook Subscriptions

POST /v2/webhooks
{
  "url": "https://your-system.com/ansol-hook",
  "events": ["anomaly.detected", "alert.critical", "meter.offline"],
  "secret": "your-signing-secret"
}

Cursor-Based Pagination

v1 used offset pagination (slow on large datasets). v2 uses cursor-based pagination:

GET /v2/readings?cursor=eyJpZCI6MTIzfQ==&limit=100

Migration Timeline

- v1 sunset date: December 31, 2026
- Migration tool available in developer portal
- Free migration assistance for enterprise clients

Rate Limits

PlanRequests/minGraphQL complexity
Starter1001,000
Business1,0005,000
EnterpriseUnlimitedCustom

Operational efficiency starts with seeing reality clearly.