NAV
cURL javascript

Introduction

The base URL for all the requests in this reference is:

https://cloud.moeco.io/api/ext/v1/

Welcome to the Moeco public API! You can use our API to access Moeco API endpoints, which can get information on your shipments, sensors, alerts, and more.

We currently offer code examples in cURL and JavaScript. You can view them in the dark area to the right.

Authentication

General

Include your API token into each request. For example:

curl -X 'GET'
'https://cloud.moeco.io/api/ext/v1/shipments' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require(axios);
async function main() {
  const options = {
    method: get,
    url: `https://cloud.moeco.io/api/ext/v1/shipments`,
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
  };
  const response = await axios(options);
  console.log(response.data)
}
main();

Make sure to replace xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with your API key.

To interact with our API, you should obtain a bearer token. You can get a bearer token right via API by using auth endpoint.

This token must be sent with each request as a header. Any requests that don't contain a token will fail. Add a token to your requests like this:

-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-H 'accept: application/json'

Acquiring your API token

curl -X 'POST' 'https://cloud.moeco.io/api/ext/v1/auth' \
--data '{"email":"[email protected]","password":"yourpassword"}' \
--header "Content-Type: application/json"
const axios = require('axios');

async function main() {

  const options = {
    method: 'POST',
    url: `https://cloud.moeco.io/api/ext/v1/auth`,
    data: {
        email: "[email protected]",
        password: "yourpassword"
    }
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

Make sure to replace [email protected] and yourpassword with your Moeco platform credentials

As a successful result, you get the following response:

{
    "data": [
        {
            "id": 1203903,
            "token_type": "bearer",
            "user_id": 10,
            "expires_at": "2022-03-06T06:09:51.030Z",
            "created_at": "2022-02-04T06:09:51.030Z",
            "updated_at": "2022-02-04T06:09:51.030Z",
            "access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "organization_id": 3,
            "ip_address": null
        }
    ],
    "meta": {
        "total": 0,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

To get your API token, call auth endpoint with parameters listed below. As a successful response, you will receive a JSON which contains your API token in access_token. Use it further in all your requests to Moeco API as a header.

Parameter Format Description
email string Mandatory. Your email for logging into the Moeco platform.
password string Mandatory. Your password for logging into the Moeco platform.
organization_id integer Unique identifier of the organization. Must be set if a user belongs to more than one organization.

Keeping your API token safe

Once you obtained your API token, store it safe. It is tied closely with your identity and authorization and can be used to interact with Moeco on your behalf. If your token is compromised, whoever can access your data and make requests to Moeco endpoints. After you obtain an API token from our platform, you are fully responsible for its safety.

Below you can find general best practices on how to protect your token from compromizing:

Pagination

When making requests on collections of objects, the number of results returned defaults to the maximum, which is 100. This means that without using pagination to iterate through your collections, you will only ever access the first 100 objects. The offset and count parameters allow you to navigate through data sets.

Each request with the method that includes pagination returns meta information in response. The meta information object contains the following parameters.

Parameter Format Description
total integer The total number of records that meet the request requirements.
count integer The number of records returned in this response (default is 100, maximum is 100).
offset integer The offset from which your requested data begin (default is 0).
error string Default is null.

Date format

Moeco API uses normalized UTC values for all date type parameters both in requests and responses. The hours component must be or is specified as two digits in 24-hour format.

Valid date formats for requests are:

Shipments

Get shipments

Retrieve array of shipments. Shipment is an entity that includes one or several sensors.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments?count=100&offset=0&filters=created:2021-10-28,show_archived:1' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require(axios);
async function main() {
  const options = {
    method: get,
    url: `https://cloud.moeco.io/api/ext/v1/shipments`,
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 10,
        offset: 0,
        filters: created: 2021-10-28, show_archived: 1,
        order: id: desc
    }
  };
  const response = await axios(options);
  console.log(response.data)
}
main();

The above command returns JSON structured like this:

{

    "data": [
        {
            "shipment_id": 3862,
            "shipment_name": "MOECO_8190638195",
            "created_at": "2022-07-26T10:57:04.280Z",
            "last_seen": "2022-07-26T11:00:13.000Z",
            "start_point": {
                "lt": 37.78443,
                "lg": -122.39435,
                "address": "QJJ2+8H2 SoMa, San Francisco, CA, USA",
                "accuracy": 1000
            },
            "last_known_location": {
                "lt": 37.323082,
                "lg": -121.88999,
                "address": "84G6+9QP San Jose, CA, USA",
                "accuracy": 1000
            },
            "destination": {
                "lt": 46.6242142,
                "lg": -75.923839,
                "address": "Magdeburg, Germany"
            },
            "current_stage": "Delivered",
            "alert_events_max_severity": "Alert"
        }
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments

Request parameters

All the parameters listed for this request are optional. If your request doesn't contain any of these parameters, it retrieves an array of activated shipments for your organization.

Parameter Format Description
count integer
offset integer
order string <order_name>: <value>.
Each request must contain only one order option. Possible order names:
  • id—order by shipment ids (values can be asc or desc).
  • name—order by shipment names (values can be asc or desc).
  • created—order by shipments creation dates (values can be asc or desc).
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • id—shipment ID (as a number).
  • name—part of or full shipment name (as a number, letter, or combination). Not case sensitive.
  • created—shipment creation date.
  • tag: exact_tag_name—part of or full shipment tag (as a number, letter, or combination). Include shipments that contain this tag or its part. Not case sensitive.
  • sensor_uid—part of a device UID (as a number, letter, or combination). Not case sensitive.
  • show_archived: 1—include archived shipments.
  • only_with_alerts: 1—include shipments with alerts.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
created_at date Shipment creation time.
last_seen date Shipment last transaction date.
start_point object Contains information about location from where this shipment first transaction was received.
start_point.name string City and region of this shipment first received transaction.
start_point.lt float Latitude of this shipment first received transaction.
start_point.lg float Longitude of this shipment first received transaction.
start_point.address string Address of this shipment first received transaction.
start_point.accuracy integer Geolocation accuracy of this shipment first received transaction.
last_known_location object Contains information about last known location of this shipment.
last_known_location.name string City and region from where this shipment last transaction was received.
last_known_location.lt float Latitude of this shipment last received transaction.
last_known_location.lg float Longitude of this shipment last received transaction.
last_known_location.address string Address of this shipment last received transaction.
last_known_location.accuracy integer Geolocation accuracy of this shipment last received transaction.
destination object Contains information about this shipment final destination point.
destination.lt float Latitude of the place where this shipment must arrive.
destination.lg float Longitude of the place where this shipment must arrive.
destination.address string Address of the place where this shipment must arrive.
current_stage string Current delivery status of this shipment.
alert_events_max_severity string Monitoring event of the most severity triggered for this shipment.

Get a specific shipment

Retrieve information about a specific shipment by its ID.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/7490' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/7490`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "shipment_id": 56,
            "shipment_name": "MOECO_0291208178",
            "created_at": "2022-04-21T09:01:33.767Z",
            "last_seen": null,
            "current_stage": "New",
            "alert_events_max_severity": "None",
            "properties": [
                {
                    "value": "PX-367321",
                    "name": "Pallet ID"
                },
                {
                    "value": "CNT1243",
                    "name": "Container ID"
                }
            ],
            "tags": [
                "tag1",
                "tag2",
                "tag3"
            ],
            "start_point": {
                "lt": null,
                "lg": null,
                "address": null,
                "accuracy": null
            },
            "last_known_location": {
                "lt": null,
                "lg": null,
                "address": null,
                "accuracy": null
            },
            "destination": {
                "lt": 46.6242142,
                "lg": -75.923839,
                "address": "Magdeburg, Germany"
            }
        }
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
created_at date Shipment creation time.
last_seen date Shipment last transaction date.
current_stage string Current delivery status of this shipment.
alert_events_max_severity string Monitoring event of the most severity triggered for this shipment.
properties array Properties assigned to this shipment.
properties.name string Name of this property.
properties.value string Value of this property.
tags array Name of the tag.
start_point object Contains information about location from where this shipment first transaction was received.
start_point.lt float Latitude of this shipment first received transaction.
start_point.lg float Longitude of this shipment first received transaction.
start_point.address string Address of this shipment first received transaction.
start_point.accuracy integer Geolocation accuracy of this shipment first transaction.
last_known_location object Contains information about last known location of this shipment.
last_known_location.lt float Latitude of this shipment last received transaction.
last_known_location.lg float Longitude of this shipment last received transaction.
last_known_location.address string Address of this shipment last received transaction.
last_known_location.accuracy integer Geolocation accuracy of this shipment last received transaction.
destination object Contains information about this shipment final destination point.
destination.lt float Latitude of this shipment final destination point.
destination.lg float Longitude of this shipment final destination point.
destination.address string Address of this shipment final destination point.

Get tracking points of a specific shipment

Retrieve tracking points for all sensors in a specific shipment.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/7813/track' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/7490/track`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },  
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "package_id": 7153,
            "trackpoint_index": "0",
            "timeframe": {
                "start_time": "2022-07-14T13:28:28.000Z",
                "end_time": "2022-07-14T13:33:30.000Z"
            },
            "accuracy": 1000,
            "address": "Seligenstadt, Germany",
            "lt": 50.045658,
            "lg": 8.929076,
            "sensors_data": {
                {
                "battery": {
                    "unit": "%",
                    "min": 93,
                    "max": 93,
                    "avg": 93
                },
                "Temp": {
                    "unit": "°C",
                    "min": 21,
                    "max": 21,
                    "avg": 21
                },
                "Humi": {
                    "unit": "%",
                    "min": 54,
                    "max": 55,
                    "avg": 54.5
                },
                "Light": {
                    "unit": null,
                    "min": 58,
                    "max": 59,
                    "avg": 58.5
                },
                "Shocks": {
                    "unit": null,
                    "min": 0,
                    "max": 0,
                    "avg": 0
                }
            }
        },
        {
            "package_id": 7153,
            "trackpoint_index": "1",
            "timeframe": {
                "start_time": "2022-08-14T13:28:28.000Z",
                "end_time": "2022-08-14T13:33:30.000Z"
            },
            "accuracy": 1000,
            "address": "Seligenstadt, Germany",
            "lt": 50.034658,
            "lg": 8.329076,
            "sensors_data": {
                {
                "battery": {
                    "unit": "%",
                    "min": 93,
                    "max": 93,
                    "avg": 93
                },
                "Temp": {
                    "unit": "°C",
                    "min": 21,
                    "max": 21,
                    "avg": 21
                },
                "Humi": {
                    "unit": "%",
                    "min": 54,
                    "max": 55,
                    "avg": 54.5
                },
                "Light": {
                    "unit": null,
                    "min": 58,
                    "max": 59,
                    "avg": 58.5
                },
                "Shocks": {
                    "unit": null,
                    "min": 0,
                    "max": 0,
                    "avg": 0
                }
            }
        }
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/track

Response parameters

Parameter Format Description
package_id integer Unique identifier of this package.
trackpoint_index integer Sequential number of this shipment tracking point.
timeframe object Contains information about date and time of the first and last transactions in the tracking point.
timeframe.start_time date Date and time of the first transaction received in this tracking point.
timeframe.end_time date Date and time of the last transaction received in this tracking point.
accuracy integer Geolocation accuracy of this shipment tracking point.
address string Address of this shipment tracking point.
lt float Latitude of this shipment tracking point.
lg float Longitude of this shipment tracking point.
sensors_data object Contains data received from the sensor when it reached this tracking point. Set of parameters listed in this object differs in each case and depends on the sensor type and user's custom parameters
sensors_data.battery object Contains information about the sensor battery on this tracking point.
sensors_data.battery.unit string The battery level measurement unit.
sensors_data.battery.min integer The minimum level of the sensor battery on this tracking point.
sensors_data.battery.max integer The maximum level of the sensor battery on this tracking point.
sensors_data.battery.avg integer The average level of the sensor battery on this tracking point.
sensors_data.Temp object Contains information about the temperature on this tracking point.
sensors_data.Humi object Contains information about the humidity level on this tracking point.
sensors_data.Light object Contains information about the light level on this tracking point.
sensors_data.Shocks object Contains information about the shocks on this tracking point.

Get content structure of a specific shipment

Retrieve all child packages of a specific shipment. Package is an entity that can represent either a whole shipment or one of its children.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/6980/branches?count=10&offset=0' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/6980/branches`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 10,
        offset: 0,
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "id": 6981,
            "parent_id": 6980,
            "merger_id": null,
            "created_at": "2021-10-05T16:50:43.169Z",
            "terminated_at": null,
            "sensors": [
                "jv:50:9e:e6:78:bf"
            ]
        },
        {
            "id": 6980,
            "parent_id": null,
            "merger_id": null,
            "created_at": "2021-10-05T16:50:41.922Z",
            "terminated_at": null,
            "sensors": [
                "jv:50:9e:e6:78:bf"
            ]
        }
    ],
    "meta": {
        "total": 2,
        "count": 100,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/branches

Request parameters

Parameter Format
count integer
offset integer

Response parameters

Parameter Format Description
id integer Unique identifier of this package.
parent_id integer Identifier of a parent package.
merger_id integer Currently null.
created_at date Creation date of this package.
terminated_at date Currently null.
sensors array UID of the devices that belong to this branch and all its children.

Get lifecycle of a specific shipment

Retrieve the history of stages for a specific shipment. A stage is an entity that represents a shipment lifecycle status, for example, New, Delivered, etc.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/7761/stage?count=10&offset=0' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/7761/stages`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 10,
        offset: 0,
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "stage": "New",
            "timestamp": "2021-11-01T14:12:58.348Z",
            "time_on_stage": 164
        },
        {
            "stage": "Canceled",
            "timestamp": "2021-11-01T14:15:42.566Z",
            "time_on_stage": 0
        }
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/stages

Request parameters

Parameter Format
count integer
offset integer

Response parameters

Parameter Format Description
stage string Lifecycle status of this shipment.
timestamp date Date when the shipment got this status.
time_on_stage integer The time the shipment spent in this status until reaching the next status (in seconds).

Sensors

Get sensors

Retrieve array of sensors for all shipments.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/sensors?order=sensor_uid:desc&count=100&filters=sensor_uid:jv:7c:b8:00:79:4d' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/sensors`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 100,
        offset: 0,
        order: 'id: desc',
        filters: 'sensor_uid: jv:7c:b8:00:79:4d',
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
         {
            "shipment_id": 2762,
            "shipment_name": "MOECO_DT891013555",
            "sensor_uid": "jv:7c:b8:00:79:4d",
            "alert_events_max_severity": "None",
            "last_seen": "2021-12-07T17:17:56.000Z",
            "last_known_location": {
                "address": "Seligenstadt, Germany",
                "lt": 50.045658,
                "lg": 8.929076,
                "accuracy": null
            },
            "last_known_parameters": {
                "battery": {
                    "unit": "%",
                    "value": 95
                },
                "Temp": {
                    "unit": "°C",
                    "value": 21
                },
                "Humi": {
                    "unit": "%",
                    "value": 0
                },
                "Light": {
                    "unit": null,
                    "value": 0
                },
                "Shocks": {
                    "unit": null,
                    "value": 0
                }
            }
        }
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/sensors

Request parameters

Parameter Format Description
count integer
offset integer
order string <order_name>: <value>.
Possible order name:
  • sensor_uid—part of a device UID (as a number, letter, or combination). Not case sensitive.
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • sensor_uid—part of a device UID (as a number, letter, or combination). Not case sensitive.
  • shipment_id—exact shipment ID. Using this filter is mandatory if you want to retrieve an archived shipment. If it's not set, a method retrieves sensors for active shipments only.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment this sensor belongs to.
shipment_name string Unique name of the shipment this sensor belongs to.
sensor_uid string This sensor unique identifier.
alert_events_max_severity string Monitoring event of the most severity triggered for this sensor.
last_seen date This sensor last transaction date.
last_known_location object Contains information about last known location of this sensor.
last_known_location.address string Address from where this sensor last transaction was received.
last_known_location.lt float Latitude of this sensor last received transaction.
last_known_location.lg float Longitude of this sensor last received transaction.
last_known_location.accuracy integer Geolocation accuracy of this sensor last received transaction.
last_known_parameters object Contains information about this sensor last received parameters. Set of parameters listed in this object differs in each case and depends on the sensor type and user's custom parameters.
last_known_parameters.battery object Contains information about this sensor battery.
last_known_parameters.battery.unit string The battery level measurement unit.
last_known_parameters.battery.value integer The battery level value.
last_known_parameters.Temp object Contains information about this sensor temperature.
last_known_parameters.Humi object Contains information about this sensor humidity level.
last_known_parameters.Light object Contains information about this sensor light level.
last_known_parameters.Shocks object Contains information about the number of shocks of this sensor.

Get a specific sensor

Retrieve information about a specific sensor by its ID.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/sensors/jv:7c:b8:00:79:4d?count=100&offset=0&filters=shipment:7773' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/sensors/jv:7c:b8:00:79:4d`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 100,
        offset: 0,
        filters: 'shipment:7773',
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
          {
            "shipment_id": 7773,
            "shipment_name": "MOECO_DT891013555",
            "shipment_created_at": "2021-12-07T17:17:47.725Z",
            "sensor_last_seen": "2021-12-07T17:17:56.000Z",
            "sensor_current_stage": "New",
            "sensor_alert_events_max_severity": "None",
            "properties": [
                {
                    "name": "Pallet ID",
                    "value": "DT8910135794"
                },
                {
                    "name": "Pallet ID",
                    "value": "DT8910135794"
                }
            ],
            "last_known_location": {
                "address": "Seligenstadt, Germany",
                "lt": 50.045658,
                "lg": 8.929076,
                "accuracy": 1000
            }
        }
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/sensors/{sensor_uid}

Request parameters

Parameter Format Description
count integer
offset integer
filters string <filter_name>: <value>
Possible filter name:
  • shipment_id—exact shipment ID. Using this filter is mandatory if you want to retrieve an archived shipment. If it's not set, a method retrieves sensors for active shipments only.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment this sensor belongs to.
shipment_name string Unique name of the shipment this sensor belongs to.
shipment_created_at date Creation time of the shipment this sensor belongs to.
sensor_last_seen date Date of this sensor last received transaction.
sensor_current_stage string Current lifecycle status of this sensor.
sensor_alert_events_max_severity string Monitoring event of the most severity triggered for this sensor.
properties array Tags assigned to this sensor and a shipment it belongs to.
properties.name string Name of this property.
properties.value string Value of this property.
last_known_location object Contains information about last known location of this sensor.
last_known_location.address string Address from where this sensor last transaction was received.
last_known_location.lt float Latitude of this sensor last received transaction.
last_known_location.lg float Longitude of this sensor last received transaction.
last_known_location.accuracy integer Geolocation accuracy of this sensor last received transaction.

Get lifecycle of a specific sensor

Retrieve the history of stages for a specific sensor. A stage is an entity that represents a shipment lifecycle status, for example, New, Delivered, etc.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/sensors/jv:7c:b8:00:79:4d/stages?count=100&offset=0&filters=shipment:7769' \
 -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
 -H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/sensors/jv:7c:b8:00:79:4d/stages`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },    
    params: {
        count: 100,
        offset: 0,
        filters: 'shipment:7769',
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "shipment_id": 7769,
            "stage": "New",
            "timestamp": "2021-11-02T08:11:05.535Z",
            "time_on_stage": 202
        },
        {
            "shipment_id": 7769,
            "stage": "Canceled",
            "timestamp": "2021-11-02T08:14:27.449Z",
            "time_on_stage": 0
        }
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/sensors/{sensor_uid}/stages

Request parameters

Parameter Format Description
count integer
offset integer
filters string <filter_name>: <value>
Possible filter name:
  • shipment_id—exact shipment ID. Using this filter is mandatory if you want to retrieve an archived shipment. If it's not set, a method retrieves sensors for active shipments only.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment this sensor belongs to.
stage string Lifecycle status of this sensor.
timestamp date Date when the sensor got this status.
time_on_stage integer The time the sensor spent in this status until reaching the next status (in seconds).

Get tracking information for a specific sensor

Retrieve tracking points for a specific sensor.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/sensors/b0:3b:a1:78:42:a9/track?order=timestamp:desc&count=10&offset=0' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/sensors/b0:3b:a1:78:42:a9/track`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 100,
        offset: 0,
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "shipment_id": 7152,
            "trackpoint_index": "0",
            "timeframe": {
                "start_time": "2022-07-14T13:28:28.000Z",
                "end_time": "2022-07-14T13:33:30.000Z"
            },
            "accuracy": 1000,
            "address": "Seligenstadt, Germany",
            "lt": 50.045658,
            "lg": 8.929076,
            "sensors_data": {
                {
                "battery": {
                    "unit": "%",
                    "min": 93,
                    "max": 93,
                    "avg": 93
                },
                "Temp": {
                    "unit": "°C",
                    "min": 21,
                    "max": 21,
                    "avg": 21
                },
                "Humi": {
                    "unit": "%",
                    "min": 54,
                    "max": 55,
                    "avg": 54.5
                },
                "Light": {
                    "unit": null,
                    "min": 58,
                    "max": 59,
                    "avg": 58.5
                },
                "Shocks": {
                    "unit": null,
                    "min": 0,
                    "max": 0,
                    "avg": 0
                }
            }
        },
        {
            "package_id": 7152,
            "trackpoint_index": "1",
            "timeframe": {
                "start_time": "2022-08-14T13:28:28.000Z",
                "end_time": "2022-08-14T13:33:30.000Z"
            },
            "accuracy": 1000,
            "address": "Seligenstadt, Germany",
            "lt": 50.034658,
            "lg": 8.329076,
            "sensors_data": {
                {
                "battery": {
                    "unit": "%",
                    "min": 93,
                    "max": 93,
                    "avg": 93
                },
                "Temp": {
                    "unit": "°C",
                    "min": 21,
                    "max": 21,
                    "avg": 21
                },
                "Humi": {
                    "unit": "%",
                    "min": 54,
                    "max": 55,
                    "avg": 54.5
                },
                "Light": {
                    "unit": null,
                    "min": 58,
                    "max": 59,
                    "avg": 58.5
                },
                "Shocks": {
                    "unit": null,
                    "min": 0,
                    "max": 0,
                    "avg": 0
                }
            }
        }
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/sensors/{sensor_uid}/track

Request parameters

Parameter Format Description
count integer
offset integer
order string <order_name>: <value>
Possible order name:
  • timestamp—order by sensor timestamp (values can be asc or desc).
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • timestamp—sensor timestamp.
  • shipment—exact shipment ID. Using this filter is mandatory if you want to retrieve an archived shipment. If it's not set, a method retrieves sensors for active shipments only.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment this sensor belongs to.
trackpoint_index integer Sequential number of this shipment tracking point.
timeframe object Contains information about date and time of the first and last transactions in the tracking point.
timeframe.start_time date Date and time of the first transaction received in this tracking point.
timeframe.end_time date Date and time of the last transaction received in this tracking point.
accuracy integer Geolocation accuracy of this shipment tracking point.
address string Address of this shipment tracking point.
lt float Latitude of this shipment tracking point.
lg float Longitude of this shipment tracking point.
sensors_data object Contains data received from the sensor when it reached this tracking point. Set of parameters listed in this object differs in each case and depends on the sensor type and user's custom parameters
sensors_data.battery object Contains information about the sensor battery on this tracking point.
sensors_data.battery.unit string The battery level measurement unit.
sensors_data.battery.min integer The minimum level of the sensor battery on this tracking point.
sensors_data.battery.max integer The maximum level of the sensor battery on this tracking point.
sensors_data.battery.avg integer The average level of the sensor battery on this tracking point.
sensors_data.Temp object Contains information about the temperature on this tracking point.
sensors_data.Humi object Contains information about the humidity level on this tracking point.
sensors_data.Light object Contains information about the light level on this tracking point.
sensors_data.Shocks object Contains information about the shocks on this tracking point.

Get transactions for a specific sensor

Retrieve an array of transactions which a specific sensor send to the platform. Transaction is a set of data that sensor collects and sends from one of the points along its route.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/sensors/b0:3b:a1:78:42:a9/transactions?order=timestamp:desc&count=10&offset=0' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/sensors/b0:3b:a1:78:42:a9/transactions`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 100,
        offset: 0,
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
         {
            "shipment_id": 7152,
            "seq_number": 0,
            "timestamp": "2022-06-03T06:30:38.000Z",
            "received_at": "2022-06-03T06:32:18.000Z",
            "address": "Seligenstadt, Germany",
            "lt": 50.045658,
            "lg": 8.929076,
            "sensors_data": {
                "battery": {
                    "unit": "%",
                    "value": 95
                },
                "Temp": {
                    "unit": "°C",
                    "value": 21
                },
                "Humi": {
                    "unit": "%",
                    "value": 0
                },
                "Light": {
                    "unit": null,
                    "value": 0
                },
                "Shocks": {
                    "unit": null,
                    "value": 0
                }
            }
        },
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/sensors/{sensor_uid}/transactions

Request parameters

Parameter Format Description
count integer
offset integer
order string <order_name>: <value>
Possible order name:
  • timestamp—order by sensor timestamp (values can be asc or desc).
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • timestamp—sensor timestamp.
  • shipment—exact shipment ID. Using this filter is mandatory if you want to retrieve an archived shipment. If it's not set, a method retrieves sensors for active shipments only.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment this sensor belongs to.
seq_number integer Sequential number of this sensor transaction.
timestamp date Date and time when this sensor took measurements and created a transaction.
received_at date Date and time when this transaction was received on the platform.
address string Address from where this sensor sent the transaction.
lt float Latitude of the point from which this sensor sent the transaction.
lg float Longitude of the point from which this sensor sent the transaction.
sensors_data object Parameters that this sensor sent in the transaction. Set of parameters listed in this object differs in each case and depends on the sensor type and user's custom parameters.
sensors_data.battery object Contains information about the battery on the point from which this sensor sent the transaction.
sensors_data.battery.unit string The battery level measurement unit.
sensors_data.battery.value integer The battery level value.
sensors_data.Temp object Contains information about the temperature on the point from which this sensor sent the transaction.
sensors_data.Humi object Contains information about the humidity level on the point from which this sensor sent the transaction.
sensors_data.Light object Contains information about the light level on the point from which this sensor sent the transaction.
sensors_data.Shocks object Contains information about the number of shocks on the point from which this sensor sent the transaction.

Get monitoring events triggered for a shipment and its sensors

Retrieve an array of monitoring events that have been triggered for a shipment and/or its sensors.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/shipments/alert_events?filters=severity:alert|warning,shipment_id:7490&order=timestamp:desc&offset=0' \
-H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require('axios');

async function main() {

  const options = {
    method: 'GET',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/alert_events`,    
    headers: {
      authorization: `Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 100,
        offset: 0,
        filters: 'severity: alert|warning,shipment_id: 7490',
        order: 'timestamp: desc'
    },
  };
  const response = await axios(options);

  console.log(response.data)
}

main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "shipment_id": 7490,
            "sensor_uid": "jv:fd:ce:6d:a8:63",
            "name": "Reached the destination",
            "alert_event_type": "DST",
            "actual_value": "{\"lg\":12.6324802,\"lt\":51.867283,\"address\":\"Lutherstadt\",\"place_id\":[\"ChIJzWPsccYvpkcREFyt8Hww2yA\"]}",
            "severity": "Alert",
            "timestamp": "2022-08-19T07:35:46.000Z",
            "resolved_date": "2022-08-19T07:35:46.000Z"
        },
    ],
    "meta": {
        "total": 1,
        "count": 1,
        "offset": 0,
        "error": null
    }
}

HTTP request

GET https://cloud.moeco.io/api/ext/v1/shipments/alert_events

Request parameters

Parameter Format Description
count integer
offset integer
order string <order_name>: <value>
Each request must contain only one order option. Possible order name:
  • name—order by monitoring event name (values can be asc or desc).
  • timestamp—order by monitoring event timestamp (values can be asc or desc).
  • severity—order by monitoring event severity (values can be asc or desc).
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • name—part of or full monitoring event name. Not case sensitive.
  • timestamp—include monitoring events for exact period of time (e.g. YYYY for the whole year, YYYY-MM for the whole month).
  • shipment_id—exact shipment ID. Include monitoring events triggered for exact shipment.
  • sensor_uid—exact sensor ID. Include monitoring events triggered for exact sensor.
  • level—level of entity for which monitoring events triggered (values can be shipment or sensor). If it's not set, a method retrieves monitoring events triggered for both a shipment and sensor.
  • severity—include monitoring events with exact severity level (values can be Notification, Alert, Warning). To include several values, use | as a separator. Not case sensitive.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the shipment for which a monitoring event triggered.
sensor_uid string Unique identifier of the sensor for which a monitoring event triggered.
name string Name of the monitoring event.
alert_event_type string Parameter that triggered the monitoring event.
actual_value string Value that have been registered when the monitoring event triggered.
severity string Monitoring event severity level.
timestamp date Date and time when the monitoring event triggered.
resolved_date date Date and time when the monitoring event stopped triggering.

Errors

Moeco API uses the following error codes:

Error Code Caption Explanation
400 Bad Request Your request is invalid.
401 Unauthorized Your bearer token is wrong.
404 Not Found The data could not be found.
406 Not Acceptable You requested a format that isn't JSON.
429 Too Many Requests You're sending too many requests.
500 Internal Server Error We had a problem with our server. Try again later.
503 Service Unavailable We're temporarily offline for maintenance. Please try again later.