Create a Session Token
Exchange your organization Developer Key for a short-lived session token used to control devices.
Send your Developer Key as Authorization: Bearer <melody_key>. Optionally restrict the
token to specific devices by listing their Device Keys; omit device_keys to allow every
device linked to your organization.
The returned token is then used on every /device/* request as
Authorization: Bearer <session_token> together with the X-Device-Key header.
Flow
- Obtain your Organization ID and Developer Key from Melody (see Authentication).
- Link a device to your organization via
POST /device/otp/confirm/v2to get its Device Key. - Call this endpoint with your Developer Key to receive a session token.
- Control the device via
/device/*using the session token andX-Device-Key.
Usage
Authorizations
Developer Key tied to your organization. Your Organization ID and Developer Key are issued to you by Melody — contact support@getmelody.io to request them. Used to create session tokens via POST /api/sessions/v2, and to link devices via the X-Org-Key header on POST /device/otp/confirm/v2.
Body
Response
Session token created
Response from POST /api/sessions/v2. Contains a short-lived session token used with the X-Device-Key header.