Create a new device and receive a JWT token. This token is used for all subsequent device operations.
Important: Save the JWT token securely - it provides access to all device operations.
POST
/devices
curl \
--request POST 'http://localhost:7001/devices' \
--header "X-API-Key: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"device_name":"Production Phone"}'
Request examples
{
"device_name": "Production Phone"
}
Response examples (201)
{
"status": true,
"code": 201,
"message": "Device created successfully",
"data": {
"device_id": "550e8400-e29b-41d4-a716-446655440000",
"device_secret": "a1b2c3d4e5f6g7h8",
"device_name": "Production Phone",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"message": "Device created successfully. Save the device_secret securely."
}
}