HomeGuidesRecipesAPI ReferenceChangelog
Log In
API Reference

To run a new calculation, you will POST a payload containing the calculation criteria and inputs, and a CalculatedCost object will be returned. Note that these parameters are part of the request body, not the query string.

Examples

Example 1 - Calculate last month's bill

POST /rest/v1/accounts/62d07619-06fd-4a28-9376-62c86c7811d5/calculate/

Below is a sample POST request based on the above accountId.

{  
  "fromDateTime" : "2013-01-08",  
  "toDateTime" : "2014-01-12",  
  "billingPeriod": true,  
  "minimums" : true,  
  "detailLevel" : "RATE",  
  "groupBy" : "MONTH"  
}  

And here's the response:

{  
  "status": "success",  
  "count": 1,  
  "type": "CalculatedCost",  
  "requestId": "52da5704-a951-4104-ae27-bf0cce98334d",  
  "results": \[  
    {  
      "masterTariffId": 522,  
      "tariffName": "Residential",  
      "totalCost": 59.19,  
      "fromDateTime": "2013-01-08T00:00:00-08:00",  
      "toDateTime": "2014-01-12T00:00:00-08:00",  
      "currency": "USD",  
      "summary": {  
        "ELECTRICITY": {  
          "kWh": 0,  
          "kW": 0  
        },  
        "subTotalCost": 54.55,  
        "taxCost": 4.64,  
        "totalCost": 59.19,  
        "adjustedTotalCost": 59.19,  
        "kWh": 0,  
        "kW": 0  
      },  
      "accuracy": 1,  
      "items": [  
        {  
          "tariffRateId": 17023273,  
          "tariffRateBandId": 10237697,  
          "rateSequenceNumber": 1,  
          "rateGroupName": "Generation",  
          "rateName": "Generation Charge",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "quantityKey": "consumption",  
          "rateType": "COST_PER_UNIT",  
          "rateAmount": 0.07884,  
          "itemQuantity": 0,  
          "cost": 0,  
          "chargeClass": "SUPPLY"  
        },  
        {  
          "tariffRateId": 17109049,  
          "tariffRateBandId": 10375380,  
          "rateSequenceNumber": 999,  
          "rateGroupName": "Minimum Charge",  
          "rateName": "Minimum Charge",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "quantityKey": "minimum",  
          "rateType": "COST_PER_UNIT",  
          "rateAmount": 0.14784,  
          "itemQuantity": 11,  
          "cost": 1.62624  
        },  
        {  
          "tariffRateId": 0,  
          "rateSequenceNumber": 10000,  
          "rateGroupName": "TAX",  
          "rateName": "Utility Tax",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "quantityKey": "percentage",  
          "rateType": "PERCENTAGE",  
          "rateAmount": 0.085,  
          "itemQuantity": 709.18848,  
          "cost": 4.6370016  
        },  
      ...  
      ],  
      "assumptions": [  
        {  
          "keyName": "dailyMedicalAllowance",  
          "displayName": "Daily Medical Allowance ",  
          "description": "Residential customers on a medical allowance get additional quantities of energy at the lowest (baseline) price. The medical allowance is a daily value. ",  
          "dataType": "DECIMAL",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "0",  
          "accuracy": 80  
        },  
        {  
          "keyName": "hasCAEnergySurchargeExemption",  
          "displayName": "Has Energy Surcharge Exemption",  
          "description": "Exemptions for CA Energy Surcharge apply to the following:\r\n1. Federal Agencies\r\n2. American National Red Cross facilities\r\n3. Energy consumed on Indian reservations\r\n4. Foreign consular employees\r\n5. Federal Credit Unions",  
          "dataType": "BOOLEAN",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "false",  
          "accuracy": 80  
        },  
        {  
          "keyName": "smartMeterOptOut",  
          "displayName": "Has Smart Meter Opt-Out",  
          "description": "Customers  who elect to opt-out of receiving a smart meter and choose to retain a non-smart meter, are subject to the Smart Meter Opt-Out fees.\r\n\r\nSmart Meter Opt-Out Customers are subject to one-time, up-front fee and a recurring monthly fee ",  
          "dataType": "BOOLEAN",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "false",  
          "accuracy": 80  
        },  
        {  
          "keyName": "isSmartRateCustomer",  
          "displayName": "Is SmartRate Customer",  
          "description": "The residential SmartRate program is a voluntary rate supplement to the customer's \r\notherwise applicable rate schedule (OAS).\r\nThe customer will be billed for all regular charges applicable under the customer's OAS.  \r\nAdditional charges (based on usage during SmartDay High-Price Periods) and \r\nSmartRate credits will be determined according to the rates specified in this schedule.  The customer must have a SmartMeter system to participate in the residential \r\nSmartRate program",  
          "dataType": "BOOLEAN",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "false",  
          "accuracy": 80  
        },  
        {  
          "keyName": "utilityEmployee",  
          "displayName": "Is Utility Employee",  
          "description": "Applicable to domestic service utility employees ",  
          "dataType": "BOOLEAN",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "false",  
          "accuracy": 80  
        },  
        {  
          "keyName": "powerChargeIndifferenceAdjustmentVintageYear",  
          "displayName": "Power Charge Indifference Adjustment  Vintage Year ",  
          "description": "The adjustment (either a \r\ncharge or credit) is intended to ensure that customers that purchase electricity from \r\nnon-utility suppliers pay their share of cost for generation acquired prior to 2003",  
          "dataType": "STRING",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "None",  
          "accuracy": 80  
        },  
        {  
          "keyName": "tariffId",  
          "dataType": "INTEGER",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2013-05-01T00:00:00-07:00",  
          "dataValue": "3155887",  
          "accuracy": 100  
        },  
        {  
          "keyName": "tariffId",  
          "dataType": "INTEGER",  
          "fromDateTime": "2013-05-01T00:00:00-07:00",  
          "toDateTime": "2013-10-01T00:00:00-07:00",  
          "dataValue": "3160193",  
          "accuracy": 100  
        },  
        {  
          "keyName": "tariffId",  
          "dataType": "INTEGER",  
          "fromDateTime": "2013-10-01T00:00:00-07:00",  
          "toDateTime": "2014-01-01T00:00:00-08:00",  
          "dataValue": "3163175",  
          "accuracy": 100  
        },  
        {  
          "keyName": "tariffId",  
          "dataType": "INTEGER",  
          "fromDateTime": "2014-01-01T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "3164509",  
          "accuracy": 100  
        },  
        {  
          "keyName": "minimum",  
          "dataType": "STRING",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "true",  
          "accuracy": 100  
        },  
        {  
          "keyName": "profileId",  
          "displayName": "2014 CA Electricity Residential TOU Profile",  
          "description": "ELECTRICITY_RESIDENTIAL_CA_2014_TOU",  
          "dataType": "STRING",  
          "dataValue": "5539691a368c25bd8b993673",  
          "accuracy": 100  
        },  
        {  
          "keyName": "territoryId",  
          "displayName": "Territory",  
          "description": "Territory where tariff is operational",  
          "dataType": "INTEGER",  
          "fromDateTime": "2013-01-08T00:00:00-08:00",  
          "toDateTime": "2014-01-12T00:00:00-08:00",  
          "dataValue": "3538",  
          "accuracy": 100  
        }  
      ]  
    }  
  ]  
}  

To get different result aggregations, modify the groupBy and detailLevel values. For example, using "groupBy":"HOUR" and "detailLevel":"CHARGE_TYPE" for the calculation above will return costs and usage broken down by charge type for each hour:

"items": [  
    {  
      "fromDateTime": "2013-01-08T00:00:00-08:00",  
      "toDateTime": "2013-01-08T01:00:00-08:00",  
      "quantityKey": "minimum",  
      "rateAmount": 0.00616,  
      "itemQuantity": 1,  
      "cost": 0.00616  
    },  
    {  
      "fromDateTime": "2013-01-08T00:00:00-08:00",  
      "toDateTime": "2013-01-08T01:00:00-08:00",  
      "quantityKey": "tax",  
      "rateAmount": 0.0000096,  
      "itemQuantity": 54.55296,  
      "cost": 0.0005236  
    },  
    ...  
]  

Example 2 - Calculate with a Provider Account ID

To identify an account based on the ID value you provided when you created the account, use the following request url format:

POST /rest/v1/accounts/pid/{yourProviderAccountId}/calculate/
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!