Getting Started
Getting Started¶
Welcome to GLocalFlex Marketplace! This guide will help you get started with using the marketplace and executing trades.
In this guide the following steps are explained.
- Create a trading account on the marketplace.
- Check out the REST API submit order example
1. Account Setup
Go to the GLocalFlex Marketplace test environment and create a trading account.
Info
If the sign up link is not visible, please contact the marketplace administrator to open the registration for you.
During the registration process you will create a username and password that is used to authenticate with OAuth2.0. Quick start examples including authentication can be found in the Quick Start Guide or in the OpenAPI reference.
You can also test the marketplace API interactively in the Swagger UI.
2. Example code
To get started with the basic example client. Please check the quick guide below with the REST API example or see the full Python Example to submit an flexibility sell or buy order to the marketplace.
Quick Start with REST API¶
Here you find minimal code examples that show the basic HTTP requests to the authentication, trading and verification endpoints.
For more details about all available REST API endpoints and more examples check the reference specification.
If you want to use the full Python examples please follow the additional examples.
Note
You can use any programming language and library that supports HTTP requests to interact with the GlocalFlexMarket API.
Prerequisite
- User created account on https://test.glocalflexmarket.com
- curl
- User created account on https://test.glocalflexmarket.com
- Python version: >= 3.10
Dependencies:
- pip install "requests>=2.31.0"
Authentication¶
Request an access token with username and password.
Note
The username and password is only send once to the authentication endpoint to get an access token and refresh token. The access token has a expiration time, and can be renewed with the refresh token.
The REST API endpoints only require the access token to be send in the HTTP header to make a request.
Example
curl -X POST https://test.glocalflexmarket.com/auth/oauth/v2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=glocalflexmarket_public_api" \
-d "grant_type=password" \
-d "username=$USER" \
-d "password=$PASSWORD"
# copy the access token and refresh token from response or set as environment variables
export TOKEN="YOUR_ACCESS_TOKEN"
export REFRESH_TOKEN="YOUR_ACCESS_TOKEN"
# check the access token
echo $TOKEN
"""Request an access token with username and password"""
import requests
payload = {
"client_id": "glocalflexmarket_public_api",
"grant_type": "password",
"username": YOUR_USERNAME,
"password": YOUR_PASSWORD,
}
response = requests.post(
"https://test.glocalflexmarket.com/auth/oauth/v2/token",
data=payload,
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
Renew access and refresh token
Example
curl -X POST https://test.glocalflexmarket.com/auth/oauth/v2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=glocalflexmarket_public_api" \
-d "grant_type=refresh_token" \
-d "refresh_token=$REFRESH_TOKEN"
export TOKEN="YOUR_ACCESS_TOKEN"
export REFRESH_TOKEN="YOUR_ACCESS_TOKEN"
import requests
payload = {
"client_id": "glocalflexmarket_public_api",
"grant_type": "refresh_token",
"refresh_token": YOUR_REFRESH_TOKEN,
}
response = requests.post(
"https://test.glocalflexmarket.com/auth/oauth/v2/token",
data=payload,
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
Trading API¶
The trading API allows you to submit buy or sell orders to the marketplace and cancel an order.
Submit flexibility order¶
Create a buy or sell order and submit to the marketplace using the access token for authentication.
Note
Delivery start and delivery end
Delivery start and delivery end are future timestamps in UTC timezone
Delivery start has to be before the delivery end. Expiry time has to be before the delivery start.
The minimum market time unit is 15 minutes. Delivery start and delivery end have to be rounded to the nearest quarter 00, 15, 30, 45 and seconds are set to 0.
Examples:
"delivery_start": "2026-02-26T11:00:00Z"
"delivery_end": "2026-02-26T12:15:00Z"
Expiry time
Expiry time is a future timestamp in UTC timezone Expiry time can be specified with seconds and milliseconds accuracy and does not have to be rounded to the nearest quarter. The expiry time has to be before the delivery start.
Examples:
"expiry_time": "2026-02-26T10:00:00Z"
or
"expiry_time": "2026-02-26T10:00:00:100Z"
Note
Sell orders require a baseline object before the order is added to the matching process. Sell orders with no baseline are accepted but will not be matched until a baseline is submitted. The baseline and metering data object can be submitted to the verification endpoint /verification/baseline and /verification/metering (order ID received during order creation is required).
Sell order example¶
Example
curl -X POST https://test.glocalflexmarket.com/api/v1/order \
-H "Authorization:Bearer $TOKEN" \
-d '{
"side": "sell",
"power": 1000,
"price": 1,
"delivery_start": "2026-08-01T10:00:00Z",
"delivery_end": "2026-08-01T11:00:00Z",
"expiry_time": "2026-08-01T09:00:00Z",
"location": {
"location_id": [
"FI_123435"
],
"country_code": "FI"
},
"baseline": {
"metering_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"created_at": "2026-08-01T08:00:00Z",
"reading_start": "2026-08-01T10:00:00Z",
"reading_end": "2026-08-01T11:00:00Z",
"resolution": 900,
"unit_measured": "kWh",
"data_points": [
{
"timestamp": "2026-08-01T11:15:00Z",
"value": 1
},
{
"timestamp": "2026-08-01T11:30:00Z",
"value": 1
},
{
"timestamp": "2026-08-01T11:45:00Z",
"value": 1
},
{
"timestamp": "2026-08-01T12:00:00Z",
"value": 1
}
]
}
}'
"""send an order request to the marketplace"""
import requests
import datetime as dt
from datetime import datetime
import json
def format_time(t: datetime) -> str:
return t.strftime("%Y-%m-%dT%H:%M:%S") + "Z"
def round_quarter(t: datetime) -> datetime:
"""Round the time to the nearest quarter hour 00, 15, 30, 45"""
minute = t.minute
if minute % 15 != 0:
t += dt.timedelta(minutes=15 - (minute % 15))
return t.replace(second=0, microsecond=0)
time_now = datetime.now(dt.timezone.utc)
delivery_start = round_quarter(time_now + dt.timedelta(hours=1))
delivery_end = round_quarter(time_now + dt.timedelta(hours=2))
expiry_time = time_now + dt.timedelta(seconds=60)
order = {
"side": "sell",
"power": 1000,
"price": 0.10,
"delivery_start": format_time(delivery_start),
"delivery_end": format_time(delivery_end),
"expiry_time": format_time(expiry_time),
"location": {
"location_id": ["some_id"],
"country_code": "CZ",
}, # optional CZ, CH, ES, DE, FI, FR
"baseline": {
"metering_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"created_at": "2026-02-25T10:00:00Z",
"reading_start": format_time(delivery_start),
"reading_end": format_time(delivery_end),
"resolution": 60*15, # 15 minutes
"unit_measured": "kWh",
"data_points": [
{
"timestamp": "2026-02-26T11:15:00Z",
"value": 0.25
},
{
"timestamp": "2026-02-26T11:30:00Z",
"value": 0.25
},
{
"timestamp": "2026-02-26T11:45:00Z",
"value": 0.25
},
{
"timestamp": "2026-02-26T12:00:00Z",
"value": 0.25
}
]
}
}
headers = {
"Authorization": f"Bearer {YOUR_ACCESS_TOKEN}",
"Content-Type": "application/json",
}
response = requests.post(
"https://test.glocalflexmarket.com/api/v1/order/",
headers=headers,
json=order
)
print(json.dumps(order, indent=4))
print(response.text)
Buy order example¶
Example
curl -X POST https://test.glocalflexmarket.com/api/v1/order \
-H "Authorization:Bearer $TOKEN" \
-d '{
"side": "buy",
"power": 1000,
"price": 1,
"delivery_start": "2026-02-26T11:00:00Z",
"delivery_end": "2026-02-26T12:00:00Z",
"expiry_time": "2026-02-26T10:00:00Z",
"location": {"location_id": ["some_id"],
"country_code": "CZ"}
}'
"""send an order request to the marketplace"""
import requests
import datetime as dt
from datetime import datetime
import json
def format_time(t: datetime) -> str:
return t.strftime("%Y-%m-%dT%H:%M:%S") + "Z"
def round_quarter(t: datetime) -> datetime:
"""Round the time to the nearest quarter hour 00, 15, 30, 45"""
minute = t.minute
if minute % 15 != 0:
t += dt.timedelta(minutes=15 - (minute % 15))
return t.replace(second=0, microsecond=0)
time_now = datetime.now(dt.timezone.utc)
delivery_start = round_quarter(time_now + dt.timedelta(hours=1))
delivery_end = round_quarter(time_now + dt.timedelta(hours=2))
expiry_time = time_now + dt.timedelta(seconds=60)
order = {
"side": "buy",
"power": 1000,
"price": 1,
"delivery_start": format_time(delivery_start),
"delivery_end": format_time(delivery_end),
"expiry_time": format_time(expiry_time),
"location": {
"location_id": ["some_id"],
"country_code": "CZ",
}, # optional CZ, CH, ES, DE, FI, FR
}
headers = {
"Authorization": f"Bearer {YOUR_ACCESS_TOKEN}",
"Content-Type": "application/json",
}
response = requests.post(
"https://test.glocalflexmarket.com/api/v1/order",
headers=headers,
json=order
)
print(json.dumps(order, indent=4))
print(response.text)
Get order status by ID¶
Use the order_id from submit order example response and get the status of the order
Example
Cancel Order by ID
Use the order_id from submit order example response and cancel the order
Example
Flexibility Verification API¶
The baseline and the metering data are required only for sell orders. The metering data has to be submitted to the verification endpoint after the flexibility activation. The baseline can be submitted directly during order creation see /order endpoint) or after the order is created through the verification API. The metering and baseline data object shares the same structure.
Submit Baseline Data¶
Example
curl -X POST https://test.glocalflexmarket.com/api/v1/verification/metering -H "Authorization:Bearer $TOKEN" \
-d '{
"order_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"measurement_type": "baseline",
"metering_data": {
"metering_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"created_at": "2026-08-24T14:15:00Z",
"reading_start": "2026-08-24T14:00:00Z",
"reading_end": "2026-08-24T14:30:00Z",
"resolution": 900,
"unit_measured": "kWh",
"data_points": [
{
"timestamp": "2026-08-24T14:15:00Z",
"value": 1
},
{
"timestamp": "2026-08-24T14:30:00Z",
"value": 1
}
]
}
}'
Submit Metering Data¶
Example
curl -X POST https://test.glocalflexmarket.com/api/v1/verification/metering -H "Authorization:Bearer $TOKEN" \
-d '{
"order_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"measurement_type": "metering",
"metering_data": {
"metering_id": "ce15bc33-2bda-4d26-8ddd-b958b22b569b",
"created_at": "2026-08-24T14:30:00Z",
"reading_start": "2026-08-24T14:00:00Z",
"reading_end": "2026-08-24T14:30:00Z",
"resolution": 900,
"unit_measured": "kWh",
"data_points": [
{
"timestamp": "2026-08-24T14:15:00Z",
"value": 0.79
},
{
"timestamp": "2026-08-24T14:30:00Z",
"value": 0.11
}
]
}
}'