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! Our API allows you to seamlessly interact with the Moeco cloud platform in real time.

Here’s what our API offers:

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

Authentication

General

Include your API key into each request. For example:

curl -X 'GET'
'https://cloud.moeco.io/api/ext/v1/shipments' \
-H "Authorization: Apikey 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: `Apikey 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 need to obtain an API key. To do this, please refer to the platform documentation.

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

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

API (bearer) token authentication

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
    }
}

Include obtained 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();

API token authentication has been deprecated since we added API key management to the platform. Please use API key authentication instead.

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 key / token safe

Once you obtained your API key / 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 key / token is compromised, whoever can access your data and make requests to Moeco endpoints. After you obtain an API key / 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 1000).
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:

Query API

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: Apikey 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: `Apikey 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: Apikey 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: `Apikey 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: Apikey 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: `Apikey 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 The date and time of the first transaction received in this tracking point.
timeframe.end_time date The 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: Apikey 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: `Apikey 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: Apikey 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: `Apikey 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 The 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).

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: Apikey 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: `Apikey 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 (values can be asc or desc).
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: Apikey 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: `Apikey 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 The 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: Apikey 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: `Apikey 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 The 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: Apikey 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: `Apikey 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 The date and time of the first transaction received in this tracking point.
timeframe.end_time date The 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: Apikey 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: `Apikey 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,
            "raw_address": "Seligenstadt, Germany",
            "raw_lt": 50.054512,
            "raw_lg": 8.912074,
            "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.
verbose boolean true / false
Retrieves some extended output, including:
  • cells—a list of scanned cellular network nodes.
  • wifi—a list of scanned WiFi hotspots.

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 The date and time when this sensor took measurements and created a transaction.
received_at date The 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.
raw_address string An unprocessed address, as it is taken from a sensor.
raw_lt float An unprocessed lattitude of the point, as it is taken from a sensor.
raw_lg float An unprocessed longitude of the point, as it is taken from a sensor.
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: Apikey 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: `Apikey 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 The date and time when the monitoring event triggered.
resolved_date date The date and time when the monitoring event stopped triggering.

Manage API

The simplest way to create a shipment is by using a predefined template. Templates must be created and configured in advance on the platform. For more information, refer to the platform documentation.

Here is a typical sequence of API calls for creating a shipment:

Below are detailed descriptions for these endpoints.

Get Templates List

Retrieve an array of templates that can be used for shipment creation. Templates must be preliminarily added and adjusted on the platform before they can be used.

curl -X 'GET' 'https://cloud.moeco.io/api/ext/v1/templates?count=10&offset=0&order=id:desc&filters=name:My%20first%20template' \
-H "Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H 'accept: application/json'
const axios = require(axios);
async function main() {
  const options = {
    method: get,
    url: `https://cloud.moeco.io/api/ext/v1/templates`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
    },
    params: {
        count: 10,
        offset: 0,
        filters: name:My first template,
        order: id: desc
    }
  };
  const response = await axios(options);
  console.log(response.data)
}
main();

The above command returns JSON structured like this:

{

    "data": [
        {
            "template_id": 3863,
            "template_name": "My second template",
        },
        {
            "template_id": 3862,
            "template_name": "My first template",
        },
    ],
    "meta": {
        "total": 2,
        "count": 2,
        "offset": 0,
        "error": null
    }
}

HTTP request

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

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 template ids (values can be asc or desc).
  • name—order by template names (values can be asc or desc).
  • created—order by template creation dates (values can be asc or desc).
filters string <filter_name>: <value>, <filter_name>: <value>, ...
Possible filter names:
  • idtemplate ID (as a number).
  • name—part of or full template name (as a number, letter, or combination). Not case sensitive.
  • created—template creation date.

Response parameters

Parameter Format Description
template_id integer The unique identifier of the shipment template used for shipment creation
template_name string The unique name of the template.

Create shipment from template

Creates a new shipment based on the provided template. The following data will be copied directly from the template if they are present:

curl -X 'POST' 'https://cloud.moeco.io/api/ext/v1/shipments/from-template' \
-H 'Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'accept: application/json'
-d '{
     "shipment_name": "My test shipment",
     "template_id": 20532
    }'
const axios = require('axios');
async function main() {
  const options = {
    method: 'post',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/from-template`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
      'Content-Type': 'application/json',
      accept: 'application/json'
    },
    data: {
      shipment_name: "My test shipment",
      template_id: 20532
    }
  };
  const response = await axios(options);
  console.log(response.data);
}
main();

The above command returns JSON structured like this:

{
    "data": [
        {
            "shipment_id": 154394,
            "shipment_name": "My test shipment"
        }
    ]
}

HTTP request

POST https://cloud.moeco.io/api/ext/v1/shipments/from-template

Request parameters

The request body must contain JSON data. The following fields are available:

Parameter Format Description
shipment_name string The name of the shipment to be created.
template_id integer The ID of the template to be used for creating the shipment.

Response parameters

Parameter Format Description
shipment_id integer Unique identifier of the newly created shipment. Required for any further interaction with the shipment.
shipment_name string Name of the shipment.

Set Shipment Properties

Properties are named values associated with the shipment during its creation. They can be used for search filtering or aggregation in any data integration. At this phase, you can fill in or replace default values with actual ones.

curl -X 'PUT' 'https://cloud.moeco.io/api/ext/v1/shipments/154394/properties' \
-H 'Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'accept: application/json'
-d '{
     "name": "Pallet ID",
     "value": "P-12345"
    }'
const axios = require('axios');
async function main() {
  const shipmentId = 154394; // Shipment ID
  const options = {
    method: 'put',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/${shipmentId}/properties`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
      'Content-Type': 'application/json',
      accept: 'application/json'
    },
    data: {
      name: "Pallet ID",
      value: "P-12345"
    }
  };
  const response = await axios(options);
  console.log(response.data);
}
main();

The above command does not return any response body.

HTTP request

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

Request parameters

The request URL must contain the following parameters:

Parameter Format Description
shipment_id integer Unique identifier of the shipment.

The request body must contain JSON data. The following fields are available:

Parameter Format Description
name string The name of the property to update.
value string The text value to set. Currently, only text strings are officially supported, but JSON objects can also be provided as a value by escaping quotes (\").

Add Sensor to Shipment

Sensors, in the context of this API, are devices provided by Moeco that gather locational and/or conditional information. To begin collecting any data, at least one sensor must be attached to a shipment.

curl -X 'POST' 'https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/sensors' \
-H 'Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'accept: application/json'
-d '{
     "sensor_uid": "e8:ee:63:c4:da:a3"
    }'
const axios = require('axios');
async function main() {
  const shipmentId = 154394; // Shipment ID
  const options = {
    method: 'post',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/${shipment_id}/sensors`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
      'Content-Type': 'application/json',
      accept: 'application/json'
    },
    data: {
      sensor_uid: "e8:ee:63:c4:da:a3"
    }
  };
  const response = await axios(options);
  console.log(response.data);
}
main();

The above command does not return any response body.

HTTP request

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

Request parameters

The request URL must contain the following parameters:

Parameter Format Description
shipment_id integer Unique identifier of the shipment.

The request body must contain JSON data. The following fields are available:

Parameter Format Description
sensor_uid string Unique identifier of the sensor device (also known as name or serial number).

Subscribe to Alerts

If any alert was taken from the template or added to the shipment by other means, alert notifications will be available on the platform by default. You can subscribe people within your organization who are registered on the platform to start receiving notifications via email and/or SMS.

curl -X 'POST' 'https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/alert_subscriptions' \
-H 'Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'accept: application/json'
-d '{
     "user_email": "[email protected]",
     "notification_methods": ["email"]
    }'
const axios = require('axios');
async function main() {
  const shipmentId = 154394; // Shipment ID
  const options = {
    method: 'post',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/${shipment_id}/alert_subscriptions`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
      'Content-Type': 'application/json',
      accept: 'application/json'
    },
    data: {
      user_email: "[email protected]",
      notification_methods: ["email"]
    }
  };
  const response = await axios(options);
  console.log(response.data);
}
main();

The above command does not return any response body.

HTTP request

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

Request parameters

The request URL must contain the following parameters:

Parameter Format Description
shipment_id integer Unique identifier of the shipment.

The request body must contain JSON data. The following fields are available:

Parameter Format Description
user_email string The email address of a user registered in your organization's account.
notification_methods array A list of notification methods. Possible values are email and sms.

Archive Shipment

Shipments are automatically archived based on their lifecycle. However, when a shipment is no longer needed, it can be manually archived at any time.

curl -X 'POST' 'https://cloud.moeco.io/api/ext/v1/shipments/{shipment_id}/archive' \
-H 'Authorization: Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-H 'accept: application/json'
const axios = require('axios');
async function main() {
  const shipmentId = 154394; // Shipment ID
  const options = {
    method: 'post',
    url: `https://cloud.moeco.io/api/ext/v1/shipments/${shipment_id}/archive`,
    headers: {
      authorization: `Apikey xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
      'Content-Type': 'application/json',
      accept: 'application/json'
    }
  };
  const response = await axios(options);
  console.log(response.data);
}
main();

The above command does not return any response body.

HTTP request

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

Request parameters

The request URL must contain the following parameters:

Parameter Format Description
shipment_id integer Unique identifier of the shipment.

Push API

Before receiving pushed data as described below, you need to set up and activate the appropriate webhooks on the platform.

Authorisation:

During the creation process of the webhook on the platform, you will be prompted to provide your Webhook API Key, or a new one will be generated automatically. This Webhook API Key will be included in each webhook request we send, using the HTTP Authorization and x-api-key header, as shown in this example:

Authorization: Apikey abc123xyz

x-api-key: abc123xyz

Security

You can whitelist the IP addresses we use to send webhooks for added security. Actual IP addresses lists you can get from our technical support team.

Data report

Triggered when a sensor device reports a new batch of data.

This Webhook sends a JSON payload structured as follows in the body of the POST command:


{
    "event": "DATA_REPORT",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": {
        "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,
        "raw_address": "Seligenstadt, Germany",
        "raw_lt": 50.054512,
        "raw_lg": 8.912074,
        "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
            }
        }
    }
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. DATA_REPORT
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
seq_number integer Sequential number of this sensor transaction.
timestamp date The date and time when this sensor took measurements and created a transaction.
received_at date The 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.
raw_address string An unprocessed address, as it is taken from a sensor.
raw_lt float An unprocessed lattitude of the point, as it is taken from a sensor.
raw_lg float An unprocessed longitude of the point, as it is taken from a sensor.
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.

Alert

Triggered when an alert is fired.

This Webhook sends a JSON payload structured as follows in the body of the POST command:

{
    "event": "ALERT",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": {
        "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": null
    }
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. ALERT
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
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 The date and time when the monitoring event triggered.
resolved_date date The date and time when the monitoring event stopped triggering. For the ALERT event, it is always NULL.

Change stage

Triggered when a lifecycle stage changes.

Returns the lifecycle stage that the particular sensor device or the entire shipment has just transitioned into.

This Webhook sends a JSON payload structured as follows in the body of the POST command:

{
    "event": "CHANGE_STAGE",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": {
        "stage": "On the way",
        "timestamp": "2021-11-01T14:12:58.348Z"
    }
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. CHANGE_STAGE
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
stage string Lifecycle stage of this shipment.
timestamp date Date when the shipment got this status.

Update track

Triggered when the tracking data is updated.

Returns a complete log of tracking points for a specific sensor.

This Webhook sends a JSON payload structured as follows in the body of the POST command:

{
    "event": "UPDATE_TRACK",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": [
        {
            "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
                }
            }
        },
        {
            "shipment_id": 7152,
            "shipment_name": "MOECO_8190638195",
            "sensor_uid": "jv:7c:b8:00:79:4d",
            "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
                }
            }
        }
    ]
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. UPDATE_TRACK
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
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 The date and time of the first transaction received in this tracking point.
timeframe.end_time date The 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 waypoint

Triggered when a planned waypoint is reached.

This Webhook sends a JSON payload structured as follows in the body of the POST command:

{
    "event": "GET_WAYPOINT",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": {   
        "name": "wp name",
        "timeframe": {
            "start_time": "2022-07-14T13:28:28.000Z",
            "end_time": "2022-07-14T13:28:28.000Z"
        },
        "currLocation": {
            "lt": 50.034658,
            "lg": 8.329076,
        }
    }
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. GET_WAYPOINT
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
name string Name and/or address of the waypoint.
timeframe object Contains information about the date and time of the first and last timestamps at the waypoint.
timeframe.start_time date The date and time of the first data report received from this waypoint.
timeframe.end_time date The date and time of the last data report received from this waypoint. For the GET_WAYPOINT event, it is always the same as start_time.
curr_location object Contains information about the current location of the shipment.
curr_location.lt float Actual latitude of the shipment
curr_location.lg float Actual longitude of the shipment.

Left waypoint

Triggered when a waypoint is left.

This Webhook sends a JSON payload structured as follows in the body of the POST command:

{
    "event": "LEFT_WAYPOINT",
    "triggered_at": "2022-06-03T06:32:22.000Z",
    "shipment_id": 7152,
    "shipment_name": "MOECO_8190638195",
    "sensor_uid": "jv:7c:b8:00:79:4d",
    "data": {
        "name": "wp name",
        "timeframe": {
            "start_time": "2022-07-14T13:28:28.000Z",
            "end_time": "2022-07-14T13:33:30.000Z"
        },
        "currLocation": {
            "lt": 50.034658,
            "lg": 8.329076,
        }
    }
}

JSON payload parameters

Parameter Format Description
event string The name of the event that triggered this data push. LEFT_WAYPOINT
triggered_at date The date and time when the event was triggered.
shipment_id integer Unique identifier of this shipment.
shipment_name string Unique name of this shipment.
sensor_uid string This sensor unique identifier.
name string Name and/or address of the waypoint.
timeframe object Contains information about the date and time of the first and last timestamps at the waypoint.
timeframe.start_time date The date and time of the first data report received from this waypoint.
timeframe.end_time date The date and time of the last data report received from this waypoint.
curr_location object Contains information about the current location of the shipment.
curr_location.lt float Actual latitude of the shipment
curr_location.lg float Actual longitude of the shipment.

Errors

Moeco API uses the following error codes:

Error Code Caption Explanation
400 Bad Request Your request is invalid.
401 Unauthorized Your API key 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.