---
title: "api/devices POST
Create or Update a Device"
method: POST
path: "/api/devices"
tags: ["Api\\DeviceController"]
---

# api/devices POST
Create or Update a Device

`POST /api/devices`

## Headers

- `Authorization` string
- `Content-Type` string
- `Accept` string
- `Accept-language` string

## Request body

- object
  - `id` integer — Device id to update. (Required without key and hardware_id)
  - `key` string — DEV EUI of the sensor to enable storing sensor data incoming on the api/sensors or api/lora_sensors endpoint. (Required without id and hardware_id)
  - `hardware_id` string — Hardware id of the device as device name in TTN. (Required without id and key)
  - `name` string — Device name
  - `hive_id` integer — Hive that the sensor is measuring. Default: null
  - `type` string — Category name of the hive type from the Categories table. Default: beep
  - `last_message_received` string — Will be converted with date('Y-m-d H:i:s', $last_message_received); before storing
  - `firmware_version` string — Firmware version of the Device
  - `hardware_version` string — Hardware version of the Device
  - `boot_count` integer — Amount of boots of the Device
  - `measurement_interval_min` number — Measurement interval in minutes
  - `measurement_transmission_ratio` number — Measurements ratio of non-transmitted vs transmitted messages. If 0 or 1, every measurement gets transmitted.
  - `ble_pin` string — Bleutooth PIN of Device: 6 numbers between 0-9
  - `battery_voltage` number — Last measured battery voltage
  - `next_downlink_message` string — Hex string to send via downlink at next connection (LoRaWAN port 6)
  - `last_downlink_result` string — Result received from BEEP base after downlink message (LoRaWAN port 5)
  - `create_ttn_device` boolean — If true, create a new LoRaWAN device in the BEEP TTN console. If succesfull, create the device.
  - `app_key` string — BEEP base LoRaWAN application key that you would like to store in TTN

---

[API](https://skmtc.dev/beepnl/apis/beep.md) · [All operations](https://skmtc.dev/beepnl/apis/beep/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/beepnl/beep/revisions/7f1e35deb524/schema)
