Skip to content

Pair a display with a pairing code

Use this guide when you build a TV or player app, or a console that adds devices, and want to pair a display with a workspace through the API. The display shows a 6-digit code, a user claims it, and the display receives its device token. For every field and error, see the Provisioning API.

If you use the PlayTelly launcher, you don't call these routes for the display: the launcher shows the 6-digit code, and a user claims it (step 2).

Before you begin

  • You have a user access token for someone with workspace:devices:create in the workspace. See Authentication.
  • You know the workspace ID (<WORKSPACE_ID>). See Find your workspace ID.
  • The display can reach https://<API_HOST>. The display's own calls need no login. The API has five device routes under /api/v1/devices; this guide uses the three for pairing and presence (generate-code, check-claim, heartbeat-public). The other two, /devices/{deviceId}/channels/groups and /devices/{deviceId}/channels/categories, load the channels of a display in playout mode. See Provisioning API: Authentication and permissions.

Steps

  1. On the display, ask for a pairing code:

    curl -X POST "https://<API_HOST>/api/v1/devices/generate-code"
    

    You get 201 Created:

    {
      "provisioningId": "0c7f3e2a-5b1d-4e8f-a9c6-2d4b8e1f7a35",
      "code": "483921",
      "expiresAt": "2026-11-16T09:10:00Z"
    }
    

    Show code on screen and keep provisioningId. The code is valid for 10 minutes.

  2. In your console, claim the code for the workspace, as the signed-in user:

    curl -X POST "https://<API_HOST>/api/v1/displays/<WORKSPACE_ID>/claim-code" \
      -H "Authorization: Bearer <ACCESS_TOKEN>" \
      -H "Content-Type: application/json" \
      -d '{"code": "483921", "name": "Lobby screen A", "mode": "tellyboard"}'
    

    mode is tellyboard for signage (default) or playout for a linear-TV player. Add "spaceId": "<SPACE_ID>" (the ID of a space) to place the device in a room or other space of your organization at the same time.

    You get 201 Created:

    { "id": "6f1c2a9e-3b7d-4c0e-9a51-2d8f4e7b1c30", "name": "Lobby screen A", "status": "Online" }
    
  3. On the display, poll the claim every few seconds until it is claimed:

    curl "https://<API_HOST>/api/v1/devices/check-claim/0c7f3e2a-5b1d-4e8f-a9c6-2d4b8e1f7a35"
    

    While nobody has claimed it you get {"status": "pending"}. Once claimed:

    {
      "status": "claimed",
      "deviceId": "6f1c2a9e-3b7d-4c0e-9a51-2d8f4e7b1c30",
      "deviceToken": "<DEVICE_TOKEN>",
      "deviceName": "Lobby screen A",
      "appMode": "tellyboard",
      "workspaceId": "b3e1f0d4-8a2c-4f6e-9d17-5c0a3e9b2f48"
    }
    

    Store deviceId and deviceToken on the display. The token is valid for 365 days.

  4. On the display, send a heartbeat so the device shows as online. The server sets no interval: it marks a device Offline when it hasn't heard from it for 5 minutes, and resyncs the device's content when a heartbeat arrives after a gap of more than 60 seconds. Send one every 30 seconds:

    curl -X POST "https://<API_HOST>/api/v1/devices/heartbeat-public" \
      -H "Content-Type: application/json" \
      -d '{"deviceId": "6f1c2a9e-3b7d-4c0e-9a51-2d8f4e7b1c30"}'
    

    You get {"status": "ok", "workspaceId": "b3e1f0d4-8a2c-4f6e-9d17-5c0a3e9b2f48"}, plus operatingHours when the device's content has opening hours.

Verify

Read the device as the user:

curl "https://<API_HOST>/api/v1/displays/<WORKSPACE_ID>/6f1c2a9e-3b7d-4c0e-9a51-2d8f4e7b1c30" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

The response is the device, with "status": "Online" while heartbeats arrive.

Troubleshooting

Symptom Cause Fix
check-claim returns 410 with {"status": "expired"} The code is older than 10 minutes. Generate a new code (step 1).
claim-code returns 404 with {"error": "Code not found"} The code was typed wrong. Check the code on screen.
claim-code returns 409 Code already claimed Someone already paired this code. Generate a new code.
claim-code returns 400 spaceId is not a space of this organization spaceId isn't a space of your organization. Use the ID of a space, not a floor or building.
claim-code returns 403 The user lacks workspace:devices:create. Ask an organization admin for the permission.
The device stays Offline No heartbeat in the last 5 minutes. Check the display sends step 4 and can reach the API.

Next steps

  • Re-pair a device that was reset: POST /api/v1/displays/<WORKSPACE_ID>/relink with a new code and the device ID ({"code": "771204", "deviceId": "<DEVICE_ID>"}). Needs workspace:devices:edit. See "Relink a device with a new code" (relinkDevice) under Provisioning API: Endpoints.
  • Play content on it: upload a file, put it in a playlist and send the playlist with POST /api/v1/displays/<WORKSPACE_ID>/<DEVICE_ID>/play. See Play uploaded media on a display with the API.