Skip to main content
Anode is a major update to the Flatpeak platform focused on simplification and the introduction of new capabilities:
Access the documentation for Zero, our previous generation release

Connect tariff

Anode introduces significant updates to the Connect architecture and endpoints, designed to simplify integration and shorten the user journey. Because of the scale of these changes, we recommend re-implementing your integration using the updated App Integration Guide.

Connect endpoints changes summary:

All Connect pages now include the following actions:
ActionResult
BACKReturns previous page. If unavailable, returns callback_url.
CLOSEReturns callback_url you specified when creating the Connect token.
All pages now also include a type flag, inherited from the tariff_type field — either "COMMODITY" or "NON_COMMODITY", depending on how the Connect Token was created.
POST /connect/tariff/token 
POST /connect/token 
{
  "customer_id": "cus_65e421d1daa4a24082b4f590",
  "customer_reference_id": "CUS0123456789",
  "location_id": "loc_641b90b758fb8e6293716e40",
  "location_reference_id": "LOC0123456789",
  "direction": "IMPORT", 
  "tariff_direction": "IMPORT", 
  "type": "COMMODITY", 
  "tariff_type": "COMMODITY", 
  "connect_web_url": "myapp://nova/flatpeak/connect", 
  "connect_url": "myapp://nova/flatpeak/connect", 
  "callback_url": "myapp://nova/flatpeak/complete",
  "tariff_id": "trf_6597ef46529ab4467502af0b",
  "actions": { 
    "disconnect_tariff": false, // disconnects tariff with no UI
    "edit_tariff": true // [!code ++] // starts with provider selection instead of summary
  },
  "route_options": { // enables non-mandatory pages
    "advanced_tariff_capture": false, 
    "tariff_name_capture": false, 
    "contract_term_capture": false
  },
  "postal_address_type": "RESIDENTIAL", // fitlers providers by address type
  "postal_address": {
    "address_line1": "1-3",
    "address_line2": "Strand",
    "city": "London",
    "state": "Greater London",
    "post_code": "WC2N 5EH",
    "country_code": "GB"
  }
}
curl --request POST \
  --url https://connect.flatpeak.com \
  --header 'Content-Type: application/json' \
  --data '{
  "connect_token": "<connect_token>",
  "route": "session_restore", 
  "route": "session_start"
}'
curl --request POST \
  --url https://connect.flatpeak.com \
  --header 'Content-Type: application/json' \
  --data '{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "postal_address_capture",
  "data": {
    "postal_address": {
      "address_line1": "1-3Strand", // Required
      "city": "London", // Required
      "state": "Greater London",
      "post_code": "WC2N 5EH", // Required
      "country_code": "GB" // Required
    }
  }
}'
Complete postal address is now required to support automatic assigment of grid fees, price forecasts, solar forecasts, and flexibility features.The new error codes are as follows:
Error CodeError Description
address_line1_missingAddress line 1 is required.
city_missingCity name is required.
post_code_missingPost code is required.
country_code_missingCountry code is required.
country_code_invalidCountry code must be in two-letter ISO 3166-1 alpha-2 format.
geo_location_not_foundUnable to resolve Geo locaiton, provide complete address.
data_json_invalidData does not conform to the JSON schema.
Deprecated. Replaced by Surchage Capture and Region Selection
The Surcharge capture is a new page that partially replaces the Market Surcharge page.
The Region Selection is a new page that partially replaces the Market Surcharge page.
{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "contract_term_capture",
  "direction": "IMPORT",
  "type": "COMMODITY",
  "live_mode": false,
  "actions": [
    "BACK"
  ],
  "data": {
    "provider": {
      "id": "prv_65de3071e0c5570f767f06f1",
      "display_name": "SSE",
      "logo_url": "https://s.flatpeak.com/570f767f06f1.png"
    },
    "contract_start_date": null,
    "contract_end_date": null,
    "contract_term_type": "" // set to UNTIL_TERMINATED for rolling contracts
  }
}
{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "summary_tariff_inprogress", 
  "route": "tariff_connection_pending", 
  "direction": "IMPORT",
  "type": "COMMODITY",
  "live_mode": false,
  "actions": [
    "SAVE", 
    "EDIT", 
    "DISMISS_DIRECT" // depreciated
    "DISCONNECT", 
    "BACK"
  ],
  "data": {
    "connection_type": "DIRECT",
    "provider": {
      "id": "prv_65b78bbdd8e83b06a60e38c2",
      "display_name": "Octopus Energy",
      "logo_url": "https://s.flatpeak.com/83b06a60e38c2.png"
    }
  }
}
{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "summary_tariff_failed", 
  "route": "tariff_connection_failed", 
  "direction": "IMPORT",
  "type": "COMMODITY",
  "live_mode": false,
  "actions": [
    "RECONNECT", 
    "EDIT", 
    "DISCONNECT", 
    "BACK"
  ],
  "data": {
    "connection_type": "DIRECT",
    "provider": {
      "id": "prv_65b78bbdd8e83b06a60e38c2",
      "display_name": "Octopus Energy",
      "logo_url": "https://s.flatpeak.com/83b06a60e38c2.png"
    }
  }
}
The SAVE action has been removed from this page. The tariff is now saved automatically by Flatpeak before the page is returned. This speeds up how quickly tariff data becomes available and removes the need for any user action.
You must now subscribe to Connect session events to receive a notification when the session is complete. To do this, open the Integrate tariff connection into your app guide and scroll to the Subscribe to Connect session events section.
ROUTE summary_fixed_confirm // depreciated
ROUTE summary_tou_confirm // new route that supports both fixed and tou tariffs
{
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "route": "tariff_summary",
  "direction": "IMPORT",
  "type": "COMMODITY",
  "live_mode": false,
  "actions": [
    "WRONG_TARIFF",
    "EDIT",
    "DISCONNECT",
    "SAVE", // Flatpeak now automatically saves the tariff before returning this `tariff_summary` page.
    "CLOSE",
    "BACK"
  ],
  "data": {
    "connection_type": "MARKET",
    "currency_code": "GBP",
    "market_rates_source": true,
    "provider": {
      "id": "prv_65de48b2977276d02acdb481",
      "display_name": "British Gas",
      "logo_url": "https://s.flatpeak.com/7276d02acdb481.png"
    },
    "tariff": {
      "status": "CONNECTED",
      "name": "Flex Next Go",
      "structure_type": "MARKET",
      "contract_start_date": "2023-06-15T00:00:00+02:00",
      "contract_end_date": "2024-06-15T00:00:00+02:00",
      "contract_term_type": "FIXED",
      "tiered": false
    },
    "rates": { 
    "prices": { 
      "yesterday": [],
      "today": [
        {
          "valid_from": "2024-02-01T00:00:00+02:00",
          "valid_to": "2024-02-01T22:00:00+02:00",
          "price": {
            "cost": 0.12,
            "confidence": 1
          }
        },
        {
          "valid_from": "2024-02-01T22:00:00+02:00",
          "valid_to": "2024-02-01T00:00:00+02:00",
          "price": {
            "cost": 0.09,
            "confidence": 1
          }
        }
      ],
      "tomorrow": [
        {
          "valid_from": "2024-02-02T00:00:00+02:00",
          "valid_to": "2024-02-02T06:00:00+02:00",
          "price": {
            "cost": 0.09,
            "confidence": 1
          }
        },
        {
          "valid_from": "2024-02-02T06:00:00+02:00",
          "valid_to": "2024-02-03T00:00:00+02:00",
          "price": {
            "cost": 0.12,
            "confidence": 1
          }
        }
      ]
    }
  }
}
Deprecated. The session now completes automatically once the customer reaches the Tariff Summary page.
Review the Tariff summary (Δ) section above for implementation.

Other endpoints changes summary:

GET /tariffs/rates/{id} 
POST /prices/{id} 

QUERY-PARAMS // all except location_id depreciated

{
  "start_time": "2023-06-15T09:00:00Z", 
  "end_time": "2023-06-15T23:00:00Z", 
  "tariff_direction": "IMPORT"
}
GET /tariffs/audits/{id} 
POST /audits/prices/{id} 

QUERY-PARAMS // all except location_id depreciated

{
  "start_time": "2023-06-15T09:00:00Z", 
  "end_time": "2023-06-15T23:00:00Z", 
  "tariff_direction": "IMPORT"
}

Schedule energy

Endpoints changes summary:

GET /slots/time/{id} 
POST /schedules/duration/{id} 

{
  "start_time": "2023-06-15T09:00:00Z",
  "end_time": "2023-06-16T09:00:00Z",
  "tariff": "IMPORT",  
  "tariff_direction": "IMPORT",  
  "segment": "HIGH",
  "duration": 60
}
GET /slots/threshold/{id} 
POST /schedules/limit/{id} 

{
  "start_time": "2023-06-15T09:00:00Z",
  "end_time": "2023-06-16T09:00:00Z",
  "tariff": "IMPORT",  
  "tariff_direction": "IMPORT",  
  "segment": "HIGH",
  "relative": 0.1,
  "absolute": 0.17
}
POST /schedules 
POST /schedules/amount/{id} 

{
  "max_power": {
    "units": "W",
    "value": 14000
  },
  "shaving_threshold": {
    "relative": 0.83,
    "absolute": 0.123
  },
  "data": [
    {
      "device_id": "dev_65e6d8334c8d715963d99db3",
      "direction": "IMPORT", 
      "tariff_direction": "IMPORT", 
      "start_time": "2022-02-01T20:14:00Z",
      "end_time": "2022-02-02T06:00:00Z",
      "max_power": {
        "units": "W",
        "value": 7000
      },
      "energy": {
        "units": "WH",
        "value": 24500
      }
    }
  ]
}

Calculate cost

Minor consistency improvements across all endpoints, including Metering.

Endpoints changes summary:

[
  {
    "location_id": "loc_641b90b758fb8e6293716e40",
    "device_id": "dev_65e6d8334c8d715963d99db3",
    "session_reference_id": "SESSION1234567890",
    "record_reference_id": "MET1234567890",
    "direction": "IMPORT", 
    "energy_flow_direction": "INBOUND", 
    "tariff_rate": "IMPORT", 
    "tariff_direction": "IMPORT", 
    "measurand": "TRANSFERRED", // depreciated
    "units": "W",
    "confidence": 1,
    "value": 20567,
    "start_time": "2022-02-01T10:30:00Z",
    "end_time": "2022-02-01T11:00:00Z"
  }
]
QUERY-PARAM: "include_tariff"
QUERY-PARAM: "include_carbon"

{
  "location_id": "loc_641b90b758fb8e6293716e40",
  "device_id": "dev_65e6d8334c8d715963d99db3",
  "session_reference_id": "SESSION1234567890",
  "record_reference_id": "MET1234567890",
  "direction": "IMPORT", 
  "energy_flow_direction": "INBOUND", 
  "tariff_rate": "IMPORT", 
  "tariff_direction": "IMPORT", 
  "measurand": "TRANSFERRED", // depreciated
  "units": "W",
  "confidence": 1,
  "value": 20567,
  "start_time": "2022-02-01T10:30:00Z",
  "end_time": "2022-02-01T11:00:00Z"
}
QUERY-PARAM: "include_tariff" // now implicit
QUERY-PARAM: "include_carbon" // depreciated
QUERY-PARAM: "direction"
QUERY-PARAM: "tariff_direction"

{
  "id": "ecs_65ea3fb185c1541f247c251e",
  "object": "energy_cost",
  "object_id": "dev_65e6d8334c8d715963d99db3",
  "live_mode": true,
  "direction": "IMPORT", 
  "tariff_direction": "IMPORT", 
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "energy_units": "WH",
  "carbon_units": "gCO2eq",
  "data": [
    {
      "start_time": "2022-02-01T10:30:00Z",
      "end_time": "2022-02-01T11:00:00Z",
      "session_reference_id": "SESSION1234567890",
      "record_reference_id": "MET1234567890",
      "energy": {
        "value": 10284
      },
      "tariff": { 
      "cost": { 
        "value": 928.372,
        "confidence": 1
      }, 
      "carbon": { // depreciated
        "value": 35.24, 
        "confidence": 0.8
      } 
    }
  ],
  "account_id": "acc_661677911f2197045e6cf1b1"
}
QUERY-PARAM: "include_tariff" // now implicit
QUERY-PARAM: "include_carbon" // depreciated
QUERY-PARAM: "direction"
QUERY-PARAM: "tariff_direction"

{
  "id": "ecs_65ea3fb185c1541f247c251e",
  "object": "energy_cost",
  "object_id": "dev_65e6d8334c8d715963d99db3",
  "live_mode": true,
  "direction": "IMPORT", 
  "tariff_direction": "IMPORT", 
  "location_timezone": "Europe/London",
  "currency_code": "EUR",
  "energy_units": "WH",
  "carbon_units": "gCO2eq",
  "data": [
    {
      "start_time": "2022-02-01T10:30:00Z",
      "end_time": "2022-02-01T11:00:00Z",
      "session_reference_id": "SESSION1234567890",
      "record_reference_id": "MET1234567890",
      "energy": {
        "value": 10284
      },
      "tariff": { 
      "cost": { 
        "value": 928.372,
        "confidence": 1
      }, 
      "carbon": { // depreciated
        "value": 35.24, 
        "confidence": 0.8
      } 
    }
  ],
  "account_id": "acc_661677911f2197045e6cf1b1"
}