HeadSpin Documentation
Documentation

Using the bluetooth API

Bluetooth API

Overview: Available API Routes

Method Route Notes
POST /v0/bluetooth/mode Change bluetooth mode on a device.
POST /v0/bluetooth/pair Pair a bluetooth device.

Mode

The mode endpoint allows changing the bluetooth mode of a device.

Can only be used on a device locked by the same user.

Parameters

  • <code class="dcode">device_address</code> the device to change
  • <code class="dcode">use_hsp</code> true to use HSP mode, false to switch back to A2DP mode

Example


curl -X POST https://<your_api_token>@api-dev.headspin.io/v0/bluetooth/mode --data '{"device_address":"{android-device-id}@{hostname}", "use_hsp":false}' -H "Content-Type: application/json"

Response:


{"device": "<device_id>", "status": "ok", "use_hsp": false}

Pair

The pair endpoint should not normally be needed, but in some cases a bluetooth device can lose the audio pairing and pair can be used to try and automatically pair it to the correct audio device again. Note that pairing can take a long time (up to a minute) and the endpoint will only return once completed.

Can only be used on a device locked by the same user.

Parameters

  • <code class="dcode">device_address</code> the device to pair

Example


curl -X POST https://<your_api_token>@api-dev.headspin.io/v0/bluetooth/pair --data '{"device_address":"{android-device-id}@{hostname}"}' -H "Content-Type: application/json"

Response:


{"device": "<device_id>", "status": "paired"}