Flows API Reference
The Flows platform exposes a RESTful API through PostgREST, providing direct database access with authentication and authorization.
Base URL
Production: https://api.flows.simtricity.com
Development: https://api-dev.flows.simtricity.com
Authentication
API requests require JWT authentication:
curl https://api.flows.simtricity.com/meter_registry \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Common Endpoints
Meters
GET /meter_registry- List all metersGET /meter_shadows- Current meter statesGET /meter_shadows_tariffs- Tariff information
Data Collection
GET /register_import- Import readingsGET /register_export- Export readingsGET /register_interval_hh- Half-hourly data
Infrastructure
GET /properties- Property listingsGET /circuits- Circuit definitionsGET /escos- Energy communities
Query Parameters
PostgREST supports powerful query options:
Filtering
# Equals
GET /meter_registry?serial=eq.EML2137580826
# Pattern matching
GET /meter_registry?name=like.*Water*
# Multiple conditions
GET /meter_registry?mode=eq.active&esco=eq.UUID
Selecting Fields
# Specific columns
GET /meter_registry?select=id,serial,name
# With relationships
GET /meter_shadows?select=id,balance,meter_registry(serial,name)
Ordering
# Sort by field
GET /register_import?order=timestamp.desc
# Multiple sorts
GET /meter_registry?order=esco.asc,name.asc
Pagination
# Limit and offset
GET /register_interval_hh?limit=100&offset=200
# Range headers
GET /meter_registry
-H "Range: 0-9"
-H "Range-Unit: items"
RPC Functions
Call stored procedures via /rpc/ endpoint:
POST /rpc/get_meters_for_cli
Content-Type: application/json
{
"esco_filter": "WLCE",
"feeder_filter": null
}
Response Format
Responses are JSON arrays:
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"serial": "EML2137580826",
"name": "WL-01 Supply",
"mode": "active",
"created_at": "2024-01-15T10:30:00Z"
}
]
Error Handling
HTTP status codes:
200 OK- Success201 Created- Resource created204 No Content- Success with no body400 Bad Request- Invalid query401 Unauthorized- Missing/invalid auth403 Forbidden- Insufficient permissions404 Not Found- Resource not found409 Conflict- Constraint violation
Error response:
{
"code": "23505",
"details": "Key (serial)=(EML2137580826) already exists.",
"hint": null,
"message": "duplicate key value violates unique constraint"
}
Next Steps
- Meter Operations - Documentation coming soon
- Data Queries - Documentation coming soon
- Real-time Updates - Documentation coming soon