Making your first API call
Once you have your API key from your API Admin, you're ready to start querying data. Most endpoints use simple GET requests, with some requiring POST for more complex queries. All responses are provided as JSON.
A full list of available data can be found on the API Reference tab.
Example GET request
curl --request GET \
--url https://api.cornwall-insight.com/external/v1/tpc/overall_charges \
--header 'accept: application/json' \
--header 'api_key: ci_abc123xyz789'import requests
url = "https://api.cornwall-insight.com/external/v1/tpc/overall_charges"
headers = {
"accept": "application/json",
"api_key": "ci_abc123xyz789"
}
response = requests.get(url, headers=headers)
print(response.text)Example POST request
curl --request POST \
--url https://api.cornwall-insight.com/external/v1/network-charging/generate-forecast \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'api_key: ci_abc123xyz789' \
--data '{
"site": {
"connection_level": "transmission",
"technology": "Wind",
"postcode": "NR2 1EQ",
"alf": 30,
"capacity": 40
},
"forecast_options": {
"scenario": "Central",
"run": "H125"
}
}'import requests
url = "https://api.cornwall-insight.com/external/v1/network-charging/generate-forecast"
payload = {
"site": {
"connection_level": "transmission",
"technology": "Wind",
"postcode": "NR2 1EQ",
"alf": 30,
"capacity": 40
},
"forecast_options": {
"scenario": "Central",
"run": "H125"
}
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"api_key": "ci_abc123xyz789"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Example response
[{
"run": "H125",
"scenario": "Central",
"zone": 10,
"zone_name": "South West Scotland",
"forecast_year": 2025,
"peak_security": 1.81,
"total": 0.665,
"cost": 66516.10
}]Updated about 2 months ago