Liking cljdoc? Tell your friends :D

clj-midas — upgrading from v1.0 to v2.0

clj-midas 1.0.0 tracks the California Energy Commission's MIDAS v2.0 API (live 2026-06-22), a breaking change. v1.0 was removed from the live service that day, so 1.0.0 is a v2-only release — there is no v1.0 compatibility mode. This guide is what a v0.x/v1.0 consumer needs to upgrade.

clj-midas is a read-only consumer client. In v2.0 all public GET endpoints are unauthenticated, so you need no credentials — just (create-anonymous-client). The authenticated constructors (create-client / create-auto-client) exist only for utilities that upload rate data to the CEC; that path requires CEC-issued utility credentials and is not exercised by this project.

What changed (and what to do)

v1.0v2.0What you do
Token required for readsGET endpoints are unauthenticatedUse (create-anonymous-client) — no username/password
RIN list is a bare arrayKeyed object, always { "Rates": [...] } (regardless of SignalType)Nothing — entities/rin-list peels it for you
Lookup table is a bare arrayKeyed object { "table_name": …, "data": [...] }Nothing — entities/lookup-table peels :data for you
Interval price field valueValue (capital V)Nothing — coercion follows
RateType long-form onlyElectricity rates send the short UploadCode ("TOU"); GHG/Flex send the long DescriptionNothing — rate-type-kw keys on both
GHG in kg/kWh CO2g/kWh CO2 (values 1000× larger)Recompute any cross-boundary comparisons; :midas.unit/g-co2-per-kwh is the new unit
GHG/Flex SignalType was nullAlways populated (long-form labels)Nothing — signal-type-kw recognises them
ValueInformation bare datetimes were PT for some signalsUTC for every signal typeRead :tick/beginning / :tick/end (zone-aware); the zone-naive :midas.value/date-start/-end/time-* keys are removed
LastUpdated was a bare wall-clock stringCarries a basic-format UTC offset, e.g. "…+0000"Nothing — parsing accepts +0000, +00:00, and Z
GET /HistoricalData?id= (query)GET /HistoricalData/{rate_id} (path), 6-month max range per callNothing — get-historical-data signature is unchanged: (get-historical-data client rin startdate enddate)
GET /HistoricalListRemovedUse (entities/rin-list (get-rin-list client 0)) for the full active RIN list
GET /Holiday (get-holidays)Retired (absent from the CEC's published OpenAPI)Remove any get-holidays calls. The 8=Holiday day-type value in rate schedules is unaffected

Notes on the data

  • Consolidated GHG/Flex RINs. v2.0 collapses the legacy SGIP GHG RINs into 11 USCA-SGIP-MOER-{REGION} RINs (the old BANC region code is now P2), and Flex Alerts into the single USCA-FLEX-ALRT-0000. Legacy RINs are retired.
  • Pre-migration GHG history is not migrated. A MOER RIN returns no data before 2026-06-22. The canonical source for older GHG history is the SGIP Signal bulk CSV (content.sgipsignal.com/download-data) or the WattTime API. Electricity-rate and Flex Alert history are unaffected.
  • Window boundaries are still Pacific-aligned but arrive as UTC on the wire (midnight Pacific = 07:00:00 UTC during PDT, 08:00:00 during PST); clj-midas re-expresses them in the client zone (default America/Los_Angeles), DST-correct.

Spec divergences found on the live API

The release-day smoke-test surfaced four places where the live v2.0 API diverges from the reverse-engineered midas-api-specs; each is filed upstream and handled defensively in clj-midas:

References

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close