Skip to content

REST API

The REST API provides a simplified interface for reading device state, controlling devices, and running scenes. Authenticate with an access token (hc_...) or OAuth Bearer token.

Base URL: https://api.homecast.cloud/rest (Cloud) or http://your-mac.local:5656/rest (Community)

Enable Developer Mode in SettingsAccount, then find your API endpoints and tokens in SettingsAPI Access.

API endpoints

GET /rest/state

Read the current state of all accessible homes in a simplified, flat format.

bash
curl https://api.homecast.cloud/rest/state \
  -H "Authorization: Bearer hc_your_token"

Query parameters

ParameterTypeDescription
homestringFilter by home name substring
roomstringFilter by room name substring
typestringFilter by device type (light, switch, climate, lock, alarm, fan, blind, valve, speaker, motion, contact, temperature, outlet, light_sensor, doorbell, button)
namestringFilter by accessory name substring

Example with filters:

bash
curl "https://api.homecast.cloud/rest/state?type=light&room=bedroom" \
  -H "Authorization: Bearer hc_your_token"

Response

The response is a nested dictionary keyed by slug keys: home_key → room_key → accessory_key → properties.

json
{
  "my_home_a1b2": {
    "living_room_c3d4": {
      "floor_lamp_e5f6": {
        "type": "light",
        "on": true,
        "brightness": 75,
        "color_temp": 366,
        "_settable": ["on", "brightness", "color_temp"],
        "name": "my_home_a1b2.living_room_c3d4.floor_lamp_e5f6"
      },
      "thermostat_g7h8": {
        "type": "climate",
        "current_temp": 21.5,
        "heat_target": 22.0,
        "active": true,
        "_settable": ["heat_target", "active"],
        "name": "my_home_a1b2.living_room_c3d4.thermostat_g7h8"
      }
    },
    "_scenes": ["Good Morning", "Good Night", "Leave Home"]
  },
  "_homes": {
    "my_home_a1b2": "HOME-UUID-HERE"
  },
  "_meta": {
    "fetched_at": "2026-04-05T10:30:00+00:00",
    "message": "Found 15 accessories across 1 home"
  }
}

Slug keys are generated from the name + last 4 chars of UUID: living_room_c3d4. Use these keys with POST /rest/state and POST /rest/scene.

_settable lists which properties you can write for that accessory.

_scenes lists available scene names per home (use with POST /rest/scene).

Service groups (light groups, multi-switches) appear with "group": true and an "accessories" dict containing member states.

POST /rest/state

Control devices. Send a nested dict of home → room → accessory → settings.

bash
curl -X POST https://api.homecast.cloud/rest/state \
  -H "Authorization: Bearer hc_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "my_home_a1b2": {
      "living_room_c3d4": {
        "floor_lamp_e5f6": {
          "on": true,
          "brightness": 80
        }
      }
    }
  }'

Use the slug keys from GET /rest/state. You can update multiple accessories across multiple homes in a single request.

Settable properties

PropertyTypeDescription
onbooleanPower state
brightnessintegerBrightness 0–100
hueintegerColor hue 0–360
saturationintegerColor saturation 0–100
color_tempintegerColor temperature in mireds (140–500)
activebooleanActive state (climate, air purifiers)
heat_targetfloatHeating target temperature
cool_targetfloatCooling target temperature
hvac_modestringauto, heat, or cool
lock_targetbooleantrue to lock, false to unlock
alarm_targetstringhome, away, night, or off
speedintegerFan speed 0–100
volumeintegerSpeaker volume 0–100
mutebooleanSpeaker mute
targetintegerTarget position 0–100 (blinds, garage doors)

Response

json
{
  "updated": 1,
  "failed": 0,
  "changes": ["my_home_a1b2/living_room_c3d4/floor_lamp_e5f6: on=true, brightness=80"],
  "errors": [],
  "message": "Updated 1 accessory"
}

POST /rest/scene

Execute a HomeKit scene by name.

bash
curl -X POST https://api.homecast.cloud/rest/scene \
  -H "Authorization: Bearer hc_your_token" \
  -H "Content-Type: application/json" \
  -d '{"home": "my_home_a1b2", "name": "Good Night"}'

Request body

FieldTypeRequiredDescription
homestringYesHome slug key (from _homes in state response)
namestringYesScene name (from _scenes in state response)

Response

json
{ "success": true }

GET /rest/homes

List all homes accessible to the authenticated user.

bash
curl https://api.homecast.cloud/rest/homes \
  -H "Authorization: Bearer hc_your_token"

Response

json
[
  {
    "id": "HOME-UUID",
    "name": "My Home",
    "key": "my_home_a1b2",
    "connected": true
  }
]

GET /rest/accessories

List accessories with optional filters.

bash
curl "https://api.homecast.cloud/rest/accessories?home=HOME_ID&room=ROOM_ID" \
  -H "Authorization: Bearer hc_your_token"

Query parameters

ParameterTypeDescription
homestringHome UUID to filter by
roomstringRoom UUID to filter by
typestringAccessory type to filter by
namestringAccessory name substring to filter by

Response

Returns the raw accessory list from HomeKit with full service/characteristic details.

GET /rest/accessories/:id

Get a single accessory by UUID.

bash
curl https://api.homecast.cloud/rest/accessories/ACC-UUID \
  -H "Authorization: Bearer hc_your_token"

GET /rest/rooms

List rooms in a home.

bash
curl "https://api.homecast.cloud/rest/rooms?home=HOME_ID" \
  -H "Authorization: Bearer hc_your_token"

GET /rest/scenes

List scenes in a home.

bash
curl "https://api.homecast.cloud/rest/scenes?home=HOME_ID" \
  -H "Authorization: Bearer hc_your_token"

POST /rest/scenes/:id/execute

Execute a scene by UUID (alternative to POST /rest/scene).

bash
curl -X POST https://api.homecast.cloud/rest/scenes/SCENE-UUID/execute \
  -H "Authorization: Bearer hc_your_token"

Response

json
{ "success": true }

Background endpoints

Manage dashboard background images (Cloud edition only).

GET /rest/background/presets

List available preset background images.

bash
curl https://api.homecast.cloud/rest/background/presets \
  -H "Authorization: Bearer hc_your_token"

POST /rest/background

Upload a custom background image. Content-Type: multipart/form-data

bash
curl -X POST https://api.homecast.cloud/rest/background \
  -H "Authorization: Bearer hc_your_token" \
  -F "file=@background.jpg"

DELETE /rest/background

Delete a background image. Pass filename as a query parameter.

bash
curl -X DELETE "https://api.homecast.cloud/rest/background?filename=background.jpg" \
  -H "Authorization: Bearer hc_your_token"

Error responses

All REST errors return JSON with an error field:

json
{ "error": "Scene 'Good Night' not found in home 'My Home'" }
StatusMeaning
401Authentication required or token invalid
400Invalid request body
404Unknown endpoint
500Server error

See API Errors for common errors and troubleshooting.