Gizmos Management API v1 - Request Examples
============================================

Replace PANEL and OWNER_ROUTE with your installation values.

1. VALIDATE
-----------
POST https://PANEL/api/OWNER_ROUTE/tivimate/management.php
Content-Type: application/json

{
  "action": "validate",
  "code": "ABCD-EFGH",
  "app": "tivimate",
  "version": "533",
  "device_id": "installation-generated-random-id"
}

Decoded signed payload example:
{
  "success": true,
  "action": "validate",
  "transaction": "<short-lived-secret>",
  "expires_in": 600,
  "profile": {
    "name": "Living Room",
    "playlist_count": 2
  },
  "already_activated": false,
  "server_time": 1780000000
}

2. PROVISION
------------
POST same endpoint

{
  "action": "provision",
  "transaction": "<short-lived-secret>"
}

Decoded signed payload example:
{
  "success": true,
  "action": "provision",
  "encryption": "AES-256-GCM-SHA256-TOKEN",
  "encrypted_profile": "<iv>.<tag>.<ciphertext>",
  "expires_at": "2026-08-19 19:30:00",
  "server_time": 1780000005
}

The decrypted profile contains only Gizmos localhost routing plus credentials:
{
  "version": 1,
  "profile_name": "Living Room",
  "playlist_count": 2,
  "playlists": [
    {
      "name": "Main TV",
      "type": "xtream",
      "portal_key": "p0123456789abcdef0123",
      "local_url": "http://127.0.0.1:49183/g/p0123456789abcdef0123",
      "username": "...",
      "password": "..."
    }
  ]
}

3. COMPLETE SUCCESS
-------------------
{
  "action": "complete",
  "transaction": "<short-lived-secret>",
  "success": true
}

Only this step consumes a new activation.

4. COMPLETE FAILURE
-------------------
{
  "action": "complete",
  "transaction": "<short-lived-secret>",
  "success": false,
  "error_code": "playlist_import_failed"
}

Failure does not consume an activation.
