curl --request POST \
--url https://api.example.com/v1/utility/get \
--header 'Content-Type: application/json' \
--header 'x-ws-api-key: <api-key>' \
--data '
{
"zipcode": "94107",
"detailLevel": "minimal"
}
'import requests
url = "https://api.example.com/v1/utility/get"
payload = {
"zipcode": "94107",
"detailLevel": "minimal"
}
headers = {
"x-ws-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-ws-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({zipcode: '94107', detailLevel: 'minimal'})
};
fetch('https://api.example.com/v1/utility/get', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/utility/get",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'zipcode' => '94107',
'detailLevel' => 'minimal'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ws-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/utility/get"
payload := strings.NewReader("{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ws-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/utility/get")
.header("x-ws-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/utility/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ws-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "req_123",
"error_code": "VALIDATION_FAILED",
"message": "Request validation failed.",
"field_errors": [
{
"field": "zipcode",
"message": "zipcode is invalid"
}
]
}{
"request_id": "req_123",
"error_code": "AUTH_MISSING_API_KEY",
"message": "Missing x-ws-api-key header.",
"recovery_action": "Provide the x-ws-api-key header. If this contradicts the public docs or OpenAPI contract, submit structured feedback through /v1/feedback."
}[
{
"utilityId": "14328",
"utilityName": "Pacific Gas & Electric",
"iconUrl": "https://example.com/utilities/pge.png",
"ratePlans": [
{
"id": "6915de25881cbc6041e4c7f1",
"rateID": "tou-d-pr-1",
"udId": "6915de25881cbc6041e4c7f1",
"ratePlanName": "TOU-D",
"supportedType": "optimizable"
}
]
}
]list utilities
Discover utilities and rate plans without creating a home. A request requires utilityId, zipcode, or both lat and long. Pass utilityId (EIA utility ID) when you already know the utility; use zipcode or lat/long to discover utilities for a location. Response utilityId is that same EIA ID. Send ratePlans[].id as ratePlanId; ratePlans[].udId repeats that WattShift plan ID, while ratePlans[].rateID is the semantic tariff reference (not an EIA ID).
curl --request POST \
--url https://api.example.com/v1/utility/get \
--header 'Content-Type: application/json' \
--header 'x-ws-api-key: <api-key>' \
--data '
{
"zipcode": "94107",
"detailLevel": "minimal"
}
'import requests
url = "https://api.example.com/v1/utility/get"
payload = {
"zipcode": "94107",
"detailLevel": "minimal"
}
headers = {
"x-ws-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-ws-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({zipcode: '94107', detailLevel: 'minimal'})
};
fetch('https://api.example.com/v1/utility/get', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/utility/get",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'zipcode' => '94107',
'detailLevel' => 'minimal'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ws-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/utility/get"
payload := strings.NewReader("{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ws-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/utility/get")
.header("x-ws-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/utility/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ws-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"zipcode\": \"94107\",\n \"detailLevel\": \"minimal\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "req_123",
"error_code": "VALIDATION_FAILED",
"message": "Request validation failed.",
"field_errors": [
{
"field": "zipcode",
"message": "zipcode is invalid"
}
]
}{
"request_id": "req_123",
"error_code": "AUTH_MISSING_API_KEY",
"message": "Missing x-ws-api-key header.",
"recovery_action": "Provide the x-ws-api-key header. If this contradicts the public docs or OpenAPI contract, submit structured feedback through /v1/feedback."
}[
{
"utilityId": "14328",
"utilityName": "Pacific Gas & Electric",
"iconUrl": "https://example.com/utilities/pge.png",
"ratePlans": [
{
"id": "6915de25881cbc6041e4c7f1",
"rateID": "tou-d-pr-1",
"udId": "6915de25881cbc6041e4c7f1",
"ratePlanName": "TOU-D",
"supportedType": "optimizable"
}
]
}
]Authorizations
WattShift API key
Headers
WattShift API Key
Body
- Option 1
- Option 2
- Option 3
zipcode for utility
^(?:0{0,4}[0-9]{1,5}|[0-9]{3})(?:[-\s][0-9]{4})?$latitude for utility rates
longitude for utility rates
radius within which utility rates are requested
EIA utility ID (alternative to zipcode). Pass when you already know the utility; use zipcode or lat/long to discover utilities for a location. Not a rate plan id or rateID.
timestamp, seconds since 1970-01-01T00:00:00, UTC
full, minimal Response
Validation failure
"req_123"
AUTH_MISSING_API_KEY, AUTH_INVALID_API_KEY, AUTH_EXPIRED_CREDENTIAL, AUTH_REVOKED_CREDENTIAL, AUTH_INSUFFICIENT_SCOPE, VALIDATION_FAILED, RATE_LIMITED, NOT_FOUND, FORBIDDEN, PRODUCTION_ACCESS_DENIED, INTERNAL_ERROR "VALIDATION_FAILED"
"Request validation failed."
"Provide the x-ws-api-key header. If this contradicts the public docs, submit feedback through /v1/feedback."
Show child attributes
Show child attributes
3600
