Freematics Hub is a telemetry data server which is highly efficient and works on systems of any footprint. The design goal is to seamlessly connect multiple telemetry data logging devices with applications that deals with telemetry data.

Freematics Hub receives data from remote telemetry devices, caches in memory, stores in disk files, and supplies the data in an organized way on request. As it caches data for a long duration, data logging devices and data processing programs can work at a different pace without missing any data samples. Data from multiple sources can also be aggregated and processed together with least efforts. Data are transmitted from device as UDP datagrams or HTTP transactions and available to peers requiring them by simple HTTP/REST APIs.


Feeding Data (from device to server)

A device collects data and feeds them to Freematics Hub by sending UDP datagrams or continuous HTTP GET or POST requests. The sequence is straight-forward as following.

  1. Notify server that a device is start data feeding (login)
  2. Send data to server (repeating)
  3. Notify server that a device has stopped data feeding (logout)
  4. Ping server with an interval to inform server that the device is online

A low-overhead payload format is defined for communication between server and device.

Event notification (UDP datagram)

<Device ID>#EV=<event ID>,SK=<server key>,TS=<device timestamp>,VIN=<vehicle ID>*<checksum>

* Server key is currently not used and can be omitted

Data transmission (UDP datagram)

<Device ID>#<PID 1>:<data 1>,<PID 2>:<data 2>,<PID 3>:<data 3 value 1>;<data 3 value 2>;<data 3 value 3>,…$<checksum>


Login and Logout

A device notifies server of events like login and logout. An event ID is a numeric value which indicates the type of event. A event notification can be sent by UDP or HTTP GET.  Login event (event ID 1) indicates the data transmission session is about to start and some identifications are submitted including Vehicle identification number (VIN) is used as A unique identifier. Logout event (event ID 2) indicates the data transmission session is about to end, most likely as a trip is over.

Notifying by UDP

A typical notifying request by UDP has the payload like following.

  • ABCDEFG is device ID
  • EV=1 indicates a login event
  • TS=… the current timestamp (normally the device timer counter)
  • VIN=… specifies the VIN which should be unique and is used to allocate Feed ID
  • *XX is the checksum (in hex) of all previous bytes

After server receives a UDP request, it replies a UDP datagram carrying a payload like following as a reply.

  • First number (in Hex) is the feed ID (arbitrary)
  • EV=n is the event ID from request
  • TS=… is the timestamp from the request
  • RX=… is the number of received requests/data transmissions
  • *XX is the checksum (in hex) of all previous bytes

Notifying by HTTP

Notifying request can also be sent by HTTP or more secure HTTPs request with the following request format. The definitions of parameters are identical to that with UDP.

http://<server host>/api/notify/[DEVICE ID]?EV=<event ID>&TS=<device timestamp>&VIN=<vehicle ID number>

HTTP Response on success


n is an arbitrary integer number which is used for subsequent data feeding referred as Feed ID.

HTTP Response on error

{"result":"failed","error":"Invalid server key"}
{"result":"failed","error":"Invalid VIN"}

Feeding data by UDP

Using UDP to feed live data is the most efficient for a device with a not always stable network communication. In this way, payloads containing a group of collected data and checksum are transmitted as UDP datagrams. For details of the payload format, refer to Freematics Packed Data Format.

For UDP transmission, a simple header containing device ID and a tail of checksum are added like following. Both are represented in hexadecimal.

<Device ID>#<PID 1>:<value 1>,<PID 2>:<value 2>,<PID 3>:<value 3>,...*<Checksum>



Feeding data by HTTP GET

Using a HTTP GET request to feed live data is easy for testing (even from browser). Multiple PID and value pairs are accepted as URL arguments for one request. PID numbers are in hex format and values are in decimal format (integer, float or semicolon separated values). It is required to transfer data with same timestamp by one HTTP GET transaction.

Request URL

http://<server host>/api/push/[DEVICE ID]?TS=[timestamp]&[pid1]=[value1]&[pid2]=[value2]...

Response (success)


n is the number of accepted PID/value pairs.

Response (erroneous)

{"result":"failed","error":"Invalid server key"}
{"result":"failed","error":"Invalid FEED ID"}


Feeding data by HTTP POST

Using HTTP POST to feed data has the both advantages of security and flexibility. A group of data with different timestamps can be transmitted by one request like UDP.

Request URL

http://<server host>/api/post/[DEVICE ID]

Post Payload

The payload, which is made up of a series of time-stamped data, is formed in Freematics Packed Data Format.

Response (success)


n is the number of accepted data PID/value pairs.

Response (erroneous)

{"result":"failed","error":"Invalid server key"}
{"result":"failed","error":"Invalid FEED ID"}


Fetching Data (from server)

Software which is designed to illustrate, process, analyze or permanently store data, uses a set of HTTP SOAP API requests to fetch data from Freematics Hub. Freematics Hub’s GUI is implemented by using the API.


Obtaining list of data feeds

Request URL

http://<server host>/api/channels


The response is an object array in which each element is corresponding to a data feed.



  • id – Feed ID
  • vin – vehicle identification number
  • recv – data received (bytes) during current session/trip
  • tick – device system clock tick (ms)
  • age – time elapsed (ms) since latest data entry received till it’s requested
  • csq – signal strength index (in dB)
  • flag – 1 for active/running state, 0 for inactive/parked state

Fetching instant data

This is to request live data from a data feed.

Request URL

http://<server host>/api/get/[DEVICE ID]



In the response, stats contains statistics information including:

  • tick – server timestamp (in ms)
  • devtick – device timestamp (in ms)
  • elapsed – trip/session runtime
  • – time (in ms) elapsed since last data transmission
  • – time (in ms) elapsed since last ping back (when device in standby mode)

The array data contains all the instant data represented in a 3 elements array including:

  • PID – in decimal
  • data value (could be integer, float or array of 3 elements for 3-axis data)
  • age – time (in ms) elapsed since its collection from on device end

Operation Sequence

The basic sequence of fetching instant data is like following.

  1. Getting data feed list (containing ID and some properties of a data feed)
  2. Fetching instant data (with Feed ID)
  3. Parsing response JSON payload and deal with the data
  4. Repeating 2 and 3

Fetching history data

A data queue is a serious of data with time stamp. The request for a data queue can specify time stamp range or time to rollback. The data is organized as a 2-dimension JSON array. This is useful for rendering a data chart or route on map with complete data samples, so the line on chart or the shape of route looks smooth. This is also necessary for caching or storing data from a data feed.

Request URL

http://<server host>/api/pull/<DEVICE ID>?[ts=<ms>][&endts=<ms>][&rollback=<ms>]

Request Arguments

  • ts is used to specify start time of requested data queue. The time is presented in device system clock tick in ms.
  • endts is used to specify end time of requested data queue. The time is presented in device system clock tick in ms.
  • rollback sets start time with relative time in ms without need for knowing device local clock tick. For example, rollback=60000 indicates requesting for data from 1 minute ago.

Response (success)

The response contains statistic data and the requested data queue represented as an array of 3-element sub-array (timestamp, PID, data). Timestamp is from device system clock in ms. PID is in decimal instead of hexadecimal. Value is in string format. A response example is shown below.


Description of properties:

  • stats.tick – device system clock tick (ms)
  • stats.recv- data received (bytes) in current trip
  • stats.elapsed – time elapsed (seconds) in current trip
  • stats.age – time elapsed (ms) since latest data entry received till it’s requested
  • stats.flag – 1 for driving/active, 0 for parked/inactive
  • data[] – data queue represented as an array of 3-element array consisting of timestamp, data type and data value
  • eos – indicates if this is the end of stream (no more data) at the time the request is made

Response (erroneous)

{"result":"failed","error":"Invalid server key"}
{"result":"failed","error":"Invalid FEED ID"}

Operation Sequence

The sequence of fetching complete data queue is like following.

  1. Getting data feed list (containing Feed  ID and some properties of the data feed)
  2. Fetching a data queue with rollback time specified
  3. Parsing response JSON payload, deal with the data and keep the time stamp of last data sample
  4. Fetching next data queue with time stamp specified (start time set as last data sample plus 1)
  5. Repeating 3 and 4

Command and Query

Commands can be sent to device remotely for performing specific actions or requesting for data. Once a command is sent, a token number is returned. Subsequent requests are to be made for checking the completion of the command and readiness of result data. Multiple commands are queued.

This feature is implemented in Freematics Hub version 0.9.5 and later.

Sending command

Request URL

http://<server host>/api/command/<DEVICE ID>?cmd=<command name>

Response (success)

{"result":"pending","token":<token number>}

Response (erroneous)

{"result":"failed","error":"Command unsent"}

{"result":"failed","error":"Invalid request"}

Checking command status

Request URL

http://<server host>/api/command/<DEVICE ID>?token=<token number>

Response (completed)

{"result":"done","elapsed":<time elapsed for completing command>,"data":"<response message or result data>"}

Response (not completed)

{"result":"pending","elapsed":<time elapsed for the command>}

Response (erroneous)

{"result":"failed","error":"Invalid token"}