Skip to main content

Astrocast API


The Astrocast API allows you to programmatically interact with the Astrocast backend platform, to retrieve your device messages, and to automate the deployment of your devices in the field. You can retrieve your data in JSON or CSV format.

API Reference

The API Reference is available on the following platform:

API Request Headers

x-api-keySee Access TokensYes
Acceptapplication/json (default) or text/csvOptional

API Response Codes

Below is a list of typical response codes of the API:

Status CodeTextDescription
200AcceptedThe request was successful and data has been returned.
400Bad requestThe request was unacceptable, often due to incorrect parameters or a missing required parameter.
401UnauthorizedThe API key and secret is not valid.
404Not foundThe requested resource does not exist.
503Not availablePlease retry later. A "try after" period of 15 minutes defined in seconds is returned in the response.

Access Tokens

API access tokens are the credentials needed to access the Astrocast API.

These tokens are managed in the Astrocast Portal.

Message encoding

The data field of the Messages and Commands API (which is the payload of your message) is encoded in base64.

To decode the message in Python you can use the following function:

message = base64.b64decode(data).hex()

To decode the message in Node.js you can use the following function:

'use strict';

let data = 'R3JvdW5kIENvbnRyb2wgdG8gTWFqb3IgVG9tISAyMS4wMA==';

let buff = Buffer.from(data, 'base64');
let message = buff.toString('utf-8');


Request Examples


import requests, base64
from datetime import datetime, timedelta

apiToken = "FVquFITiVsu3RJ6KbkigpOJccmQFUqMwo6ftCaiWoXXvkyutWZ7t3veZmost1nxEO6OUEMiabu0BZn0N1wR3ssB11ohoRX4a"
startReceivedDate = - timedelta(minutes=60)

response = requests.get("" + str(startReceivedDate.strftime("%Y-%m-%dT%H:%M:%S")), headers={"X-Api-Key":str(apiToken)})
if response.status_code == 200:
if len(response.json()) > 0:
for message in response.json():
deviceGuid = str(message['deviceGuid'])
messageGuid = str(message['messageGuid'])
latitude = message['latitude']
longitude = message['longitude']
payload = base64.b64decode(message['data']).hex()
print("There is no message.")
print("Error, something is wrong in the request.")


var apiToken = 'FVquFITiVsu3RJ6KbkigpOJccmQFUqMwo6ftCaiWoXXvkyutWZ7t3veZmost1nxEO6OUEMiabu0BZn0N1wR3ssB11ohoRX4a';
var deviceGuid = 'c984ff2b-e4d0-417f-8ea3-11d74a55d251';
var startReceivedDate = '2022-08-01T01:00:00.00';

fetch('' + startReceivedDate + '&deviceGuid=' + deviceGuid, {
method: 'GET',
headers: {
'X-Api-Key': apiToken
.then(response => {
data = response.json();
.catch(error => {
console.log('Error, something is wrong in the request.');