Overview
Introduction
Your customers can charge at MGLBG Charge charge points in Bulgaria and start the charge from your own app. You connect once to the MagicLine Roaming Hub over OCPI 2.2.1. The hub gives you our station data and your prices, relays start and stop commands, reports sessions and charge detail records, and produces a monthly settlement statement.
This documentation is for e-mobility service providers (eMSPs) that want to give their drivers access to our network.
| Topic | What it means for you |
|---|---|
| Network | MGLBG Charge charge points in Bulgaria, published under the OCPI party BG*MGL |
| Protocol | OCPI 2.2.1 |
| Your role | eMSP: your customers charge on our charge points |
| How drivers start | From your app (remote start and stop) |
| Who pays whom | You bill your driver; we invoice you monthly from the settlement statement |
| Availability | Integration testing first; production access per partner after testing and a signed agreement |
How a charge works
A driver finds our charge point in your app, starts and stops the charge there, and you receive the final record with your price within seconds of the end. Your platform only talks to the hub; the hub drives the charge point.
- 1
Your platformHubyour polling interval
Pull locations and tariffs
Only charge points enabled for your company are returned, each with your partner-specific tariff.
- 2
Your platformHub
Driver taps start:
START_SESSIONThe hub answers at once; the final result follows at your response_url.
- 3
HubYour platformanswer within 10 s
Is this token allowed to charge?
Real-time authorization on your Tokens endpoint. Any answer other than
ALLOWEDstops the start. - 4
HubCharge pointup to 2 min
Start charging
If the cable is not plugged in yet, the charge point waits for it.
- 5
HubYour platform
Command result
ACCEPTED, sessionACTIVEStatus changes arrive at once; energy and the amount at your price about once a minute.
- 6
Your platformHub
Driver taps stop:
STOP_SESSIONOr the driver ends the charge at the vehicle or the charge point.
- 7
HubYour platformseconds after the end
Charge detail record (CDR) with your price
One CDR per completed session with energy. A session that never started or delivered no energy has none.
- 8
HubYour platformmonthly
Monthly settlement statement and invoice
Built from the CDRs of the month.
Get started
Onboarding runs from a signed agreement through a test connection to production. Connection details are shared only privately.
- Contact and agreement. We agree your price rule, payment terms and data processing terms.
- Company details. Legal name, VAT number, address, bank details, technical and commercial contacts, your OCPI party ID and role.
- Test connection. We register your company in the test environment and send you a one-time registration token and our versions address through an agreed secure channel.
- End-to-end tests. Location and tariff pulls, start and stop, real-time authorization, sessions and CDRs.
- Production. Registered separately, with a new one-time token. We then enable our charge points for your company.
- Settlement. Monthly statements start with your first production charge.
Integration
Connection and authentication
Registration follows the OCPI 2.2.1 Credentials module. You call our credentials endpoint once with the one-time token; the hub reads your versions endpoint and the two sides exchange new tokens. From then on every call, in both directions, carries the token of the receiving side.
GET https://<hub address, shared at onboarding>/ocpi/2.2.1/locations?limit=50
Authorization: Token <base64 of the token>
X-Request-ID: 7b0c3f0e-5d1a-4c55-9a7e-2f3b1c9d8e01
X-Correlation-ID: 7b0c3f0e-5d1a-4c55-9a7e-2f3b1c9d8e01
OCPI-from-country-code: BG
OCPI-from-party-id: ABC- HTTPS only, with a certificate from a publicly trusted authority.
- The token is sent Base64-encoded, as OCPI 2.2.1 specifies:
Authorization: Token <base64>. - Send
X-Request-IDandX-Correlation-IDon every request, and theOCPI-from-*headers with your own party. - Field names and formats follow the OCPI 2.2.1 specification; all timestamps are UTC.
Modules
| OCPI module | Hub's role toward you | Your platform |
|---|---|---|
| Versions, Credentials | Sender and receiver | Registers once; tokens are then exchanged automatically |
| Locations | Sender | Pulls locations |
| Tariffs | Sender | Pulls your partner-specific tariffs |
| Commands | Receiver | Sends START_SESSION and STOP_SESSION |
| Tokens | Calls your Sender | Answers real-time authorization within 10 seconds |
| Sessions | Sender, pushes to your Receiver | Receiver optional; otherwise pull |
| CDRs | Sender, pushes to your Receiver | Receiver optional; otherwise pull |
Locations
Pull our charge points with date_from and date_to (on last_updated) and offset/limit paging; follow the Link header for the next page. A single location, EVSE or connector can be read by its path. Changes reach the hub within about a minute.
GET https://<hub address, shared at onboarding>/ocpi/2.2.1/locations?date_from=2026-11-18T00:00:00Z&offset=0&limit=50{
"data": [
{
"country_code": "BG",
"party_id": "MGL",
"id": "0195a3b4-0000-7000-8000-000000000001",
"publish": true,
"name": "Example station",
"address": "1 Example Blvd",
"city": "Sofia",
"country": "BGR",
"coordinates": { "latitude": "42.697700", "longitude": "23.321900" },
"time_zone": "Europe/Sofia",
"evses": [
{
"uid": "0195a3b4-0000-7000-8000-000000000101",
"evse_id": "BG*MGL*E000001*1",
"status": "AVAILABLE",
"capabilities": ["REMOTE_START_STOP_CAPABLE"],
"connectors": [
{
"id": "1",
"standard": "IEC_62196_T2",
"format": "SOCKET",
"power_type": "AC_3_PHASE",
"max_voltage": 230,
"max_amperage": 32,
"max_electric_power": 22000,
"tariff_ids": ["<your tariff id>"],
"last_updated": "2026-11-18T09:00:00Z"
}
],
"last_updated": "2026-11-18T09:00:00Z"
}
],
"last_updated": "2026-11-18T09:00:00Z"
}
],
"status_code": 1000,
"status_message": "Success",
"timestamp": "2026-11-18T09:00:05Z"
}Use the EVSE uid to start
START_SESSION names the location id and the EVSE uid. The evse_id is the readable ID to show to drivers.Tariffs
The tariffs you pull are yours alone: they carry the price agreed for your company. Prices are per kWh, excluding VAT, with the VAT rate. Each connector points to its tariff through tariff_ids.
{
"country_code": "BG",
"party_id": "MGL",
"id": "<your tariff id>",
"currency": "EUR",
"elements": [
{ "price_components": [ { "type": "ENERGY", "price": 0.4167, "vat": 20.0, "step_size": 1 } ] }
],
"last_updated": "2026-11-18T09:00:00Z"
}Commands: start and stop
Send START_SESSION with the driver's token and the EVSE. The hub answers at once with ACCEPTED and a timeout; the outcome follows as a CommandResult posted to your response_url within that timeout.
POST https://<hub address, shared at onboarding>/ocpi/2.2.1/commands/START_SESSION
{
"response_url": "https://<your platform>/ocpi/2.2.1/commands/START_SESSION/8f1d2c3b",
"token": {
"country_code": "BG",
"party_id": "ABC",
"uid": "TOKEN-123",
"type": "APP_USER",
"contract_id": "BG-ABC-C00000001",
"issuer": "Your company",
"valid": true,
"whitelist": "NEVER",
"last_updated": "2026-11-18T09:05:00Z"
},
"location_id": "0195a3b4-0000-7000-8000-000000000001",
"evse_uid": "0195a3b4-0000-7000-8000-000000000101"
}{ "data": { "result": "ACCEPTED", "timeout": 230 }, "status_code": 1000, "status_message": "Success", "timestamp": "2026-11-18T09:05:01Z" }{ "result": "ACCEPTED" }| Value | Meaning |
|---|---|
ACCEPTED | Charging started (or, for a stop, the charge ended) |
REJECTED | Not allowed: your authorization answer, or the charge point refused |
EVSE_OCCUPIED | The connector is in use |
EVSE_INOPERATIVE | The charge point is offline, closed or faulted |
TIMEOUT | The cable was not plugged in, or the charge point did not respond in time |
FAILED | Any other failure |
To stop, send STOP_SESSION with the session_id of the Session object. A stop for a session that is not yours is answered with UNKNOWN_SESSION; for a session that has already ended, the result at your response_url is FAILED.
POST https://<hub address, shared at onboarding>/ocpi/2.2.1/commands/STOP_SESSION
{ "response_url": "https://<your platform>/ocpi/2.2.1/commands/STOP_SESSION/9a2e4d5c", "session_id": "0195b000-0000-7000-8000-000000000001" }Sessions
While a charge runs you receive the Session object with status, energy and total_cost at your price. If you expose a Sessions receiver, the hub pushes the full object with PUT; otherwise pull GET /sessions with the same paging as Locations. Status changes arrive at once, energy about once a minute.
PUT https://<your platform>/ocpi/2.2.1/sessions/BG/MGL/0195b000-0000-7000-8000-000000000001
{
"country_code": "BG",
"party_id": "MGL",
"id": "0195b000-0000-7000-8000-000000000001",
"start_date_time": "2026-11-18T09:05:20Z",
"kwh": 4.32,
"cdr_token": { "country_code": "BG", "party_id": "ABC", "uid": "TOKEN-123", "type": "APP_USER", "contract_id": "BG-ABC-C00000001" },
"auth_method": "COMMAND",
"location_id": "0195a3b4-0000-7000-8000-000000000001",
"evse_uid": "0195a3b4-0000-7000-8000-000000000101",
"connector_id": "1",
"currency": "EUR",
"total_cost": { "excl_vat": 1.80, "incl_vat": 2.16 },
"status": "ACTIVE",
"last_updated": "2026-11-18T09:07:00Z"
}Statuses: PENDING (waiting for the cable or starting), ACTIVE, COMPLETED, and INVALID for a start that never happened.
Charge detail records
Every completed session with energy produces one CDR, a few seconds after the end. Its total_cost is your price. A CDR is never changed. If you expose a CDRs receiver, the hub posts it there and retries for 24 hours; you can always pull GET /cdrs, where date_from and date_to refer to when the hub received the record.
POST https://<your platform>/ocpi/2.2.1/cdrs
{
"country_code": "BG",
"party_id": "MGL",
"id": "0195b000-0000-7000-8000-000000000001",
"start_date_time": "2026-11-18T09:05:20Z",
"end_date_time": "2026-11-18T09:35:20Z",
"session_id": "0195b000-0000-7000-8000-000000000001",
"cdr_token": { "country_code": "BG", "party_id": "ABC", "uid": "TOKEN-123", "type": "APP_USER", "contract_id": "BG-ABC-C00000001" },
"auth_method": "COMMAND",
"cdr_location": {
"id": "0195a3b4-0000-7000-8000-000000000001",
"name": "Example station",
"address": "1 Example Blvd",
"city": "Sofia",
"country": "BGR",
"coordinates": { "latitude": "42.697700", "longitude": "23.321900" },
"evse_uid": "0195a3b4-0000-7000-8000-000000000101",
"evse_id": "BG*MGL*E000001*1",
"connector_id": "1",
"connector_standard": "IEC_62196_T2",
"connector_format": "SOCKET",
"connector_power_type": "AC_3_PHASE"
},
"currency": "EUR",
"charging_periods": [ { "start_date_time": "2026-11-18T09:05:20Z", "dimensions": [ { "type": "ENERGY", "volume": 7.5 } ] } ],
"total_cost": { "excl_vat": 3.13, "incl_vat": 3.75 },
"total_energy": 7.5,
"total_time": 0.5,
"last_updated": "2026-11-18T09:35:25Z"
}Status codes
Every response uses the OCPI envelope. These are the status codes the hub returns.
| status_code | HTTP | Meaning |
|---|---|---|
| 1000 | 200 | Success |
| 2000 | 401 | Missing or invalid token |
| 2000 | 403 | Not allowed for your company, or your company is not active |
| 2001 | 400 | Invalid or missing parameters |
| 2003 | 404 | Unknown location |
| 3001 | 400 | Registration could not use your API (your versions endpoint was not reachable) |
| 3002 | 400 | No common OCPI version (2.2.1 is required) |
| 3003 | 400 | Your 2.2.1 endpoints do not include credentials |
| 3000 | 500 | Server error; retry later |
Business
Pricing and settlement
You pay the price agreed for your company, once a month, from a statement built on the CDRs.
| Topic | How it works |
|---|---|
| Price rule | Agreed per partner: our standard tariff, a percentage discount on it, or a fixed price per kWh (AC and DC can differ) |
| Price stability | The price is fixed when the session starts; a later tariff change does not affect a running charge |
| Your driver's price | Your decision; we do not charge your drivers |
| Settlement period | Calendar month in the charge point's local time (Europe/Sofia), by session end |
| Statement | Number of CDRs, kWh and amounts excluding and including VAT, as a CSV file |
| Late records | A CDR that arrives after its month has ended is added to its own month and marked as late |
| Invoice and payment | We invoice you from the statement; payment terms are set in the agreement |
Reference
Security and data protection
- Encrypted transport. All traffic runs over HTTPS; unencrypted connections are refused.
- Credentials. The registration token works once and is replaced during registration. Credentials are stored encrypted, never written to logs, and can be revoked and reissued at any time.
- Separate environments. Test and production are fully separate, each with its own credentials.
- Data separation. You see only the charge points enabled for your company and only your own sessions and CDRs. Commands are accepted only for your own tokens and sessions.
- Data minimisation. Records carry the token ID and contract ID, never names, e-mail addresses or phone numbers.
- GDPR. Data processing terms are part of the agreement.
- Reporting a vulnerability. Write to info@magiclineenergy.com and do not publish details before we have responded.
Current scope
| Feature | Status |
|---|---|
| Station data and partner-specific tariffs | Supported |
| Remote start and stop from your app, real-time authorization | Supported |
| Sessions, CDRs, monthly settlement statement | Supported |
| Start with an RFID card at the charge point | Not yet |
| Reservations, smart charging (charging profiles) | Not offered |
| OCPI 2.3 | Not yet; 2.2.1 only |
Contact
To start, write to info@magiclineenergy.com with your company name, country, OCPI party ID and the number of drivers you expect to bring.