Skip to main content
This guide takes you from credentials to a moving stroker: authenticate, link a device, and send your first motion command.

1. Get authenticated

All API traffic goes to a single endpoint:
Access is scoped to your organization. Your Organization ID and Developer Key are issued by Melody — contact support to request them. Devices are controlled with a short-lived session token, not with the Developer Key itself:
  1. Link a device to your organization via POST /device/otp/confirm/v2 (Developer Key in the X-Org-Key header) to get its Device Key.
  2. Exchange your Developer Key for a session token at POST /api/sessions/v2.
  3. Send every device request with both headers:
A missing or invalid token returns 401 Unauthorized.

2. Connect your device

Connect the device to WiFi so it can reach the Melody server — the API in this guide talks to the device through the server, so the device has to be online. GET /device/session answers 200 once it is, and 404 while it is not. BLE is a separate, local path: an app next to the device can drive it directly over GATT, without the server and without this API. The position and timing semantics are the same, but the wire format is not — see the BLE Services Reference.

3. Send your first haptic command

POST /device/hdc/command moves the stroker to a target position over a given time.
  • position — target position, 0 to 10000 (0.01% of the calibrated range per step)
  • time — how long the move takes, in milliseconds

Example request

This drives the stroker to mid-stroke over half a second.

4. Pick a playback protocol

Direct control is one of four ways to drive the device. Choose the one that matches your source material: HPS needs at least two points before the stroker moves. HSC is available over WiFi only.

5. Next steps

Melody Overview & Setup

Device modes, position and velocity ranges, and how the playback protocols differ across transports.

BLE API Integration

The GATT services and characteristics the device exposes over Bluetooth Low Energy.

WiFi Device Integration

Read device info and status, and send commands over the WiFi API.

API Reference

Every endpoint, schema, and parameter.