Web Control Center & REST API
The MTM Matrix Signs system includes an asynchronous HTTP REST API and a standalone Web Control Center. This allows dispatchers, control room operators, and external CAD/MDT systems to monitor and manipulate highway matrix signs in real time from any web browser outside the FiveM client.
Security Advisory: API Configuration
Section titled “Security Advisory: API Configuration”The built-in Web API exposes an HTTP listener on your FiveM server port (default 30121).
-- In config.lua:Config.EnableWebAPI = false -- Set to false if you do not use external website controlIf you do choose to enable the Web API (Config.EnableWebAPI = true), always configure a strong, secret API Key in Config.WebApiKey:
Config.WebApiKey = "YOUR_SECURE_SECRET_KEY_HERE"Standalone Web Server (Local Operator Mode)
Section titled “Standalone Web Server (Local Operator Mode)”For local dispatch operators who want a dedicated browser window on a secondary monitor:
- Navigate to the
MTM-MATRIXBORDENdirectory on your machine. - Run
START_WEB_SERVER.bat. This launchesnode web_server.json local port3000. - Open your browser at
http://localhost:3000. - The local server provides a proxy that securely routes API requests to your FiveM server while providing a fullscreen interface.
Hosting on an External Web Server
Section titled “Hosting on an External Web Server”You can deploy the standalone web interface to your own web hosting environment (such as Nginx, Apache, Vercel, or a CAD/MDT subfolder):
- Upload the entire contents of the
web/directory to your web server. - Open
web/config.jsin your code editor. - Configure your server URL, API key, and preferred sync interval as shown in the example below.
window.CONFIG = { // The public IP and port of your FiveM server (with resource route) SERVER_URL: 'http://YOUR_SERVER_IP:30121/MTM-MATRIXBORDEN',
// Secret API Key (must match Config.WebApiKey in config.lua) API_KEY: 'YOUR_SECURE_SECRET_KEY_HERE',
// How frequently the web map polls for live server updates (in ms) SYNC_INTERVAL: 1500,
// Default language ('nl' or 'en') DEFAULT_LANGUAGE: 'en'};REST API Reference
Section titled “REST API Reference”All requests must be addressed to http://<SERVER_IP>:<PORT>/MTM-MATRIXBORDEN/api/<ENDPOINT>.
Authentication
Section titled “Authentication”If Config.WebApiKey is set in config.lua, every request must provide the API key using one of the following methods:
- HTTP Header:
X-Api-Key: YOUR_KEYorAuthorization: Bearer YOUR_KEY - URL Query Parameter:
?apikey=YOUR_KEY
If the key is missing or invalid, the API returns 401 Unauthorized.
1. Get Active Matrix Signs (GET /api/active)
Section titled “1. Get Active Matrix Signs (GET /api/active)”Retrieves a real-time list of all currently active matrix signs across the entire map.
- Endpoint:
GET /api/active - Method:
GET - Headers:
X-Api-Key: <key>(optional if no key configured)
curl -X GET "http://YOUR_SERVER_IP:30121/MTM-MATRIXBORDEN/api/active" \ -H "X-Api-Key: YOUR_SECRET_KEY"const response = await fetch('http://YOUR_SERVER_IP:30121/MTM-MATRIXBORDEN/api/active', { method: 'GET', headers: { 'X-Api-Key': 'YOUR_SECRET_KEY' }});const data = await response.json();console.log(data);Success Response (200 OK):
Section titled “Success Response (200 OK):”{ "success": true, "timestamp": 1786997102, "activeMarkers": { "2517.14_-25.38_97.32": { "coords": [2517.14966, -25.38, 97.32], "heading": 85.0, "marker": "zeventig" }, "2519.50_-24.10_97.32": { "coords": [2519.50, -24.10, 97.32], "heading": 85.0, "marker": "kruis" } }}2. Spawn / Update Matrix Signs (POST /api/spawnmarkering)
Section titled “2. Spawn / Update Matrix Signs (POST /api/spawnmarkering)”Sets or updates signs on one or multiple lanes of a matrix gantry.
- Endpoint:
POST /api/spawnmarkering - Method:
POST - Headers:
Content-Type: application/json,X-Api-Key: <key>
Request Payload:
Section titled “Request Payload:”{ "data": [ { "marker": "zeventig", "coords": [2517.14966, -25.38, 97.32], "heading": 85.0 }, { "marker": "kruis", "coords": [2519.50, -24.10, 97.32], "heading": 85.0 } ]}Valid marker Values:
Section titled “Valid marker Values:”- Advisory Speeds:
"tien"(10 km/h)"twintig"(20 km/h)"dertig"(30 km/h)"veertig"(40 km/h)"vijftig"(50 km/h)"zestig"(60 km/h)"zeventig"(70 km/h)"tachtig"or"tachtig2"(80 km/h)"negentig"(90 km/h)"honderd"(100 km/h)"honderdtien"(110 km/h)"honderdtwintig"(120 km/h)"honderddertig"(130 km/h)
- Traffic Control Symbols:
"kruis"(Red Cross / Lane Closed)"ophef"(Clear / End of Restrictions)"pijl links"(Flashing Lane Change Arrow Left)"pijl rechts"(Flashing Lane Change Arrow Right)"pijlg"(Green Arrow / Lane Open)
- Warning Signs:
"file"(Traffic Jam / Congestion)"glad"(Slippery Road / Snowflake — Note: use"glad", not"gladheid")"ongeval"(Accident / Incident)"uitroepteken"(General Danger / Hazard)
- Off / Empty:
""ornull
Success Response (200 OK):
Section titled “Success Response (200 OK):”{ "success": true, "message": "Matrix signs updated", "activeMarkers": { ... }}3. Reset / Clear Matrix Signs (POST /api/resetmarkering)
Section titled “3. Reset / Clear Matrix Signs (POST /api/resetmarkering)”Deactivates signs on specified gantry lanes and removes active 3D props in-game.
- Endpoint:
POST /api/resetmarkering - Method:
POST - Headers:
Content-Type: application/json,X-Api-Key: <key>
Request Payload:
Section titled “Request Payload:”{ "data": [ { "marker": "", "coords": [2517.14966, -25.38, 97.32], "heading": 85.0 } ]}Success Response (200 OK):
Section titled “Success Response (200 OK):”{ "success": true, "message": "Matrix signs reset", "activeMarkers": { ... }}Error Responses
Section titled “Error Responses”| Status Code | Reason | Example Response |
|---|---|---|
401 Unauthorized |
Missing or invalid API key | {"success": false, "status": 401, "error": "Unauthorized: Invalid or missing API key"} |
400 Bad Request |
Malformed JSON or missing data array |
{"success": false, "error": "Missing payload data"} |