NAV
shell

General Information

Welcome to the Firefly API v1 documentation. This documentation is a Work in Progress. If anything is unclear or undocumented, please reach out to us at documentation@digimondo.de.

Firefly API Documentation URL

  GET "https://apidocs.fireflyiot.com"

The Firefly APIv1 Documentation is located at https://apidocs.fireflyiot.com.

Firefly APIv1 URL

  GET "https://api.fireflyiot.com/api/v1"

The Firefly APIv1 is located at https://api.fireflyiot.com/api/v1.

Using the REST API

For the HTTP methods PUT and POST you have to pass

Content-Type: application/json

in the request headers.

Authentication

Authentication by API Key

To authorize, use the auth parameter:

# With shell, you can just pass the correct header with each request
curl "https://api.fireflyiot.com/api/v1/devices?auth=secretapikey"

Firefly uses API Keys to allow access to the API. You can register a new Firefly API key by requesting one from Digimondo at apikeys@digimondo.de.

Firefly expects for the API key to be included in all API requests to the server as a HTTP Parameter named auth:

auth=secretapikey

API Keys are issued for an Organization. They are allowing access to all Applications and Devices of that Organization and its Sub-Organizations.

API Keys expire after a certain amount of time. The Firefly web interface allows Administrators to revoke and renew API Keys.

Rate Limiting

General Information

API access is rate-limited per API Key to 50 requests over a period of 10 seconds. This is the default value, a change can be requested. In case of surpassing the maximum amount of allowed API calls, a 429 HTTP code will be returned. A wait time before retrying should be implemented, preferably with exponential back-off.

HTTP Response Headers

Every Response will include the following three Header Fields:

x-ratelimit-limit: 50/10000ms
x-ratelimit-reset: 7998
x-ratelimit-remaining: 44
Field Type Description
x-ratelimit-limit String The actual Rate Limit in the form of “50/10000ms”, meaning 50 requests allowed over a span of 10000 milliseconds
x-ratelimit-remaining Integer The number of remaining requests that are allowed within the current Rate Limit window
x-ratelimit-reset Integer The number of milliseconds left in the current Rate Limit window

Make sure you don’t send requests to the API when x-ratelimit-remaining is at 0. In that case, wait x-ratelimit-reset milliseconds before attempting the next request.

Show Rate Limit Details

curl "https://api.fireflyiot.com/api/v1/rate_limit?auth=secretapikey"

This REST endpoint can be used to check the current Rate Limits for your API Key. Calling this endpoint will not count against the rate limits for the key used.

{
  "rate_limit":{
    "remaining": 48,
    "reset": 1234,
    "limit": "50/10000ms"
  },
  "valid_for_key": "secretapikey"
}
Field Type Description
rate_limit.limit String The actual Rate Limit in the form of “50/10000ms”, meaning 50 requests allowed over a span of 10000 milliseconds
rate_limit.remaining Integer The number of remaining requests that are allowed within the current Rate Limit window
rate_limit.reset Integer The number of milliseconds left in the current Rate Limit window
valid_for_key String The API Key for which these rate limit values are valid

Devices

A Device is a Sensor or Appliance which is capable of receiving and/or transmitting LoRaWan packets. Every Device is assigned a unique EUI. Depending on the mode of initial authentication, a Device Address might be assigned.

Show all Devices

Sample Request

GET "https://api.fireflyiot.com/api/v1/devices?auth=secretapikey"

Sample Response

{
  "devices": [
    {
      "updated_at": "2016-05-25T09:02:41.307000",
      "otaa": false,
      "network_session_key": "3C0FD994269EA89AEDDDDDCF55ADDD68",
      "eui": "00000000AABBCCDD",
      "name": "Device #1",
      "description": "The Device with #1",
      "created_at": "2016-05-20T13:51:04.643000",
      "application_session_key": "3C0FD994269EA89AEDDDDDCF55ADDD68",
      "application_key": null,
      "address": "A4DDB314",
      "tags": []
    },
    {
      "updated_at": "2016-06-20T13:56:39.689000",
      "otaa": false,
      "network_session_key": "C3F4FC908AAAAFBA6A2DEA826151E7B2",
      "eui": "00000000DECF02EF",
      "name": "Device #2",
      "description": "The Device with #2",
      "created_at": "2016-06-20T13:56:39.689000",
      "application_session_key": "C3F4FC908AAAAFBA6A2DEA826151E7B2",
      "application_key": null,
      "address": "23DDB76A",
      "tags": []
    }
  ]
}

List all Devices for the Organizations for which the API Key is valid.

Request Fields

Field Type Description
tags Comma-Separated Strings Limits the Devices shown to to ones supporting one or more of the Tags specified, e.g. “sensor, heating” (optional)

Response Format

The Response is an JSON representation of an Array of Devices in no particular order.

Response Fields (per Device)

Field Type Description
address String Hexadecimal Address of the Device
application_key String Application Key valid for this Device
application_session_key String Application Session Key valid for this Device (optional)
created_at Date Date of Initialization of this Device
description String Description of the Device
eui String Unique EUI for this Device
name String Name of this Device
network_session_key String Network Session Key valid for this Device
otaa Boolean States if the Device was activated through Over the Air Activation
tags Array of String All Tags associated with this Device
updated_at Date Date of last Modification of this Device

Show Device

Show a single Device identified by either an EUI or a Device Address.

Show by EUI

Sample Request: Show Device by its EUI

  GET "https://api.fireflyiot.com/api/v1/devices/eui/D4022191A445D748?auth=secretapikey"

Every Device is assigned a unique EUI when it is activated. Using this value to access the Device will allow correct access independent of the internal structure of the database the Device data is stored in.

Show by Device Address

Sample Request: Show Device by its Device Address

  GET "https://api.fireflyiot.com/api/v1/devices/address/B43320AD?auth=secretapikey"

A Device can be assigned a Device Address when it’s activated. Using this value to access the Device will allow correct access only when the Device was indeed issued a Device Address.

Response Format

Sample Response

{
  "device": {
    "updated_at": "2016-06-13T10:23:44",
    "otaa": true,
    "network_session_key": "16FF5B814953444C60713918EDDFA4E7",
    "eui": "D4022191A445D748",
    "name": "A sample Device",
    "description": null,
    "created_at": "2016-05-13T14:11:04.816000",
    "application_session_key": "7B44352BFFAA2A784A744E61EE31BAF3",
    "application_key": "DE22FC9088517FBA6A2DED836151E722",
    "address": "B43320AD",
    "tags": [],
    "organization_id": 500    
  }
}

The Response is a single JSON representation of a Device, wrapped in a device object.

Response Fields

Field Type Description
address String Hexadecimal Address of the Device
application_key String Application Key valid for this Device
application_session_key String Application Session Key valid for this Device (optional)
created_at Date Date of Initialization of this Device
description String Description of the Device
device_class_id Integer Device Class ID of the Device
eui String Unique EUI for this Device
name String The Name of this Device
network_session_key String Network Session Key valid for this Device
organization_id Integer Organization ID of this Device
otaa Boolean States if the Device was activated through Over the Air Activation
tags Array of String All Tags associated with this Device
updated_at Date Date of last Modification of this Device

Create Device

Sample Request

POST "https://api.fireflyiot.com/api/v1/devices?auth=secretapikey"

Sample Request Body

{
  "organization": 23,
  "application": 3,
  "device": {
    "otaa": false,
    "eui": "2564927382738492",
    "description": "A Test Device",
    "name": "A sample Device",
    "address": "ddffddf3",
    "tags": "test,test2"
  }
}

Sample Response

{
  "device": {
    "updated_at": "2016-07-11T13:06:06",
    "otaa": null,
    "network_session_key": null,
    "eui": "2564927382738492",
    "description": "A Test Device",
    "created_at": "2016-07-11T13:06:06",
    "application_session_key": null,
    "name": "A sample Device",
    "application_key": null,
    "address": "ddffddf3",
    "tags": ["test", "test2"],
    "organization_id": 23    
  }
}

Request Fields

Field Type Description
application Integer ID of the application (optional)
device Object Properties of the Device to be created
device.address String Hexadecimal Address of the Device
device.application_key String Application Key valid for this Device
device.application_session_key String Application Session Key valid for this Device (optional)
device.name String Name of the Device
device.description String Description of the Device
device.eui String Unique EUI for this Device
device.network_session_key String Network Session Key valid for this Device
device.otaa Boolean If true, Device will be activated through Over the Air Activation
organization Integer ID of the organization

Response Fields

Same as Single Device Response fields.

Update Device

Sample Request

PUT "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492?auth=secretapikey"

Sample Request Body

{
  "device": {
    "description": "A New Test Device"
  }
}

Sample Response

{
  "device": {
    "updated_at": "2016-07-11T13:26:13",
    "otaa": null,
    "network_session_key": null,
    "eui": "2564927382738492",
    "name": "A sample Device",
    "description": "A New Test Device",
    "created_at": "2016-07-11T13:06:06",
    "application_session_key": null,
    "application_key": null,
    "address": "ddffddf3",
    "organization_id": 500
  }
}

A Device can be updated by sending a PUT/PATCH request to the corresponding ID. It expects a JSON-Body with the fields that should be changed.

This endpoint will not send Packets, it will only reconfigure the Device. To send packets, use the Send Packets to Device method.

Request Fields

Only the fields that should be updated need to be specified.

Field Type Description
device Object Properties of the Device to be updated
device.address String Hexadecimal Address of the Device
device.application_key String Application Key valid for this Device
device.application_session_key String Application Session Key valid for this Device (optional)
device.description String Description of the Device
device.eui String Unique EUI for this Device
device.name String Name of the Device
device.network_session_key String Network Session Key valid for this Device
device.otaa Boolean If true, Device will be activated through Over the Air Activation

Response Fields

Same as Single Device Response fields.

Delete Device

Sample Request

DELETE "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492?auth=secretapikey"

Sample Response

204 No Content

To delete a Device, a DELETE request must be sent with the corresponding Device EUI.

Response

When the Device was deleted, a 204 success message will be returned.

List Packets

Sample Request

GET "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492/packets?auth=secretapikey"

Sample Response

{
  "more": true,
  "packets": [
    {
      "ack": false,
      "bandwidth": 125,
      "codr": "4/6",
      "device_eui": "2564927382738492",
      "fopts": "",
      "fcnt": 12882,
      "freq": 866.349812,
      "gwrx": [
          {
            "tmst": 3977700196,
            "time": "2016-06-22T07:35:34.774224Z",
            "rssi": 2,
            "lsnr": 8.5,
            "gweui": "0000024B080E006D"
          }
        ],      
      "modu": "LORA",
      "mtype": "unconfirmed_data_up",
      "payload_encrypted": false,
      "payload": "415141414277673D",
      "port": 2,
      "received_at": "2016-06-22T09:35:35",
      "size": 28,
      "spreading_factor": 7,
      "uid": "8a569133-ba44-4d7e-5555-af62faf9f722"      
    },  
    {
      "ack": true,
      "bandwidth": 100,
      "codr": "4/6",
      "device_eui": "2564927382738492",
      "fopts": "",
      "fcnt": 12883,
      "freq": 866.347719,
      "gwrx": [
          {
            "tmst": 1468815219,
            "time": "2016-07-18T04:13:39.573216Z",
            "rssi": -35,
            "lsnr": 5.1,
            "gweui": "0102030205060708"
          }          
        ],      
      "modu": "LORA",
      "mtype": "confirmed_data_up",
      "payload_encrypted": false,
      "payload": "415141414277673A",
      "port": 2,
      "received_at": "2016-06-22T09:39:16",
      "size": 28,
      "spreading_factor": 7,
      "uid": "8a569133-7752-4d7e-810d-af62faf9f722"      
    }  
  ]
}

Returns a number of Packets received by the Device.

Request Query Parameters

Query Parameter Description
direction (optional) when set to asc, it will return the oldest Packets first. When set to desc, it will return the most recent packets. Default is desc.
limit_to_last (optional) the amount Packets to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
offset (optional) the amount of most recent Packets to skip before returning Packets. Default value is 0.
payload_only (optional) only return the Payload, the parsed Payload (where applicable), the Timestamp and the Device Address of the Packet. Default is false. Any other value will set this parameter to true.
received_after (optional) only return Packets after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Packets will be omitted). Specify an ISO 8601 Date String here.

Response

The more field will return a boolean value stating of there are more packets in the database than collected with the query specified. This should be used for proper paging implementations.

In the packets collection that is returned, every item represent a Packet that was sent by the Device.

As a reference, please check the LoRa documentation for the precise meaning of this data.

Field Description
ack Was this Packet acknowledged?
bandwidth Bandwidth used by the Device
codr LoRa ECC coding rate identifier
datr Data Rate of the Gateway
device_eui EUI of the Device in the Database
fopts FOpts sent with the Packet
fcnt Frame Counter of the Device at the time of sending the Packet
freq Frequency on which the Packet was received
gwrx Data relevant to the Gateway that received the Packet
gwrx.gweui EUI of the Gateway that received the Packet
gwrx.lsnr LSNR
gwrx.rssi RSSI
gwrx.time Gateway-specific Timestamp of when the Packet was received (nanoseconds). This is not a ‘real’ time value, as it is reset whenever the Gateway is restarted or instructed to reset. Used to guarantee uniqueness of packets.
gwrx.tmst Timestamp of when the Packet was received (seconds).
modu Modulation, will be “LORA”
mtype Type and Direction of Packet
parsed If possible, the decoded and parsed Payload (as configured in the Device Class)
payload Payload that was sent in the Packet
payload_encrypted Was the Payload encrypted?
port Port on which the Packet was sent
received_at Date of Database insertion on the Server
size Length of the Payload
spreading_factor Spreading Factor used by the Device
uid Unique ID of the Packet used by the Server

Track the uid field to ensure packet uniqueness when persisting it into a database.

List Down Packets

Sample Request

GET "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492/down_packets?auth=secretapikey"

Sample Response


{
  "packets": [
    {
      "spreading_factor": 12,
      "sent": "2016-08-30T10:20:35.139026",
      "rx_data": {
        "tmst": 3014015996,
        "time_on_air": 1155072,
        "size": 12,
        "rx_window": "rx1",
        "rfch": 0,
        "powe": 14,
        "modu": "LORA",
        "ipol": true,
        "gw_mac": "0000024B080E00A1",
        "freq": 868.5,
        "datr": "SF12BW125",
        "data": "YCOfO0EgFBKtaGMw",
        "codr": "4/5"
      },
      "raw_payload": "60239F3B41444412AD686330",
      "port": 0,
      "payload": "",
      "parsed_packet": {
        "port": 0,
        "pending": false,
        "payload": null,
        "mtype": "unconfirmed_data_down",
        "mic_pass": true,
        "major": 0,
        "mac_cmds": [],
        "fopts_len": 0,
        "fcnt": 4628,
        "dir": "down",
        "dev_eui": null,
        "dev_addr_hex": "223b9f23",
        "adrackreq": false,
        "adr": false,
        "ack": true
      },
      "inserted_at": "2016-08-30T12:20:35",
      "frame_counter": 4628,
      "device_eui": "2564927382738492",
      "bandwidth": 125,
      "ack": false,
      "uid": "8a569133-aa44-4d7e-810d-af62faf9f722"
    }
  ],
  "more": true
}

Returns a number of Packets received by the Device.

Request Query Parameters

Query Parameter Description
direction (optional) when set to asc, it will return the oldest Down Packets first. When set to desc, it will return the most recent packets. Default is desc.
limit_to_last (optional) the amount Down Packets to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
offset (optional) the amount of most recent Down Packets to skip before returning Down Packets. Default value is 0.
payload_only (optional) only return the Payload, the parsed Down Packet, the Frame Counter, the Timestamp and the Device Address of the Down Packet. Default is false. Any other value will set this parameter to true.
received_after (optional) only return Down Packets after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Down Packets will be omitted). Specify an ISO 8601 Date String here.

Response

The more field will return a boolean value stating of there are more Down Packets in the database than collected with the query specified. This should be used for proper paging implementations.

In the packets collection that is returned, every item represent a Down Packet that was sent to the Device.

As a reference, please check the LoRa documentation for the precise meaning of this data.

Field Description
ack Was this Packet acknowledged?
bandwidth Bandwidth used by the Server
device_eui EUI of the Device in the Database
frame_counter Frame Counter of the Device at the time of sending the Packet
parsed_packet The decoded and parsed Payload of the Packet
payload Payload that was sent in the Packet
received_at Date of Database insertion on the Server
rx_data Data relevant to the Gateway that sent the Packet
sent Date of the Server sending the Packet to the Device
spreading_factor Spreading Factor used by the Server
uid Unique ID of the Packet used by the Server

Track the uid field to ensure packet uniqueness when persisting it into a database.

List Mac Events

Sample Request

GET "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492/mac_events?auth=secretapikey"

Sample Response


{
  "more": true,
  "mac_events": [
    {
      "uid": "8a569133-aa44-4d7e-810d-af62faf9f722",
      "type": "join_accept",
      "received_at": "2016-07-15T14:31:11",
      "frame_counter": null,
      "for_frame_counter": null,
      "direction": "down",
      "device_eui": "2564927382738492"
    },
    {
      "uid": "2d4289f0-03c9-4c42-b078-04aff6e91180",
      "type": "join_request",
      "received_at": "2016-07-15T14:31:11",
      "frame_counter": null,
      "for_frame_counter": null,
      "direction": "up",
      "device_eui": "2564927382738492"
    }
  ]
}

Returns a number of Mac Commands received by and sent to the Device.

Request Query Parameters

Query Parameter Description
direction (optional) when set to asc, it will return the oldest Mac Events first. When set to desc, it will return the most recent events. Default is desc.
limit_to_last (optional) the amount Mac Events to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
offset (optional) the amount of most recent Mac Events to skip before returning Mac Events. Default value is 0.
received_after (optional) only return Mac Events after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Mac Events will be omitted). Specify an ISO 8601 Date String here.

Response

The more field will return a boolean value stating of there are more Mac Events in the database than collected with the query specified. This should be used for proper paging implementations.

In the mac_events collection that is returned, every item represent a Mac Event that was sent to or received by the Device.

As a reference, please check the LoRa documentation for the precise meaning of this data.

Field Description
device_eui EUI of the Device in the Database
frame_counter Frame Counter of the Device at the time of sending the Mac Command
for_frame_counter Frame Counter reference of the Mac Command
received_at Date of Database insertion on the Server
direction Direction of the Mac Command, up (to the Device) or down (from the Device)
type Type of the Mac Command, can be any of the following: join_request, join_accept, ack_up, ack_down, mic_fail, appserver_join_accept.
uid Unique ID of the Mac Command used by the Server

Track the uid field to ensure mac event uniqueness when persisting it into a database.

Send Packet to Device

Sample Request

POST "https://api.fireflyiot.com/api/v1/devices/eui/2564927382738492/packet?auth=secretapikey"

Sample Request Body

{
  "payload": "Test Payload",
  "encoding": "utf8",
  "port": 1,
  "confirmed": false
}

Sample Response

{
  "sent_packet": {
      "port": 1,
      "payload": "54657374205061796C6F6164",
      "id": 26,
      "fcnt": 15
  }
}

Send a Packet to the Device. Make sure the Payload is correctly encoded as specified on the encoding parameter.

Request Fields

The Request Body must be a valid JSON Object with these fields:

Field Type Description
encoding String Encoding of the Payload. Allowed values are base16, base64 and utf8
payload String Payload to be sent in the Packet
port Integer Port on the Device to send the Packet to
confirmed Boolean optional Ask the device to acknowledge the down packet

Response Fields

Field Description
fcnt Integer
id Integer
payload String
port Integer

Applications

Show Applications

Sample Request

GET "https://api.fireflyiot.com/api/v1/applications?auth=secretapikey"

Sample Response

{
  "applications": [
    {
      "updated_at": "2016-05-31T14:04:47.598000",
      "sink": null,
      "name": "Testing Applications",
      "inserted_at": "2016-05-31T14:04:47.598000",
      "id": 18,
      "eui": null,
      "description": "Test Application 1"
    },
    {
      "updated_at": "2016-06-07T15:02:41.613000",
      "sink": {
        "send_to_firebase": "firebase-url"
      },
      "name": "App Test 1",
      "inserted_at": "2016-06-07T15:02:41.613000",
      "id": 19,
      "eui": null,
      "description": "E.ON power meter application"
    },
    {
      "updated_at": "2016-04-21T10:47:21.770000",
      "sink": null,
      "name": "Test Applikation 2",
      "inserted_at": "2016-04-21T10:47:21.770000",
      "id": 3,
      "eui": "3435343334353435",
      "description": "Beschreibung für die Applikation"
    }
  ]
}

List all Applications for the Organizations for which the API Key is valid.

Response Format

The Response is an JSON representation of an Array of Applications in no particular order.

Response Fields (per Device)

Field Type Description
created_at Date Date of Creation of this Application
description String Description of this Application
eui String Unique EUI of this Application
id Integer Unique ID of this Application in the Firefly database
name String Name for this Application
sink JSON Additional Data for the Application
updated_at Date Date of last Modification of this Application

List EUIs of Devices

Sample Request

GET "https://api.fireflyiot.com/api/v1/applications/1/euis?auth=secretapikey"

Sample Response

{
  "devices": [
    {
      "eui": "000000004136AF4A",
      "address": "4136AF4A"
    },
    {
      "eui": "00000000232317D2",
      "address": "232317D2"
    },
    {
      "eui": "000000004137DF3A",
      "address": "4137DF3A"
    }
  ]
}

Lists all Devices that belong to this Application.

Response Format

The Response is an JSON representation of an Array of Devices in no particular order.

Response Fields (per Device)

Field Type Description
address String Hexadecimal representation of the Device Address for this Device
eui String Unique EUI of this Device

Device Classes

Show Device Classes

Sample Request

GET "https://api.fireflyiot.com/api/v1/device_classes?auth=secretapikey"

Sample Response

{
  "device_classes": [
    {
      "updated_at": "2016-04-22T12:52:16.109000",
      "script": {
        "variables": {
          "gps": {
            "type": "gps",
            "name": "gps"
          },
          "batteryLevel": {
            "type": "range",
            "name": "batteryLevel"
          },
          "battery": {
            "type": "hidden",
            "name": "battery"
          }
        },
        "parseElements": [
          {
            "type": "int",
            "target": "battery",
            "bits": "8"
          },
          {
            "type": "int",
            "target": "gps.latitude",
            "signed": true,
            "bits": "24"
          },
          {
            "type": "int",
            "target": "gps.longitude",
            "signed": true,
            "bits": "24"
          },
          {
            "type": "int",
            "target": "gps.altitude",
            "signed": true,
            "bits": "16"
          }
        ],
        "calculateElements": [
          {
            "target": "batteryLevel",
            "formula": "battery != 0 ? (battery - 1) / 253 : null"
          },
          {
            "target": "gps.latitude",
            "formula": "gps.latitude / (1 << 23) * 90"
          },
          {
            "target": "gps.longitude",
            "formula": "gps.longitude / (1 << 23) * 180"
          }
        ]
      },
      "name": "Test Device Class",
      "inserted_at": "2016-04-20T15:09:18.911000",
      "id": 2,
      "description": null
    }
  ]
}

This Route shows all Device Classes registered to the API Key.

Response Format

The Response is an JSON representation of an Array of Device Classes in no particular order.

Response Fields (per Device Class)

Field Type Description
description String Description for the Device Class
id Integer Unique ID of this Device Class in the Firefly database
inserted_at String Date of Creation
name String Name of the Device Class
script JSON Script Data for the Frontend Application
updated_at String Date of last Manipulation

Show Single Device Class

Sample Request

GET "https://api.fireflyiot.com/api/v1/device_classes/1?auth=secretapikey"

Sample Response

{
  "device_classes": {  
    "updated_at": "2016-04-22T12:52:16.109000",
    "script": {
      "variables": {
        "gps": {
          "type": "gps",
          "name": "gps"
        },
        "battery": {
          "type": "hidden",
          "name": "battery"
        }
      },
      "parseElements": [
        {
          "type": "int",
          "target": "battery",
          "bits": "8"
        },
        {
          "type": "int",
          "target": "gps.latitude",
          "signed": true,
          "bits": "24"
        },
        {
          "type": "int",
          "target": "gps.longitude",
          "signed": true,
          "bits": "24"
        },
        {
          "type": "int",
          "target": "gps.altitude",
          "signed": true,
          "bits": "16"
        }
      ],
      "calculateElements": [
        {
          "target": "batteryLevel",
          "formula": "battery != 0 ? (battery - 1) / 253 : null"
        },
        {
          "target": "gps.latitude",
          "formula": "gps.latitude / (1 << 23) * 90"
        },
        {
          "target": "gps.longitude",
          "formula": "gps.longitude / (1 << 23) * 180"
        }
      ]
    },
    "name": "Test Device Class",
    "inserted_at": "2016-04-20T15:09:18.911000",
    "id": 2,
    "description": null
  }
}

This Route shows a single Device Class registered to the API Key by ID.

Response Fields

Field Type Description
description String Description for the Device Class
id Integer Unique ID of this Device Class in the Firefly database
inserted_at String Date of Creation
name String Name of the Device Class
script JSON Script Data for the Frontend Application
updated_at String Date of last Manipulation

List EUIs of Devices

Sample Request

GET "https://api.fireflyiot.com/api/v1/device_classes/1/euis?auth=secretapikey"

Sample Response

{
  "devices": [
    {
      "id": 63,
      "eui": "000000004136AF4A",
      "address": "4136AF4A"
    },
    {
      "id": 304,
      "eui": "00000000232317D2",
      "address": "232317D2"
    },
    {
      "id": 81,
      "eui": "000000004137DF3A",
      "address": "4137DF3A"
    }
  ]
}

Lists all Devices that belong to this Device Class.

Response Format

The Response is an JSON representation of an Array of Devices in no particular order.

Response Fields (per Device)

Field Type Description
address String Hexadecimal representation of the Device Address for this Device
eui String Unique EUI of this Device
id Integer Unique ID of this Device in the Firefly database

All Packets

Sample Request

GET "https://api.fireflyiot.com/api/v1/packets?auth=secretapikey"

The API provides an endpoint to fetch all Packets for the Organizations for which your API Key was issued.

Request Query Parameters

Query Parameter Description
direction (optional) when set to asc, it will return the oldest Packets first. When set to desc, it will return the most recent packets. Default is desc.
limit_to_last (optional) the amount Packets to be returned. Ordered by creation date, descending (unless otherwise specified through the direction parameter). Default value is 1 Maximum value is 100.
offset (optional) the amount of most recent Packets to skip before returning Packets. Default value is 0.
payload_only (optional) only return the Payload, Timestamp and Device Address of the Packet. Default is false. Any other value will set this parameter to true.
received_after (optional) only return packets after this date. If this parameter is used and no limit_to_last value is supplied, limit_to_last will be set to 10. Default is the Unix Epoch Timestamp (meaning that no Packets will be omitted). Specify an ISO 8601 Date String here.
skip_suborgs (optional) do NOT show Packets from Devices that are not directly in the Organization that the API Key is registered for.

Response

The API will provide the same fields as in List Packets.

API Key Management

Show own API Key Metadata

Sample Request

GET "https://api.fireflyiot.com/api/v1/apikeys?auth=secretapikey"

Sample Response

{
  "apikey": {
    "valid_until": "2017-02-20T14:28:00",
    "rate_scale": 1000,
    "rate_limit": 5,
    "organization_id": 25,
    "name": "Test API Key",
    "may_be_modified": false,
    "key": "93444e69bd7aadddd0b280dcc20e479b",
    "created_at": "2016-11-22T14:28:11.000000"
  }
}

Shows information about validity and rate limiting values attached to the API Key being used.

Response Format

The Response is an JSON representation of an API Key.

Response Fields

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Show API Key Metadata

Sample Request

GET "https://api.fireflyiot.com/api/v1/apikeys/93444e69bd7aadddd0b280dcc20e479b?auth=secretapikey"

Sample Response

{
  "apikey": {
    "valid_until": "2017-02-20T14:28:00",
    "rate_scale": 1000,
    "rate_limit": 5,
    "organization_id": 25,
    "name": "Test API Key",
    "may_be_modified": false,
    "key": "93444e69bd7aadddd0b280dcc20e479b",
    "created_at": "2016-11-22T14:28:11.000000"
  }
}

Shows information about validity and rate limiting values attached to the API Key sent as a Query Parameter.

Response Format

The Response is an JSON representation of an API Key.

Response Fields

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Show API Keys for own Organization

Sample Request

GET "https://api.fireflyiot.com/api/v1/apikeys/organization?auth=secretapikey"

Sample Response

{
  "remaining": 3,
  "apikeys": [
    {
      "valid_until": "2016-11-17T12:19:00",
      "rate_scale": 10000,
      "rate_limit": 100,
      "organization_id": 25,
      "name": "Csaba Harta",
      "may_be_modified": false,
      "key": "9b608eaba123456c51dc25eb438d54c3",
      "created_at": "2016-08-19T12:19:47.000000"
    },
    {
      "valid_until": "2017-02-13T16:01:55.192672",
      "rate_scale": 10000,
      "rate_limit": 50,
      "organization_id": 25,
      "name": "Test HCP Rate 50",
      "may_be_modified": false,
      "key": "fe65af387dceeb5543435780c48babb",
      "created_at": "2016-11-15T16:01:55.000000"
    }
  ]
}

Shows all API Keys issued for the Organization for which the API Key used is issued

Response Format

The Response is an JSON representation of a list of API Keys.

Response Fields (per API Key)

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Response Fields (additional)

Field Type Description
remaining Integer The number of API Keys that can be created before the limit is reached

Show API Keys for Organization

Sample Request

GET "https://api.fireflyiot.com/api/v1/apikeys/organization/25?auth=secretapikey"

Sample Response

{
  "remaining": 3,
  "apikeys": [
    {
      "valid_until": "2016-11-17T12:19:00",
      "rate_scale": 10000,
      "rate_limit": 100,
      "organization_id": 25,
      "name": "Csaba Harta",
      "may_be_modified": false,
      "key": "9b608eaba123456c51dc25eb438d54c3",
      "created_at": "2016-08-19T12:19:47.000000"
    },
    {
      "valid_until": "2017-02-13T16:01:55.192672",
      "rate_scale": 10000,
      "rate_limit": 50,
      "organization_id": 25,
      "name": "Test HCP Rate 50",
      "may_be_modified": false,
      "key": "fe65af387dceeb5543435780c48babb",
      "created_at": "2016-11-15T16:01:55.000000"
    }
  ]
}

Shows all API Keys issued for the Organization for which the API Key used is issued

Response Format

The Response is an JSON representation of a list of API Keys.

Response Fields (per API Key)

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Response Fields (additional)

Field Type Description
remaining Integer The number of API Keys that can be created before the limit is reached

Renew API Key

Sample Request

PUT "https://api.fireflyiot.com/api/v1/apikeys/renew?auth=secretapikey"

Sample Response

{
  "revoked_key": {
    "revoked": true,
    "key": "93444e69bd7aadddd0b280dcc20e479b"
  },
  "created_key": {
    "valid_until": "2017-05-17T11:52:19.789049",
    "rate_scale": 20,
    "rate_limit": 20,
    "organization_id": -1,
    "name": "test",
    "may_be_modified": false,
    "key": "b974e02ccd082b0ddddaa7db96e44439",
    "created_at": "2017-02-16T11:52:19.825607"
  }
}

Revokes currently used API Key and creates a new API Key in an atomic operation.

Response Format

The Response is an JSON representation of the newly created API Key and information about the revocation of the old.

Response Fields

Field Type Description
revoked_key.revoked Boolean States whether the old API Key was successfully revoked
revoked_key.key String The API Key that was revoked
created_key.valid_until Date ISO Date of the point in time when the new API Key becomes automatically revoked
created_key.rate_scale Integer Time window for Rate Limiting
created_key.rate_limit Integer Amount of allowed calls in Rate Limit time window
created_key.organization_id Integer Identifier of the Organization for which the new API Key was issued
created_key.name String Name of the new API Key
created_key.may_be_modified Boolean States whether the new API Key can be changed by the Organization it was issued for
created_key.key String The actual value of the new API Key, to be used as a credential
created_key.created_at Date Date of when the new API Key was created

Revoke API Keys

Sample Request

PUT "https://api.fireflyiot.com/api/v1/apikeys/renew?auth=secretapikey"
{
  keys: ["3c5e3b7a4c7f746a7043896bf4bd5643", "d1d0c10c3196e811999cd7535f08bd16"]
}

Sample Response

{
  "apikeys": [
    {
      "revoked": true,
      "key": "3c5e3b7a4c7f746a7043896bf4bd5643"
    },
    {
      "revoked": true,
      "key": "d1d0c10c3196e811999cd7535f08bd16"
    }
  ]
}

Revokes any number of API Keys.

Request Fields

Field Type Description
keys Array of Strings The API Keys to be revoked

Response Format

The Response is an JSON representation of information about the revocation of the listed API Keys.

Response Fields (per API Key)

Field Type Description
revoked Boolean States whether the API Key was successfully revoked
key String The API Key that was revoked

Create API Key

Sample Request

POST "https://api.fireflyiot.com/api/v1/apikeys?auth=secretapikey"
{
  "key": {
    "name": "test",
    "rate_scale": 20,
    "rate_limit": 20
  }
}

Sample Response

{
  "apikey": {
    "valid_until": "2017-05-17T12:02:21.614030",
    "rate_scale": 20,
    "rate_limit": 20,
    "organization_id": 36,
    "name": "test",
    "may_be_modified": false,
    "key": "a4bb2cbcb07dd56ddd996374f7415b54",
    "created_at": "2017-02-16T12:02:21.633122"
  }
}

Creates a new API Key in the Organization to which the currently used API Key is assigned.

Response Format

The Response is an JSON representation of an API Key.

Response Fields

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Create API Key in Organization

Sample Request

POST "https://api.fireflyiot.com/api/v1/apikeys/organization/36?auth=secretapikey"
{
  "key": {
    "name": "test",
    "rate_scale": 20,
    "rate_limit": 20
  }
}

Sample Response

{
  "apikey": {
    "valid_until": "2017-05-17T12:02:21.614030",
    "rate_scale": 20,
    "rate_limit": 20,
    "organization_id": 36,
    "name": "test",
    "may_be_modified": false,
    "key": "a4bb2cbcb07dd56ddd996374f7415b54",
    "created_at": "2017-02-16T12:02:21.633122"
  }
}

Creates a new API Key in the Organization for which the Organization ID was provided as a query parameter.

Response Format

The Response is an JSON representation of an API Key.

Response Fields

Field Type Description
valid_until Date ISO Date of the point in time when this API Key becomes automatically revoked
rate_scale Integer Time window for Rate Limiting
rate_limit Integer Amount of allowed calls in Rate Limit time window
organization_id Integer Identifier of the Organization for which the API Key was issued
name String Name of this API Key
may_be_modified Boolean States whether this API Key can be changed by the Organization it was issued for
key String The actual value of the API Key, to be used as a credential
created_at Date Date of when the API Key was created

Statistics

API that provides statistical data for up packets in devices and organizations. Meant to be plugged into 3rd party billing application.

Example output

{
  "buckets": [
    {
      "packets": 1913,
      "date": "2016-10-01T00:00:00Z",
      "bytes": 44813
    },
    {
      "packets": 8615,
      "date": "2016-11-01T00:00:00Z",
      "bytes": 249863
    },
    {
      "packets": 0,
      "date": "2016-12-01T00:00:00Z",
      "bytes": 0
    },
    {
      "packets": 659,
      "date": "2017-01-01T00:00:00Z",
      "bytes": 19119
    }
  ]
}

Devices

Device stats URL

GET https://api.fireflyiot.com/api/v1/statistics/devices/{eui}?auth={secretapikey}

Used to query for statistics over a single device.

Organizations

Organization stats URL

GET https://api.fireflyiot.com/api/v1/statistics/organizations/{org id}?auth={secretapikey}

Used to query for statistics over all devices (recursively) in an organization.

Shared options

All options can be used on both API routes. Everything is optional.

Field Type Description
after date Only return statistics for the time after the given date. Can be combined with before to query for a range.
before date Only return statistics for the time before the given date. Can be combined with after to query for a range.
interval day / month Interval of the buckets.
fill_missing_buckets boolean true by default. For device queries, this will detects buckets that are missing from the database output and populate them with 0 values.

WebSocket API (deprecated)

The WebSocket API has been deprecated in favor of subscriptions. To continue using WebSockets, create a subscription with a websocket queue.

General

The Firefly Websocket API allows for real-time Streaming of Packets as they are received by the Application Server. A HTTP Websocket connection needs to be established with wss://api.fireflyiot.com/api/websocket.

Authentication

The Firefly Websocket API uses the same API Keys that are used for the REST API.

Use the API Key as a Connection Paramenter like wss://api.fireflyiot.com/api/websocket?auth=secretapikey.

Libraries

To connect to the Application Server Channels, you will need to use a Phoenix Channels-compatible library.

JavaScript

var phoenix = require("./phoenix-common.js")
var socket = new phoenix.Socket("wss://api.fireflyiot.com/api", {
  transport: require("websocket").w3cwebsocket,
  params: {auth: "206b02ed500addc57bb12244151d6a7a"
}})

socket.connect()
socket.onError(function(err) {console.log("error:", err)})

var channel = socket.channel("device:000000001EE00001", {
  received_after: "2016-08-02 00:00:00"
})

channel.join()
    .receive("ok", function() {console.log("joined")})
    .receive("error", function(reason) {console.log("error:", reason)})

channel.on("packets", function(message) {console.log("message", message)})

To connect via JavaScript, you can either use the JavaScript supplied with the Phoenix Framework or use the ready-to-use Phoenix Channels JavaScript client library that we supply at digimondo/phoenix-websocket-js, called phoenix-common.js.

Channels

Once connected, you can subscribed to Channels which will expose received Packets for each Device.

Device Channels

Connect to device:<eui>, e.g. device:00000000413B9F61 to receive Packet updates for the Device with the corresponding EUI.

Device Class Channels

Connect to device_class:<id>, e.g. device_class:1 to receive Device updates for the Device Class with the corresponding ID.

Subscriptions

Subscriptions allow you to fine-tune which events are sent where.

Subscriptions can be set up with a ReST API.

Subscription Object

Field Type Description
id integer (read only) Unique ID of the subscription
name string Human-readable name of the subscription
bindings array List of bindings, see: Binding Object
queues array List of queues, see: Queue Object
organization_id integer Unique ID of the organization this subscription is attached to

List all subscriptions

Sample Request

GET "https://api.fireflyiot.com/api/v1/subscriptions?auth={secretapikey}"

Sample Response

{
    "subscriptions": [
        {
            "bindings": [
                {
                    "id": 22,
                    "opts": {
                        "device_eui": null,
                        "id": "6d7fa8f9-6d3f-42a8-92f3-bc0cd6f3b98d",
                        "include_suborganizations": null,
                        "organization": -1
                    },
                    "subscription_id": 3,
                    "template_id": 2,
                    "type": "organization_up_packets"
                }
            ],
            "id": 3,
            "name": "test",
            "organization_id": -1,
            "queues": [
                {
                    "opts": {},
                    "subscription_id": 3,
                    "type": "websocket",
                    "uid": "eeb95e33-d1ba-4a46-b22f-0c27a5955e53"
                }
            ]
        }
    ]
}

Will list all subscriptions of the organization the used API key is bound to.

Endpoint GET /api/v1/subscriptions?auth={secretapikey}

Returns

Field Type Description
subscriptions array List of subscriptions, see: Subscription Object

Create Subscription

Sample Request

POST "https://api.fireflyiot.com/api/v1/subscriptions?auth=secretapikey"
{
  "subscription": {
    "name": "foobar",
    "organization_id": 8,
    "bindings": [{
      "type": "organization_up_packets",
      "opts": {
        "organization": 8
      },
      "template_id": 1
    }],
    "queues": [{
      "type": "websocket"
    }]
  }
}

Creates a new subscription. You don’t need to define bindings or queues right away, you can also add them later with the respective API methods for:

If you choose to not configure queues or bindings right away, pass an empty list []

Endpoint POST /api/v1/subscriptions?auth={secretapikey}

Request body JSON object with this field:

Field Type
subscription Subscription object

Update Subscription

Update a subscription by using PUT on its URL and passing only the values you want to change.

Endpoint PUT /api/v1/subscriptions/{subscription_id}?auth={secretapikey}

Request body JSON object with this field:

Field Type
subscription Subscription object

Delete Subscription

Endpoint DELETE /api/v1/subscriptions/{subscription_id}?auth={secretapikey}

Subscription Bindings

A binding defines which events should be passed to a subscription’s queues.

Binding Object

Example Binding Object

{
  "id": 1,
  "type": "organization_up_packets",
  "opts": {
    "organization": 12
  },
  "template_id": 52,
  "subscription_id": 31
}
Field Type Description
id Integer (read only) Unique ID of the binding
type String Type of the binding. possible values
opts Object Options that depend on the type
template_id Integer ID of the template that renders this binding’s payload
subscription_id Integer ID of the subscription of this binding

Binding Types

Organization level types

Example organization opts

{
  "organization": 32
}

Generally, organization level types will bind to all packets in all devices of the organization specified in opts and its suborganizations.

Options

Field Type Description
organization Integer ID of the organization

Device level types

Example device opts

{
  "device_eui": "3DA6B1B33D2C0CCA"
}

Device level types will bind to all packets in one device.

Options

Field Type Description
device_eui String Base16 encoded big endian EUI of the device.

Create Binding

Endpoint POST /api/v1/subscriptions/{organization_id}/bindings?auth={secretapikey}

Request Body JSON with these fields:

Field Type
binding Binding object

Update Binding

You can edit a binding later if you want to change properties. Like with all other update API methods, you only have to pass the fields you want to change.

Endpoint PUT /api/v1/subscriptions/{organization_id}/bindings/{binding_id}?auth={secretapikey}

Request Body Same as Add binding, but you can omit fields that you don’t want to edit.

Response Body A JSON Object with a field binding, containing a Binding object. This represents the binding after your changes have been applied to it.

Delete Binding

Use this to remove a binding from a subscription.

Endpoint DELETE /api/v1/subscriptions/{organization_id}/bindings/{binding_id}?auth={secretapikey}

Subscription Queues

Queue Object

Example Queue Object

{
  "uid": "eeb95e33-d1ba-4a46-b22f-0c27a5955e53",
  "type": "http_push",
  "subscription_id": 12,
  "opts": {
    "url": "http://api.iot-app.io/push/",
    "method": "POST"
  }
}
Field Type Description
uid UUID (read-only) Unique ID of the queue
type String Type of the queue. possible values
subscription_id Integer ID of the queue’s subscription
opts Object Options for the queue that depend on its type

Queue types

The queue type decides how the events and messages get to your application.

We currently offer http_push (webhook), websocket and http_pull (polling).

http_push

Pushes all events to an external HTTP server.

It is recommended to use HTTPS to prevent bad people from eaves-dropping on your data.

Options

Field Type Description
method String HTTP method to use (GET, POST, PUT, DELETE, PATCH)
url String HTTP URL to push to
headers Object key-value list of headers to use in the HTTP request.

websocket

WebSocket endpoint that sends events as they happen.

After creation, a client can connect to wss://api.fireflyiot.com/api/v1/subscriptions/websocket/{uid}, where {uid} is replaced with whatever uid was returned by the API.

The queue will only start accumulating messages after the first client has connected to the WebSocket.

In case of disconnects, messages will be stored until the client reconnects or 2 hours have passed, whichever comes first. This allows clients to recover from crashes or restarts without missing any events.

It is possible to connect multiple clients to the same WebSocket, in which case messages are distributed equally in a round-robin fashion.

If you want all clients to receive all messages, you need to create a queue for each client.

http_pull

HTTP endpoint to poll for new messages.

Use GET https://api.fireflyiot.com/api/v1/subscriptions/http_pull/<uid>?auth=<apikey> to get new events. Similar to the WebSocket queue, events will only be kept for 2 hours.

Options

You can pass the following query parameters when calling the URL.

encoding (String) Decides how the payload should be formatted in the HTTP Body.

Possible values:

separator (String) Overrides the separation string when the encoding is not json.

limit (Integer) Defines the maximum amount of messages to return. If not set, will return all messages.

Create Queue

Endpoint POST /api/v1/subscriptions/{subscription_id}/queues?auth={secretapikey}

Request Body JSON object with a field queue that contains a Queue Object, the uid field is generated automatically

Show Queue

Endpoint GET /api/v1/subscriptions/{subscription_id}/queues/{queue_uid}?auth={secretapikey}

List all queues of subscription

Endpoint GET /api/v1/subscriptions/{subscription_id}/queues?auth={secretapikey}

Update Queue

Endpoint PUT /api/v1/subscriptions/{subscription_id}/queues/{queue_uid}?auth={secretapikey}

Request Body JSON object with field queue that contains all the values you want to overwrite. See: Queue Object

Delete Queue

Endpoint DELETE /api/v1/subscriptions/{subscription_id}/queues/{queue_uid}?auth={secretapikey}

Subscription Templates

Each binding has a template which is used to format each message that was received over it.

Template Object

Example Object

{
  "id": 45,
  "name": "Device JSON",
  "source": "<%= Poison.encode!(@subject) %>",
  "organization_id": 31,
  "visibility": "public",
  "code_type": "eex"
}
Field Type Description
id Integer (read only) Unique ID of the template
name String Human readable name of the template. Used to identify it in the UI.
source String Source code of the template. Language depends on code_type field
organization_id Integer ID of the organization the template is bound to
visibility String Visibility of the template to other organizations. Possible values
code_type String Language of the source code. Possible values

Template Language

Templates currently support code written the following languages:

Language code_type Documentation
Elixir ex Homepage
Embedded Elixir eex HexDocs

When creating or updating a template, the code will be checked for allowed function calls and modules.

Allowed Modules

Allowed Functions

The following functions of the Kernel module are whitelisted:

Template Visibility

List Templates

Endpoint GET /api/v1/templates?auth={secretapikey}

Lists all templates that are visible to the organization the given secretapikey is bound to.

Create Template

Endpoint POST /api/v1/templates?auth={secretapikey}

Request Body JSON object with a field template that contains a Template Object

Update Template

Endpoint PUT /api/v1/templates/{template_id}?auth={secretapikey}

Request Body JSON object with field template that contains all the values you want to overwrite. See: Template Object

Delete Template

Endpoint DELETE /api/v1/templates/{template_id}?auth={secretapikey}