POST
/
connect
/
tariff
/
token
curl --request POST \
  --url https://api.flatpeak.com/connect/tariff/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "direction": "IMPORT",
  "type": "COMMODITY",
  "callback_uri": "https://webhook.site/4623e56fc5c1",
  "connect_web_uri": "http://localhost:7070",
  "customer_id": "cus_65e421d1daa4a24082b4f590",
  "customer_reference_id": "CUS0123456789",
  "location_id": "loc_641b90b758fb8e6293716e40",
  "location_reference_id": "LOC0123456789",
  "tariff_id": "trf_6597ef46529ab4467502af0b",
  "postal_address": {
    "address_line1": "1-3",
    "address_line2": "Strand",
    "city": "London",
    "state": "Greater London",
    "post_code": "WC2N 5EH",
    "country_code": "GB"
  }
}'
{
  "connect_token": "cot_65df3e949a785c52283026ec",
  "expires_in": 86400,
  "live_mode": true
}
When you want to enable a customer to view the summary of their tariff anywhere in your app, update it or even revoke tariff access, specify a location_id in the request body. When you launch Connect, it will return the summary screen enabling tariff connection management.

Authorizations

Authorization
string
headerrequired

Authenticate with bearer_token you obtained from /login endpoint.

Body

application/json
direction
string
default: IMPORT

Indicates tariff direction you want to work with. Set to IMPORT or EXPORT.

type
string
default: COMMODITY

Indicates tariff type you want to work with. Set to COMMODITY or NON_COMMODITY.

callback_uri
string
required

URI where you will receive callback at session end.

connect_web_uri
string

Connect-web URL. Required for Connect-web & Hosted connect. Not required for Connect-headless.

customer_id
string

FlatPeak customer_id. Connect will add or update the location for the customer ID you specified.

customer_reference_id
string

An ID for the customer from your system. Supply when you want to create a customer with this reference.

location_id
string

FlatPeak location_id. Specify when you want to show the tariff summary to the customer. Connect will return tariff summary route objects enabling your customer to manage tariff connection for that location.

location_reference_id
string

An identifier for a location from your system. Supply when you want to create a new location in FlatPeak with this reference. You can only supply either location_id or location_reference but not both.

tariff_id
string

FlatPeak tariff_id. Specify when you want to get customer to update specific tariff element. Use this parameter after receiving tariff event type webhooks, such as when tariff has expired.

postal_address
object

Information on the postal address.

Response

200 - application/json
connect_token
string

The connect_token.

expires_in
integer

Expiration time in seconds.

live_mode
boolean

Set to true if the object exists in live mode.