{
 "openapi": "3.1.0",
 "info": {
  "title": "Universal Digital Display API",
  "version": "1.0.0-w0.4",
  "description": "Versioned control-plane API (SRS API-01). Tenant-scoped routes need X-Tenant-Id; every error is RFC 9457 problem+json; ids are type-prefixed UUIDv7s (ADR-019). Kept in sync with the Laravel routes by services/api/tests/Feature/V1/ContractTest.php. Rate limits (API-04): per person (600/min) and per tenant (3000/min) on /v1, per key (120/min) and per tenant (1200/min) on /push/v1; responses carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (and X-RateLimit-*), and a 429 carries Retry-After."
 },
 "servers": [
  {
   "url": "/api/v1"
  }
 ],
 "security": [
  {
   "keycloak": []
  }
 ],
 "tags": [
  {
   "name": "identity"
  },
  {
   "name": "sites"
  },
  {
   "name": "zones"
  },
  {
   "name": "screens"
  },
  {
   "name": "devices"
  },
  {
   "name": "audit"
  },
  {
   "name": "content"
  },
  {
   "name": "releases"
  },
  {
   "name": "data",
   "description": "Data sources for live widgets (W2.6)"
  },
  {
   "name": "rules",
   "description": "Rules over live data and the alerts they raise (W2.7)"
  },
  {
   "name": "fleet",
   "description": "Fleet monitoring: health, offline detection, incidents, groups (W3.1)"
  },
  {
   "name": "accounts",
   "description": "People and access: members, invitations, trials (W3.4)"
  },
  {
   "name": "platform",
   "description": "Platform console: tenants, plans, licences, flags, kill switch (W3.5)"
  },
  {
   "name": "emergency",
   "description": "Emergency broadcasts and pre-approved alert templates (W4.1, ADR-056)"
  },
  {
   "name": "reports",
   "description": "Playback reports: proof of play, uptime, playback errors (W5.2)"
  },
  {
   "name": "integrations",
   "description": "W5.15: the event catalog, the event feed and the security log export (API-05, API-06, SEC-17)"
  }
 ],
 "paths": {
  "/me": {
   "get": {
    "operationId": "getMe",
    "tags": [
     "identity"
    ],
    "summary": "The caller and their tenant memberships (no X-Tenant-Id)",
    "responses": {
     "200": {
      "description": "You",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Me"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     }
    }
   }
  },
  "/me/preferences": {
   "put": {
    "operationId": "updatePreferences",
    "tags": [
     "identity"
    ],
    "summary": "Your time zone and date format (W3.9a, UX-04); null: the browser's own",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "timezone",
         "locale"
        ],
        "properties": {
         "timezone": {
          "type": [
           "string",
           "null"
          ]
         },
         "locale": {
          "type": [
           "string",
           "null"
          ],
          "enum": [
           "en-IN",
           "en-US",
           "en-GB",
           "hi-IN",
           null
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Saved",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Preferences"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/sites": {
   "get": {
    "operationId": "listSites",
    "tags": [
     "sites"
    ],
    "summary": "List sites",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Site"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createSite",
    "tags": [
     "sites"
    ],
    "summary": "Create a site",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SiteCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Site"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/sites/{site}": {
   "get": {
    "operationId": "getSite",
    "tags": [
     "sites"
    ],
    "summary": "Get a site",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Site"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateSite",
    "tags": [
     "sites"
    ],
    "summary": "Change a site",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SiteUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Updated",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Site"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "deleteSite",
    "tags": [
     "sites"
    ],
    "summary": "Delete a site",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "parameters": [
    {
     "name": "site",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ]
  },
  "/zones": {
   "get": {
    "operationId": "listZones",
    "tags": [
     "zones"
    ],
    "summary": "List zones",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Zone"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createZone",
    "tags": [
     "zones"
    ],
    "summary": "Create a zone",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ZoneCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Zone"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/zones/{zone}": {
   "get": {
    "operationId": "getZone",
    "tags": [
     "zones"
    ],
    "summary": "Get a zone",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Zone"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateZone",
    "tags": [
     "zones"
    ],
    "summary": "Change a zone",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ZoneUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Updated",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Zone"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "deleteZone",
    "tags": [
     "zones"
    ],
    "summary": "Delete a zone",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "parameters": [
    {
     "name": "zone",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ]
  },
  "/screens": {
   "get": {
    "operationId": "listScreens",
    "tags": [
     "screens"
    ],
    "summary": "List screens",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     {
      "name": "zone_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Screen"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createScreen",
    "tags": [
     "screens"
    ],
    "summary": "Create a screen",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ScreenCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Screen"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screens/{screen}": {
   "get": {
    "operationId": "getScreen",
    "tags": [
     "screens"
    ],
    "summary": "Get a screen",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Screen"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateScreen",
    "tags": [
     "screens"
    ],
    "summary": "Change a screen",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ScreenPatch"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Updated",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Screen"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "deleteScreen",
    "tags": [
     "screens"
    ],
    "summary": "Delete a screen",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "parameters": [
    {
     "name": "screen",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ]
  },
  "/devices": {
   "get": {
    "operationId": "listDevices",
    "tags": [
     "devices"
    ],
    "summary": "List devices",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "screen_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "group_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "connectivity",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "online",
        "offline",
        "never"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Device"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/devices/{device}": {
   "get": {
    "operationId": "getDevice",
    "tags": [
     "devices"
    ],
    "summary": "Get a device",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Device"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ]
  },
  "/devices/{device}/commands": {
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "listDeviceCommands",
    "tags": [
     "devices"
    ],
    "summary": "The device's newest commands, newest first (W1.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 20
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Commands",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/DeviceCommand"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "post": {
    "operationId": "sendDeviceCommand",
    "tags": [
     "devices"
    ],
    "summary": "Send a signed remote action to one device: REBOOT, REFRESH_CONTENT or CLEAR_CACHE (FLT-04); expires after 15 minutes",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "command": {
          "enum": [
           "REBOOT",
           "REFRESH_CONTENT",
           "CLEAR_CACHE"
          ]
         }
        },
        "required": [
         "command"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Signed and queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DeviceCommand"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/audit-events": {
   "get": {
    "operationId": "listAuditEvents",
    "tags": [
     "audit"
    ],
    "summary": "The tenant's audit log, oldest first (needs audit.read)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "action",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/AuditEvent"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/audit-events/verify": {
   "get": {
    "operationId": "verifyAuditChain",
    "tags": [
     "audit"
    ],
    "summary": "Re-compute the tenant's hash chain",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AuditVerification"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/audit-events/export": {
   "get": {
    "operationId": "exportAuditEvents",
    "tags": [
     "audit"
    ],
    "summary": "Export the tenant's audit log as NDJSON (SEC-07, packages/audit-schema v1), up to 5000 events a page; each page is audited",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "from_seq",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Events in seq order; UDD-Next-Seq when there are more",
      "headers": {
       "UDD-Next-Seq": {
        "description": "Where the next page starts",
        "schema": {
         "type": "string"
        }
       },
       "UDD-Events": {
        "description": "Events in this page",
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/x-ndjson": {
        "schema": {
         "type": "string",
         "description": "One JSON object per line"
        }
       }
      }
     },
     "422": {
      "description": "Invalid"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/assets": {
   "get": {
    "operationId": "listAssets",
    "tags": [
     "content"
    ],
    "summary": "List media assets",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "image",
        "video",
        "font"
       ]
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "maxLength": 100
      },
      "description": "W2.4: part of the name (case-insensitive)"
     },
     {
      "name": "folder_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "W2.4: a folder id, or none for files in no folder"
     },
     {
      "name": "tag",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "W2.4: only files with this tag (repeat as tag[] for all of several)"
     },
     {
      "name": "bin",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "0",
        "1",
        "true",
        "false"
       ]
      },
      "description": "W5.5: 1 lists the bin (deleted files not yet purged) instead of the library"
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Asset"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "uploadAsset",
    "tags": [
     "content"
    ],
    "summary": "Upload a media file (PNG, JPEG, WebP, GIF, MP4, MP3, AAC, PDF, WOFF2); sniffed, size-limited (kind and plan) and malware-scanned",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "name": {
          "type": "string",
          "maxLength": 200
         },
         "folder_id": {
          "type": "string",
          "description": "W2.4: put it in this folder"
         },
         "tags": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "maxItems": 20,
          "description": "W2.4: tags (multipart tags[])"
         }
        },
        "required": [
         "file"
        ]
       }
      }
     }
    },
    "responses": {
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "200": {
      "description": "These bytes are already an asset of this tenant",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/assets/uploads": {
   "post": {
    "operationId": "startAssetUpload",
    "tags": [
     "content"
    ],
    "summary": "W3.10: start an upload in chunks (size checked against the plan's limit)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 500
         },
         "size": {
          "type": "integer",
          "minimum": 1
         },
         "folder_id": {
          "type": [
           "string",
           "null"
          ]
         },
         "tags": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        },
        "required": [
         "name",
         "size"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "201": {
      "description": "The upload",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AssetUpload"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/assets/uploads/{upload}": {
   "get": {
    "operationId": "getAssetUpload",
    "tags": [
     "content"
    ],
    "summary": "W3.10: how many bytes have arrived (to resume)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "upload",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "200": {
      "description": "The upload",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AssetUpload"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "putAssetUploadChunk",
    "tags": [
     "content"
    ],
    "summary": "W3.10: the next bytes, from ?offset= (409 with the offset to go on from)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "upload",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "offset",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/octet-stream": {
       "schema": {
        "type": "string",
        "format": "binary"
       }
      }
     }
    },
    "responses": {
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "200": {
      "description": "The upload",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AssetUpload"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "description": "The upload continues from another byte (offset), or lost its data",
      "content": {
       "application/problem+json": {
        "schema": {
         "type": "object",
         "properties": {
          "offset": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "cancelAssetUpload",
    "tags": [
     "content"
    ],
    "summary": "W3.10: give up an upload",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "upload",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "204": {
      "description": "Gone"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/assets/uploads/{upload}/complete": {
   "post": {
    "operationId": "completeAssetUpload",
    "tags": [
     "content"
    ],
    "summary": "W3.10: all bytes there: the same checks as a single upload, then the asset",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "upload",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "200": {
      "description": "The same bytes were already in the library",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         }
        }
       }
      }
     },
     "201": {
      "description": "The asset",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "503": {
      "description": "Scanner or storage unavailable; the bytes are kept for another try"
     }
    }
   }
  },
  "/assets/{asset}": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getAsset",
    "tags": [
     "content"
    ],
    "summary": "One media asset",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateAsset",
    "tags": [
     "content"
    ],
    "summary": "Rename, move to a folder (null: none), set tags (W2.4); the bytes never change",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "folder_id": {
          "type": [
           "string",
           "null"
          ]
         },
         "tags": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "maxItems": 20
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The asset",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "deleteAsset",
    "tags": [
     "content"
    ],
    "summary": "Put a file in the bin (W5.5): out of the library for 30 days, restorable, then its bytes are deleted. Refused (409 asset-in-use, with usage) while a layout being edited, a playlist or a release still on uses it.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "200": {
      "description": "The asset",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/assets/{asset}/content": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getAssetContent",
    "tags": [
     "content"
    ],
    "summary": "The stored bytes (for previews), or a ready rendition's (W2.3 `rendition`); served with nosniff and a sandbox CSP",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "rendition",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^[a-z0-9][a-z0-9.-]{0,31}$",
       "default": "original"
      },
      "description": "original (default), or a ready rendition such as thumb"
     }
    ],
    "responses": {
     "200": {
      "description": "The file; ETag and X-Content-SHA256 carry its SHA-256",
      "content": {
       "application/octet-stream": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      },
      "headers": {
       "ETag": {
        "schema": {
         "type": "string"
        }
       },
       "X-Content-SHA256": {
        "schema": {
         "type": "string",
         "pattern": "^[0-9a-f]{64}$"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "410": {
      "description": "W5.5: the file was deleted for good (asset-purged)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     }
    }
   }
  },
  "/layouts": {
   "get": {
    "operationId": "listLayouts",
    "tags": [
     "content"
    ],
    "summary": "List layout versions (without their scenes)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "draft_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      },
      "description": "Only the versions saved from this draft"
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Layout"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createLayout",
    "tags": [
     "content"
    ],
    "summary": "Create an immutable layout version from a v1 scene graph",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/LayoutCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Layout"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/layouts/{layout}": {
   "parameters": [
    {
     "name": "layout",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getLayout",
    "tags": [
     "content"
    ],
    "summary": "Get a layout version with its scene",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Layout"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/layout-drafts": {
   "get": {
    "operationId": "listLayoutDrafts",
    "tags": [
     "content"
    ],
    "summary": "Layouts being edited, most recently saved first (the newest 200; W2.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/LayoutDraft"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createLayoutDraft",
    "tags": [
     "content"
    ],
    "summary": "Start a layout from a scene or a copy of a layout version (at most 1000 per tenant are being edited at once: 409)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name"
        ],
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "scene": {
          "type": "object",
          "description": "A JSON object; it may be unfinished (packages/scene-schema/schema.v1.json; W5.19: or schema.v1_1.json when it declares \"1.1\")"
         },
         "from_layout_id": {
          "type": [
           "string",
           "null"
          ],
          "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
         },
         "from_template_id": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 80,
          "description": "W5.16: a layout template (platform:<key> or tpl_…), with the brand kit applied"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/LayoutDraftFull"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/layout-drafts/{draft}": {
   "parameters": [
    {
     "name": "draft",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getLayoutDraft",
    "tags": [
     "content"
    ],
    "summary": "A draft with its scene and what stops it from becoming a version",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/LayoutDraftFull"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "saveLayoutDraft",
    "tags": [
     "content"
    ],
    "summary": "Autosave: the whole scene, based on base_revision (409 if someone saved since) (CMS-23)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "base_revision",
         "scene"
        ],
        "properties": {
         "base_revision": {
          "type": "integer",
          "minimum": 1
         },
         "scene": {
          "type": "object",
          "description": "A JSON object; it may be unfinished (packages/scene-schema/schema.v1.json; W5.19: or schema.v1_1.json when it declares \"1.1\")"
         },
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "zone_playlists": {
          "type": "object",
          "maxProperties": 64,
          "additionalProperties": {
           "type": "string",
           "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          },
          "description": "Replaces the draft's zone → playlist links",
          "propertyNames": {
           "pattern": "^[a-z][a-z0-9_-]{0,63}$"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "revision",
            "saved_at",
            "ready",
            "problems",
            "warnings"
           ],
           "properties": {
            "revision": {
             "type": "integer",
             "minimum": 1
            },
            "saved_at": {
             "type": "string",
             "format": "date-time"
            },
            "ready": {
             "type": "boolean",
             "description": "True when Save version would succeed"
            },
            "problems": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "path": {
                "type": "string"
               },
               "rule": {
                "type": "string"
               },
               "message": {
                "type": "string"
               }
              },
              "required": [
               "message"
              ],
              "additionalProperties": false
             }
            },
            "warnings": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "rule": {
                "type": "string"
               },
               "message": {
                "type": "string"
               }
              },
              "required": [
               "rule",
               "message"
              ],
              "additionalProperties": false
             }
            }
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archiveLayoutDraft",
    "tags": [
     "content"
    ],
    "summary": "Archive (its versions stay)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/layout-drafts/{draft}/revisions": {
   "parameters": [
    {
     "name": "draft",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "listLayoutDraftRevisions",
    "tags": [
     "content"
    ],
    "summary": "Recovery points, newest first (one per minute of editing, at most 200)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "revision",
             "saved_by",
             "first_saved_at",
             "saved_at",
             "size"
            ],
            "properties": {
             "revision": {
              "type": "integer",
              "minimum": 1
             },
             "saved_by": {
              "type": [
               "string",
               "null"
              ],
              "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
             },
             "first_saved_at": {
              "type": "string",
              "format": "date-time"
             },
             "saved_at": {
              "type": "string",
              "format": "date-time"
             },
             "size": {
              "type": "integer"
             }
            }
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/layout-drafts/{draft}/revisions/{revision}": {
   "parameters": [
    {
     "name": "draft",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    },
    {
     "name": "revision",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^[0-9]{1,9}$"
     }
    }
   ],
   "get": {
    "operationId": "getLayoutDraftRevision",
    "tags": [
     "content"
    ],
    "summary": "One recovery point's scene",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "revision",
            "saved_at",
            "scene"
           ],
           "properties": {
            "revision": {
             "type": "integer"
            },
            "saved_at": {
             "type": "string",
             "format": "date-time"
            },
            "scene": {
             "type": "object"
            }
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/layout-drafts/{draft}/versions": {
   "parameters": [
    {
     "name": "draft",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "saveLayoutVersion",
    "tags": [
     "content"
    ],
    "summary": "Save version: the draft becomes the next immutable, numbered layout version (CMS-07)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "base_revision"
        ],
        "properties": {
         "base_revision": {
          "type": "integer",
          "minimum": 1
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Layout"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases": {
   "get": {
    "operationId": "listReleases",
    "tags": [
     "releases"
    ],
    "summary": "List releases (newest sequence last)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "A page",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Release"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ],
           "description": "Pass as ?cursor= to get the next page; null on the last page."
          }
         },
         "required": [
          "data",
          "next_cursor"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "publishRelease",
    "tags": [
     "releases"
    ],
    "summary": "Build, sign and store a release (REL-01, REL-02)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReleaseCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Signed and stored",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Release"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases/check": {
   "post": {
    "operationId": "checkRelease",
    "tags": [
     "releases"
    ],
    "summary": "W3.10 (CAP-04): what publishing this would mean for each target screen, without publishing",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReleaseCreate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Per screen",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseCompatibility"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/releases/{release}": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getRelease",
    "tags": [
     "releases"
    ],
    "summary": "Get a release and its manifest",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Found",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Release"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/releases/{release}/manifest": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getReleaseManifest",
    "tags": [
     "releases"
    ],
    "summary": "The exact signed manifest bytes (RFC 8785 canonical JSON)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The signed manifest; ETag and X-Content-SHA256 carry its SHA-256",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "description": "packages/manifest-schema/schema.v1.json"
        }
       }
      },
      "headers": {
       "ETag": {
        "schema": {
         "type": "string"
        }
       },
       "X-Content-SHA256": {
        "schema": {
         "type": "string",
         "pattern": "^[0-9a-f]{64}$"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/screens/{screen}/enrollment-codes": {
   "parameters": [
    {
     "name": "screen",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "createEnrollmentCode",
    "tags": [
     "screens"
    ],
    "summary": "One-time code for a player to enrol as this screen (60 minutes, single use)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EnrollmentCode"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases/{release}/rollback": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "rollbackRelease",
    "tags": [
     "releases"
    ],
    "summary": "Re-sign an earlier release's content as a new ROLLBACK release with the next sequence (REL-01, SAT-04)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "expires_in_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 365
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "201": {
      "description": "Signed and stored",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Release"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      },
      "headers": {
       "Idempotent-Replayed": {
        "description": "Present (true) when this is a replay of an earlier response",
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases/{release}/revoke": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "revokeRelease",
    "tags": [
     "releases"
    ],
    "summary": "Withdraw a release from every screen before it expires; signs the next revocation list (REL-08)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 200
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "Revoked",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Release"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/revocation-list": {
   "get": {
    "operationId": "getRevocationList",
    "tags": [
     "releases"
    ],
    "summary": "The newest signed revocation list (exact bytes); 204 when nothing was ever revoked",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "packages/manifest-schema/revocation-list.schema.v1.json",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "description": "packages/manifest-schema/revocation-list.schema.v1.json"
        }
       }
      },
      "headers": {
       "ETag": {
        "schema": {
         "type": "string"
        }
       },
       "X-Content-SHA256": {
        "schema": {
         "type": "string",
         "pattern": "^[0-9a-f]{64}$"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "204": {
      "description": "No release has been revoked in this tenant"
     }
    }
   }
  },
  "/playlists": {
   "get": {
    "operationId": "listPlaylists",
    "tags": [
     "content"
    ],
    "summary": "Playlists of images, videos, PDFs and sound (W5.18: a PDF plays as its pages; W5.19: sound plays on players from 1.22.0), most recently saved first (newest 500; W2.2)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Playlist"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createPlaylist",
    "tags": [
     "content"
    ],
    "summary": "Create a playlist (CMS-06)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "items": {
          "type": "array",
          "maxItems": 200,
          "items": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "assetId": {
             "type": "string",
             "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "durationMs": {
             "type": "integer",
             "minimum": 1000,
             "maximum": 86400000
            },
            "fit": {
             "enum": [
              "CONTAIN",
              "COVER",
              "FILL"
             ]
            },
            "transition": {
             "enum": [
              "NONE",
              "FADE",
              "SLIDE_LEFT",
              "SLIDE_UP"
             ]
            },
            "playToEnd": {
             "type": "boolean"
            },
            "sound": {
             "type": "boolean",
             "description": "W3.9c: a video plays with its sound (default false: muted)."
            }
           },
           "required": [
            "assetId"
           ]
          }
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Playlist"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/playlists/{playlist}": {
   "parameters": [
    {
     "name": "playlist",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getPlaylist",
    "tags": [
     "content"
    ],
    "summary": "A playlist and the layouts that play it",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Playlist"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "savePlaylist",
    "tags": [
     "content"
    ],
    "summary": "Replace the items (and optionally the name), based on base_revision (409 if stale)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "base_revision": {
          "type": "integer",
          "minimum": 1
         },
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "items": {
          "type": "array",
          "maxItems": 200,
          "items": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "assetId": {
             "type": "string",
             "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "durationMs": {
             "type": "integer",
             "minimum": 1000,
             "maximum": 86400000
            },
            "fit": {
             "enum": [
              "CONTAIN",
              "COVER",
              "FILL"
             ]
            },
            "transition": {
             "enum": [
              "NONE",
              "FADE",
              "SLIDE_LEFT",
              "SLIDE_UP"
             ]
            },
            "playToEnd": {
             "type": "boolean"
            },
            "sound": {
             "type": "boolean",
             "description": "W3.9c: a video plays with its sound (default false: muted)."
            }
           },
           "required": [
            "assetId"
           ]
          }
         }
        },
        "required": [
         "base_revision",
         "items"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Playlist"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archivePlaylist",
    "tags": [
     "content"
    ],
    "summary": "Archive (saved layout versions keep their copy) W5.5: refused (409 playlist-in-use, with usage.layouts) while a layout being edited plays it.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/playlists/{playlist}/slides": {
   "parameters": [
    {
     "name": "playlist",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "playlistSlides",
    "tags": [
     "content"
    ],
    "summary": "The slides a zone of this size gets from the playlist (scene schema v1 slides; W5.19: AUDIO slides for sound, scene 1.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "zone_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^[a-z][a-z0-9_-]{0,63}$"
      }
     },
     {
      "name": "width",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 7680
      }
     },
     {
      "name": "height",
      "in": "query",
      "required": true,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 7680
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object"
           }
          },
          "problems": {
           "type": "array",
           "items": {
            "type": "object"
           },
           "description": "W5.17: what could not be resolved (an archived inner playlist, too many files)"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/release-requests": {
   "get": {
    "operationId": "listReleaseRequests",
    "tags": [
     "releases"
    ],
    "summary": "Release requests, newest first (site-limited people see their own; W2.2)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "in_review",
        "approved",
        "rejected",
        "withdrawn"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/ReleaseRequest"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "submitReleaseRequest",
    "tags": [
     "releases"
    ],
    "summary": "Submit a release for approval (CMS-10): checked now, signed when approved",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReleaseRequestCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Submitted",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseRequest"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/release-requests/{request}": {
   "parameters": [
    {
     "name": "request",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getReleaseRequest",
    "tags": [
     "releases"
    ],
    "summary": "One release request",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseRequest"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/release-requests/{releaseRequest}/approve": {
   "parameters": [
    {
     "name": "releaseRequest",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "approveReleaseRequest",
    "tags": [
     "releases"
    ],
    "summary": "Approve: the release is built, signed and stored now (release.publish)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseRequest"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "note": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         }
        },
        "required": []
       }
      }
     }
    }
   }
  },
  "/release-requests/{releaseRequest}/reject": {
   "parameters": [
    {
     "name": "releaseRequest",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "rejectReleaseRequest",
    "tags": [
     "releases"
    ],
    "summary": "Reject with a reason (release.publish)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseRequest"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "note": {
          "type": "string",
          "maxLength": 500
         }
        },
        "required": [
         "note"
        ]
       }
      }
     }
    }
   }
  },
  "/release-requests/{releaseRequest}/withdraw": {
   "parameters": [
    {
     "name": "releaseRequest",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "withdrawReleaseRequest",
    "tags": [
     "releases"
    ],
    "summary": "The submitter takes it back while it waits",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseRequest"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/playlists/{playlist}/update-screens": {
   "parameters": [
    {
     "name": "playlist",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "playlistUpdateScreens",
    "tags": [
     "content"
    ],
    "summary": "Put the playlist as it is now on every screen that plays it (new layout versions; releases published, or submitted for approval without release.publish)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "dry_run": {
          "type": "boolean",
          "description": "Show what would change; change nothing"
         },
         "note": {
          "type": [
           "string",
           "null"
          ],
          "minLength": 1,
          "maxLength": 500,
          "description": "Note on approval requests (mode request)"
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Dry run",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ScreenUpdate"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "201": {
      "description": "Done",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ScreenUpdate"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/assets/{asset}/renditions/retry": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "retryAssetRenditions",
    "tags": [
     "content"
    ],
    "summary": "Queue failed renditions again (and any the plan adds); the media worker makes them (W2.3)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The asset with its renditions",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/assets/{asset}/usage": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "assetUsage",
    "tags": [
     "content"
    ],
    "summary": "Where a file is used (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Usage",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "layouts": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               }
              },
              "required": [
               "id",
               "name"
              ],
              "additionalProperties": false
             },
             "description": "Layouts being edited (drafts) that show it"
            },
            "playlists": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               }
              },
              "required": [
               "id",
               "name"
              ],
              "additionalProperties": false
             }
            },
            "layout_versions": {
             "type": "integer",
             "description": "Saved versions that show it"
            },
            "live_releases": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "sequence": {
                "type": "integer"
               }
              },
              "required": [
               "id",
               "sequence"
              ],
              "additionalProperties": false
             },
             "description": "Releases not expired or revoked that carry it"
            },
            "campaigns": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               }
              },
              "required": [
               "id",
               "name"
              ],
              "additionalProperties": false
             },
             "description": "W5.6: campaigns not ended whose layout shows it"
            },
            "pdfs": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               }
              },
              "required": [
               "id",
               "name"
              ]
             },
             "description": "W5.18: PDFs (in the library or the bin) that show this picture as one of their pages"
            }
           },
           "required": [
            "layouts",
            "playlists",
            "layout_versions",
            "live_releases"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/assets/organize": {
   "post": {
    "operationId": "organizeAssets",
    "tags": [
     "content"
    ],
    "summary": "Several files at once: move to a folder and/or add and remove tags (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "asset_ids": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "minItems": 1,
          "maxItems": 500
         },
         "folder_id": {
          "type": [
           "string",
           "null"
          ]
         },
         "add_tags": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "maxItems": 20
         },
         "remove_tags": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "maxItems": 20
         }
        },
        "required": [
         "asset_ids"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "How many were changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "updated": {
             "type": "integer"
            }
           },
           "required": [
            "updated"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/asset-tags": {
   "get": {
    "operationId": "assetTags",
    "tags": [
     "content"
    ],
    "summary": "Tags in use, with how many files have each (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Tags",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "tag": {
              "type": "string"
             },
             "files": {
              "type": "integer"
             }
            },
            "required": [
             "tag",
             "files"
            ],
            "additionalProperties": false
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/asset-folders": {
   "get": {
    "operationId": "listAssetFolders",
    "tags": [
     "content"
    ],
    "summary": "Every folder, with counts (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Folders",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/AssetFolder"
           }
          },
          "meta": {
           "type": "object",
           "properties": {
            "files": {
             "type": "integer"
            },
            "unfiled": {
             "type": "integer"
            },
            "bin": {
             "type": "integer",
             "description": "W5.5: files in the bin"
            },
            "can_share": {
             "type": "boolean"
            },
            "top": {
             "type": "boolean",
             "description": "May add files and folders at the top"
            }
           },
           "required": [
            "files",
            "unfiled",
            "bin",
            "can_share",
            "top"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data",
          "meta"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createAssetFolder",
    "tags": [
     "content"
    ],
    "summary": "New folder (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
         },
         "parent_id": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "required": [
         "name"
        ],
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AssetFolder"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/asset-folders/{folder}": {
   "parameters": [
    {
     "name": "folder",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "operationId": "updateAssetFolder",
    "tags": [
     "content"
    ],
    "summary": "Rename and/or move (parent_id null: to the top) (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
         },
         "parent_id": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "additionalProperties": false
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The folder",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AssetFolder"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "deleteAssetFolder",
    "tags": [
     "content"
    ],
    "summary": "Delete an empty folder (W2.4)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screens/{screen}/schedule": {
   "parameters": [
    {
     "name": "screen",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "screenSchedule",
    "tags": [
     "fleet"
    ],
    "summary": "What a screen plays now and what takes over later, newest first, with each release's signed schedule (W2.5 calendar)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Schedule",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "screen": {
             "$ref": "#/components/schemas/Screen"
            },
            "site": {
             "type": "object",
             "properties": {
              "id": {
               "type": "string"
              },
              "name": {
               "type": "string"
              },
              "timezone": {
               "type": "string"
              }
             },
             "required": [
              "id",
              "name",
              "timezone"
             ],
             "additionalProperties": false
            },
            "releases": {
             "type": "array",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "sequence": {
                "type": "integer"
               },
               "not_before": {
                "type": "string",
                "format": "date-time"
               },
               "expires_at": {
                "type": "string",
                "format": "date-time"
               },
               "scheduled": {
                "type": "boolean",
                "description": "Starts later"
               },
               "targets": {
                "type": [
                 "object",
                 "null"
                ]
               },
               "timezone": {
                "type": "string",
                "description": "The screen's time zone as the release gives it"
               },
               "rules": {
                "type": "array",
                "items": {
                 "type": "object"
                },
                "description": "The signed schedule rules (manifest schedule.rules)"
               },
               "layouts": {
                "type": "array",
                "items": {
                 "type": "object",
                 "properties": {
                  "id": {
                   "type": "string"
                  },
                  "name": {
                   "type": "string"
                  },
                  "version": {
                   "type": [
                    "integer",
                    "null"
                   ]
                  }
                 },
                 "required": [
                  "id",
                  "name",
                  "version"
                 ],
                 "additionalProperties": false
                }
               },
               "hidden": {
                "type": "boolean",
                "description": "Reaches beyond your sites: only when it plays is shown"
               }
              },
              "required": [
               "id",
               "sequence",
               "not_before",
               "expires_at",
               "scheduled",
               "targets",
               "timezone",
               "rules",
               "layouts",
               "hidden"
              ],
              "additionalProperties": false
             }
            }
           },
           "required": [
            "screen",
            "site",
            "releases"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/releases/{release}/payload": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "releasePayload",
    "tags": [
     "releases"
    ],
    "summary": "What POST /releases needs to publish this release again, e.g. with an edited schedule: same targets, exact end, later start kept (W2.5)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Payload",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ReleaseCreate"
          },
          "meta": {
           "type": "object",
           "properties": {
            "newer": {
             "type": "array",
             "description": "Live releases newer than this one on screens it reaches: publishing it again puts it in front of them there",
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "sequence": {
                "type": "integer"
               },
               "screens": {
                "type": "integer"
               }
              },
              "required": [
               "id",
               "sequence",
               "screens"
              ],
              "additionalProperties": false
             }
            }
           },
           "required": [
            "newer"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data",
          "meta"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/data-sources": {
   "get": {
    "operationId": "listDataSources",
    "tags": [
     "data"
    ],
    "summary": "Data sources, by name (W2.6); ?archived=1 lists archived ones",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "archived",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "0",
        "1"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Data sources",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/DataSource"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createDataSource",
    "tags": [
     "data"
    ],
    "summary": "Create a data source (W2.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name",
         "kind"
        ],
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "kind": {
          "enum": [
           "MANUAL",
           "JSON_URL",
           "CSV_URL",
           "RSS",
           "WEBSOCKET",
           "FLEET"
          ]
         },
         "schema": {
          "type": "string",
          "description": "Payload shape name, e.g. line.status.v1 (default manual.v1, json.v1, csv.v1 or rss.v1)."
         },
         "url": {
          "type": "string",
          "maxLength": 2000,
          "description": "Fetched kinds only: a public http(s) address (no private networks, ports 80/443, no redirects). ws:// or wss:// for WEBSOCKET (W2.10)."
         },
         "root": {
          "type": [
           "string",
           "null"
          ],
          "description": "JSON_URL only: the dotted path of the part to use, e.g. data.current."
         },
         "interval_seconds": {
          "type": "integer",
          "minimum": 30,
          "maximum": 86400,
          "description": "Fetched kinds only; default 300."
         },
         "auth_type": {
          "enum": [
           "NONE",
           "API_KEY",
           "BASIC",
           "OAUTH2_CC"
          ],
          "description": "JSON sources only."
         },
         "auth_config": {
          "type": "object"
         },
         "secret": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4000,
          "writeOnly": true,
          "description": "API key, password or client secret; stored encrypted, never returned. Left out on a change: the saved one stays."
         },
         "headers": {
          "type": "object",
          "maxProperties": 10,
          "additionalProperties": {
           "type": "string",
           "maxLength": 500
          }
         },
         "mapping": {
          "type": [
           "object",
           "null"
          ],
          "maxProperties": 50,
          "additionalProperties": {
           "type": "string",
           "maxLength": 300
          }
         },
         "subscribe_message": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4096,
          "description": "WEBSOCKET only (W2.10)."
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The new source",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DataSource"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/data-sources/{source}": {
   "parameters": [
    {
     "name": "source",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getDataSource",
    "tags": [
     "data"
    ],
    "summary": "A data source with its latest values (W2.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The source",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DataSource"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateDataSource",
    "tags": [
     "data"
    ],
    "summary": "Change a data source; a new address is fetched straight away (W2.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
         },
         "schema": {
          "type": "string",
          "description": "Payload shape name, e.g. line.status.v1 (default manual.v1, json.v1, csv.v1 or rss.v1)."
         },
         "url": {
          "type": "string",
          "maxLength": 2000,
          "description": "Fetched kinds only: a public http(s) address (no private networks, ports 80/443, no redirects)."
         },
         "root": {
          "type": [
           "string",
           "null"
          ],
          "description": "JSON_URL only: the dotted path of the part to use, e.g. data.current."
         },
         "interval_seconds": {
          "type": "integer",
          "minimum": 30,
          "maximum": 86400,
          "description": "Fetched kinds only; default 300."
         },
         "enabled": {
          "type": "boolean"
         },
         "auth_type": {
          "enum": [
           "NONE",
           "API_KEY",
           "BASIC",
           "OAUTH2_CC"
          ],
          "description": "JSON sources only."
         },
         "auth_config": {
          "type": "object"
         },
         "secret": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4000,
          "writeOnly": true,
          "description": "API key, password or client secret; stored encrypted, never returned. Left out on a change: the saved one stays."
         },
         "headers": {
          "type": "object",
          "maxProperties": 10,
          "additionalProperties": {
           "type": "string",
           "maxLength": 500
          }
         },
         "mapping": {
          "type": [
           "object",
           "null"
          ],
          "maxProperties": 50,
          "additionalProperties": {
           "type": "string",
           "maxLength": 300
          }
         },
         "subscribe_message": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4096,
          "description": "WEBSOCKET only (W2.10)."
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The source",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DataSource"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archiveDataSource",
    "tags": [
     "data"
    ],
    "summary": "Archive a data source: no longer fetched or offered; screens keep its last values (W2.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/data-sources/{source}/values": {
   "parameters": [
    {
     "name": "source",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "put": {
    "operationId": "putDataSourceValues",
    "tags": [
     "data"
    ],
    "summary": "Typed-in (MANUAL) sources: new values as the next envelope; JSON (merge: true keeps the others) or a CSV file (W2.6, W2.9)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "values"
        ],
        "additionalProperties": false,
        "properties": {
         "values": {
          "type": "object",
          "description": "Envelope values: identifier keys, at most two levels (data envelope schema)."
         },
         "quality": {
          "enum": [
           "GOOD",
           "STALE",
           "BAD",
           "UNKNOWN"
          ]
         },
         "quality_reason": {
          "type": "string",
          "maxLength": 200
         },
         "merge": {
          "type": "boolean",
          "description": "W2.9: keep the values not sent"
         }
        }
       }
      },
      "text/csv": {
       "schema": {
        "type": "string",
        "description": "First line names the columns; values become {columns, rows, count}."
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The source with its new values",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DataSource"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/data-sources/{source}/refresh": {
   "parameters": [
    {
     "name": "source",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "refreshDataSource",
    "tags": [
     "data"
    ],
    "summary": "Fetched sources: fetch again as soon as the data worker is free (W2.6)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DataSource"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "description": "WEBSOCKET sources: connect again now (W2.10)."
   }
  },
  "/rules": {
   "get": {
    "operationId": "listRules",
    "tags": [
     "rules"
    ],
    "summary": "Rules, highest priority first (W2.7); ?archived=1 lists archived ones",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "archived",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "0",
        "1"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Rules",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Rule"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createRule",
    "tags": [
     "rules"
    ],
    "summary": "Create a rule (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name",
         "condition",
         "actions"
        ],
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 200
         },
         "enabled": {
          "type": "boolean"
         },
         "priority": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
         },
         "condition": {
          "type": "object",
          "description": "The scene expression language (scene schema `expression`): AND, OR, NOT, EQ, NE, GT, GTE, LT, LTE, IN, QUALITY, TIME_BETWEEN; at most 6 levels and 50 parts."
         },
         "timezone": {
          "type": "string",
          "description": "For TIME_BETWEEN; default UTC."
         },
         "stale_after_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 86400,
          "description": "Values older than this do not count (default 300)."
         },
         "min_duration_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400,
          "description": "SCH-06: how long the condition must hold (and stop holding) before the rule fires (clears)."
         },
         "cooldown_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 604800,
          "description": "SCH-06: the least time between two firings."
         },
         "actions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "items": {
           "type": "object",
           "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
           "required": [
            "type"
           ],
           "properties": {
            "type": {
             "enum": [
              "SET_VALUES",
              "RAISE_ALERT",
              "OPEN_INCIDENT"
             ]
            },
            "title": {
             "type": "string",
             "maxLength": 200
            }
           }
          }
         },
         "clear_actions": {
          "type": "array",
          "maxItems": 10,
          "items": {
           "type": "object",
           "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
           "required": [
            "type"
           ],
           "properties": {
            "type": {
             "enum": [
              "SET_VALUES",
              "RAISE_ALERT",
              "OPEN_INCIDENT"
             ]
            },
            "title": {
             "type": "string",
             "maxLength": 200
            }
           }
          }
         },
         "offline_safe": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The new rule (version 1)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rule"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/rules/{rule}": {
   "parameters": [
    {
     "name": "rule",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getRule",
    "tags": [
     "rules"
    ],
    "summary": "A rule with its state (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rule",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rule"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateRule",
    "tags": [
     "rules"
    ],
    "summary": "Change a rule; a change to what it does makes a new version (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 200
         },
         "enabled": {
          "type": "boolean"
         },
         "priority": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000
         },
         "condition": {
          "type": "object",
          "description": "The scene expression language (scene schema `expression`): AND, OR, NOT, EQ, NE, GT, GTE, LT, LTE, IN, QUALITY, TIME_BETWEEN; at most 6 levels and 50 parts."
         },
         "timezone": {
          "type": "string",
          "description": "For TIME_BETWEEN; default UTC."
         },
         "stale_after_seconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 86400,
          "description": "Values older than this do not count (default 300)."
         },
         "min_duration_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400,
          "description": "SCH-06: how long the condition must hold (and stop holding) before the rule fires (clears)."
         },
         "cooldown_seconds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 604800,
          "description": "SCH-06: the least time between two firings."
         },
         "actions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "items": {
           "type": "object",
           "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
           "required": [
            "type"
           ],
           "properties": {
            "type": {
             "enum": [
              "SET_VALUES",
              "RAISE_ALERT",
              "OPEN_INCIDENT"
             ]
            },
            "title": {
             "type": "string",
             "maxLength": 200
            }
           }
          }
         },
         "clear_actions": {
          "type": "array",
          "maxItems": 10,
          "items": {
           "type": "object",
           "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
           "required": [
            "type"
           ],
           "properties": {
            "type": {
             "enum": [
              "SET_VALUES",
              "RAISE_ALERT",
              "OPEN_INCIDENT"
             ]
            },
            "title": {
             "type": "string",
             "maxLength": 200
            }
           }
          }
         },
         "offline_safe": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The rule",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rule"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archiveRule",
    "tags": [
     "rules"
    ],
    "summary": "Archive a rule (kept with its runs and alerts) (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/rules/{rule}/runs": {
   "parameters": [
    {
     "name": "rule",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listRuleRuns",
    "tags": [
     "rules"
    ],
    "summary": "A rule's firings and clearings, newest first, with version, inputs and results (SCH-07)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Runs",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/RuleRun"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/alerts": {
   "get": {
    "operationId": "listAlerts",
    "tags": [
     "rules"
    ],
    "summary": "Alerts raised by rules: open ones (default) or ?state=all (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "open",
        "all"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Alerts",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Alert"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/alerts/{alert}/acknowledge": {
   "parameters": [
    {
     "name": "alert",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "acknowledgeAlert",
    "tags": [
     "rules"
    ],
    "summary": "Acknowledge an alert; one that waits for a person ends with it (W2.7)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The alert",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Alert"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/data-sources/test": {
   "post": {
    "operationId": "testDataSourceDefinition",
    "tags": [
     "data"
    ],
    "summary": "Test a source definition before saving it (W2.8, CON-09); at most 10 tests a minute",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "kind",
         "url"
        ],
        "properties": {
         "kind": {
          "enum": [
           "JSON_URL",
           "CSV_URL",
           "RSS",
           "WEBSOCKET"
          ]
         },
         "url": {
          "type": "string",
          "description": "ws:// or wss:// for WEBSOCKET (W2.10)."
         },
         "root": {
          "type": [
           "string",
           "null"
          ]
         },
         "auth_type": {
          "enum": [
           "NONE",
           "API_KEY",
           "BASIC",
           "OAUTH2_CC"
          ],
          "description": "JSON sources only."
         },
         "auth_config": {
          "type": "object"
         },
         "secret": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4000,
          "writeOnly": true,
          "description": "API key, password or client secret; stored encrypted, never returned. Left out on a change: the saved one stays."
         },
         "headers": {
          "type": "object",
          "maxProperties": 10,
          "additionalProperties": {
           "type": "string",
           "maxLength": 500
          }
         },
         "mapping": {
          "type": [
           "object",
           "null"
          ],
          "maxProperties": 50,
          "additionalProperties": {
           "type": "string",
           "maxLength": 300
          }
         },
         "subscribe_message": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 4096,
          "description": "WEBSOCKET only (W2.10)."
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ConnectionTest"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/data-sources/{source}/test": {
   "parameters": [
    {
     "name": "source",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "testDataSource",
    "tags": [
     "data"
    ],
    "summary": "Fetch a saved source now and show the result without storing it (W2.8, CON-09)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ConnectionTest"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/api-keys": {
   "get": {
    "operationId": "listApiKeys",
    "tags": [
     "data"
    ],
    "summary": "API keys for the push API (W2.9); never their secrets",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Keys",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/ApiKey"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createApiKey",
    "tags": [
     "data"
    ],
    "summary": "Create an API key that may push to these typed-in sources; the answer shows the key once (W2.9)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name"
        ],
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 200
         },
         "source_ids": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
           "type": "string"
          }
         },
         "expires_in_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 365
         },
         "scopes": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "items": {
           "enum": [
            "data.push",
            "events.read",
            "security.export"
           ]
          },
          "description": "Default [\"data.push\"]; source_ids only (and then required) with data.push"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The key, with `key` shown once",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ApiKey"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/api-keys/{key}": {
   "parameters": [
    {
     "name": "key",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "operationId": "updateApiKey",
    "tags": [
     "data"
    ],
    "summary": "Rename a key or change its sources (W2.9)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string"
         },
         "source_ids": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The key",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ApiKey"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "revokeApiKey",
    "tags": [
     "data"
    ],
    "summary": "Revoke a key (W2.9)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Revoked"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/api-keys/{key}/rotate": {
   "parameters": [
    {
     "name": "key",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "rotateApiKey",
    "tags": [
     "data"
    ],
    "summary": "A new secret for a key; the previous one works for grace_hours (default 24) (W2.9)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "grace_hours": {
          "type": "integer",
          "minimum": 0,
          "maximum": 168
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The key, with the new `key` shown once",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ApiKey"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/devices/{device}/timeline": {
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "deviceTimeline",
    "tags": [
     "fleet"
    ],
    "summary": "What happened to a device, newest first: its reports, what was done to it, remote actions, incident events (FLT-08, W3.1) Audit details and actors need audit.read.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 200
      }
     },
     {
      "name": "cursor",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "next_cursor of the previous page"
     }
    ],
    "responses": {
     "200": {
      "description": "Timeline",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "next_cursor"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/TimelineItem"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ]
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/devices/{device}/metrics": {
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "deviceMetrics",
    "tags": [
     "fleet"
    ],
    "summary": "Health at 5-minute resolution, the last hours (FLT-02, ADR-09, W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "hours",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 720
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Metrics",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/DeviceMetric"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/fleet/summary": {
   "get": {
    "operationId": "fleetSummary",
    "tags": [
     "fleet"
    ],
    "summary": "Devices online, offline, quarantined; open incidents by severity (W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Summary",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/FleetSummary"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/dashboard": {
   "get": {
    "operationId": "dashboard",
    "tags": [
     "fleet"
    ],
    "summary": "Operational dashboard: fleet, releases, connectors, incidents, getting started (W3.9a, ANA-01, UX-01); sections the caller may not read are null",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Dashboard",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Dashboard"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/fleet/settings": {
   "get": {
    "operationId": "fleetSettings",
    "tags": [
     "fleet"
    ],
    "summary": "Missed heartbeats before offline; whether offline incidents close themselves (W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Settings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/FleetSettings"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "updateFleetSettings",
    "tags": [
     "fleet"
    ],
    "summary": "Change the fleet settings (fleet.manage, W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "missed_heartbeats": {
          "type": "integer"
         },
         "auto_close_offline": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Settings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/FleetSettings"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screen-groups": {
   "get": {
    "operationId": "listScreenGroups",
    "tags": [
     "fleet"
    ],
    "summary": "Static screen groups (FLT-03, W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Groups",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/ScreenGroup"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createScreenGroup",
    "tags": [
     "fleet"
    ],
    "summary": "Make a group (fleet.manage)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string"
         },
         "description": {
          "type": [
           "string",
           "null"
          ]
         },
         "screen_ids": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        },
        "required": [
         "name"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The group",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ScreenGroup"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screen-groups/{group}": {
   "parameters": [
    {
     "name": "group",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "operationId": "updateScreenGroup",
    "tags": [
     "fleet"
    ],
    "summary": "Rename or describe a group",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string"
         },
         "description": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The group",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ScreenGroup"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archiveScreenGroup",
    "tags": [
     "fleet"
    ],
    "summary": "Archive a group",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screen-groups/{group}/screens": {
   "parameters": [
    {
     "name": "group",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "put": {
    "operationId": "setScreenGroupScreens",
    "tags": [
     "fleet"
    ],
    "summary": "The group's screens become these (only the caller's sites change)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "screen_ids": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        },
        "required": [
         "screen_ids"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The group",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ScreenGroup"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/incidents": {
   "get": {
    "operationId": "listIncidents",
    "tags": [
     "fleet"
    ],
    "summary": "Incidents, open first (FLT-07, W3.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "open",
        "closed",
        "all"
       ]
      }
     },
     {
      "name": "device_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Incidents",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Incident"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "post": {
    "operationId": "openIncident",
    "tags": [
     "fleet"
    ],
    "summary": "Open an incident (incident.manage)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "title": {
          "type": "string"
         },
         "severity": {
          "enum": [
           "INFO",
           "WARNING",
           "CRITICAL"
          ]
         },
         "device_ids": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "note": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "required": [
         "title"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The incident",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/IncidentFull"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/incidents/{incident}": {
   "parameters": [
    {
     "name": "incident",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getIncident",
    "tags": [
     "fleet"
    ],
    "summary": "An incident with its devices and events",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The incident",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/IncidentFull"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/incidents/{incident}/status": {
   "parameters": [
    {
     "name": "incident",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "moveIncident",
    "tags": [
     "fleet"
    ],
    "summary": "Move forward (open, investigating, contained, recovered, closed) with a note; closing is final",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "status": {
          "enum": [
           "OPEN",
           "INVESTIGATING",
           "CONTAINED",
           "RECOVERED",
           "CLOSED"
          ]
         },
         "note": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "required": [
         "status"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The incident",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/IncidentFull"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/incidents/{incident}/notes": {
   "parameters": [
    {
     "name": "incident",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "noteIncident",
    "tags": [
     "fleet"
    ],
    "summary": "Add a note",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "body": {
          "type": "string"
         }
        },
        "required": [
         "body"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The incident",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/IncidentFull"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/incidents/{incident}/devices": {
   "parameters": [
    {
     "name": "incident",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "linkIncidentDevices",
    "tags": [
     "fleet"
    ],
    "summary": "Link devices",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "device_ids": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        },
        "required": [
         "device_ids"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The incident",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/IncidentFull"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/notification-channels": {
   "get": {
    "operationId": "listNotificationChannels",
    "tags": [
     "fleet"
    ],
    "summary": "Where incidents are told: email or webhook (FLT-06, W3.2)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Channels",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/NotificationChannel"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createNotificationChannel",
    "tags": [
     "fleet"
    ],
    "summary": "Add a channel (fleet.manage); a webhook's signing secret is in this answer only",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string"
         },
         "min_severity": {
          "enum": [
           "INFO",
           "WARNING",
           "CRITICAL"
          ]
         },
         "events": {
          "type": "array",
          "items": {
           "enum": [
            "api_key.created",
            "api_key.revoked",
            "device.enrolled",
            "device.held",
            "device.hold_released",
            "device.offline",
            "device.online",
            "device.quarantined",
            "device.verification_failed",
            "emergency.cleared",
            "emergency.live",
            "incident.opened",
            "incident.status",
            "incident.updated",
            "maintenance.ended",
            "maintenance.opened",
            "membership.invited",
            "membership.joined",
            "membership.removed",
            "membership.updated",
            "release.deployed",
            "release.published",
            "release.revoked",
            "release.rolled_back",
            "release.rollout_completed",
            "release.rollout_halted",
            "release.rollout_started",
            "role.archived",
            "role.created",
            "role.updated",
            "screen.created",
            "screen.deleted",
            "sso.changed"
           ]
          },
          "maxItems": 50,
          "description": "Incident events for email; any catalog event (GET /event-types) for a webhook (W5.15)"
         },
         "enabled": {
          "type": "boolean"
         },
         "emails": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "url": {
          "type": "string"
         },
         "kind": {
          "enum": [
           "EMAIL",
           "WEBHOOK"
          ]
         }
        },
        "required": [
         "name",
         "kind"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "The channel",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/NotificationChannel"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/notification-channels/{channel}": {
   "parameters": [
    {
     "name": "channel",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "patch": {
    "operationId": "updateNotificationChannel",
    "tags": [
     "fleet"
    ],
    "summary": "Change a channel (a webhook on a new host gets a new secret)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string"
         },
         "min_severity": {
          "enum": [
           "INFO",
           "WARNING",
           "CRITICAL"
          ]
         },
         "events": {
          "type": "array",
          "items": {
           "enum": [
            "api_key.created",
            "api_key.revoked",
            "device.enrolled",
            "device.held",
            "device.hold_released",
            "device.offline",
            "device.online",
            "device.quarantined",
            "device.verification_failed",
            "emergency.cleared",
            "emergency.live",
            "incident.opened",
            "incident.status",
            "incident.updated",
            "maintenance.ended",
            "maintenance.opened",
            "membership.invited",
            "membership.joined",
            "membership.removed",
            "membership.updated",
            "release.deployed",
            "release.published",
            "release.revoked",
            "release.rolled_back",
            "release.rollout_completed",
            "release.rollout_halted",
            "release.rollout_started",
            "role.archived",
            "role.created",
            "role.updated",
            "screen.created",
            "screen.deleted",
            "sso.changed"
           ]
          },
          "maxItems": 50,
          "description": "Incident events for email; any catalog event (GET /event-types) for a webhook (W5.15)"
         },
         "enabled": {
          "type": "boolean"
         },
         "emails": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "url": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The channel",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/NotificationChannel"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   },
   "delete": {
    "operationId": "archiveNotificationChannel",
    "tags": [
     "fleet"
    ],
    "summary": "Archive a channel",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/notification-channels/{channel}/rotate": {
   "parameters": [
    {
     "name": "channel",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "rotateNotificationSecret",
    "tags": [
     "fleet"
    ],
    "summary": "A new webhook signing secret (the old one stops at once)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The channel with its new secret",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/NotificationChannel"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/notification-channels/{channel}/test": {
   "parameters": [
    {
     "name": "channel",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "testNotificationChannel",
    "tags": [
     "fleet"
    ],
    "summary": "Send a test now",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "How it went",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "ok",
            "status",
            "error"
           ],
           "properties": {
            "ok": {
             "type": "boolean"
            },
            "status": {
             "type": [
              "integer",
              "null"
             ]
            },
            "error": {
             "type": [
              "string",
              "null"
             ]
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/notification-channels/{channel}/deliveries": {
   "parameters": [
    {
     "name": "channel",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "listNotificationDeliveries",
    "tags": [
     "fleet"
    ],
    "summary": "The channel's last 50 deliveries",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Deliveries",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/NotificationDelivery"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/releases/{release}/rollout": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getRollout",
    "tags": [
     "releases"
    ],
    "summary": "A release's staged rollout: waves, health and every device (W3.3, REL-05)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rollout",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rollout"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/releases/{release}/rollout/promote": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "promoteRollout",
    "tags": [
     "releases"
    ],
    "summary": "Offer the next wave now (after the last: complete)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rollout",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rollout"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "wave": {
          "type": "integer",
          "minimum": 1,
          "maximum": 11,
          "description": "The wave the caller saw; refused (409) when the rollout moved on meanwhile."
         }
        }
       }
      }
     }
    }
   }
  },
  "/releases/{release}/rollout/halt": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "haltRollout",
    "tags": [
     "releases"
    ],
    "summary": "Stop offering further waves; what was offered stays",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rollout",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rollout"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 300
         }
        }
       }
      }
     }
    }
   }
  },
  "/releases/{release}/rollout/resume": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "resumeRollout",
    "tags": [
     "releases"
    ],
    "summary": "Carry on with a halted rollout",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rollout",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rollout"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases/{release}/rollout/rollback": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "rollbackRollout",
    "tags": [
     "releases"
    ],
    "summary": "Put every screen back on what it would show without this release (signed ROLLBACK releases); needs every site",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The rollout",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Rollout"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/members": {
   "get": {
    "operationId": "listMembers",
    "tags": [
     "accounts"
    ],
    "summary": "Who has access to the organisation (TEN-09)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Member"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/members/{member}": {
   "parameters": [
    {
     "name": "member",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "patch": {
    "operationId": "updateMember",
    "tags": [
     "accounts"
    ],
    "summary": "Change role and sites (an organisation keeps an active owner)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Member"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "role": {
          "type": "string"
         },
         "site_ids": {
          "type": [
           "array",
           "null"
          ],
          "items": {
           "type": "string",
           "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
         }
        }
       }
      }
     }
    }
   },
   "delete": {
    "operationId": "removeMember",
    "tags": [
     "accounts"
    ],
    "summary": "Remove access",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Removed"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/members/{member}/suspend": {
   "parameters": [
    {
     "name": "member",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "suspendMember",
    "tags": [
     "accounts"
    ],
    "summary": "Suspend access (not your own, not the last owner)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Member"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/members/{member}/reactivate": {
   "parameters": [
    {
     "name": "member",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "reactivateMember",
    "tags": [
     "accounts"
    ],
    "summary": "Give suspended access back",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Member"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/invitations": {
   "get": {
    "operationId": "listInvitations",
    "tags": [
     "accounts"
    ],
    "summary": "Open invitations and those of the last 30 days",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Invitation"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createInvitation",
    "tags": [
     "accounts"
    ],
    "summary": "Invite someone by email with a role and sites; the link is emailed and shown once",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "201": {
      "description": "Invited",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Invitation"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "email",
         "role"
        ],
        "properties": {
         "email": {
          "type": "string",
          "maxLength": 254
         },
         "role": {
          "type": "string"
         },
         "site_ids": {
          "type": [
           "array",
           "null"
          ],
          "items": {
           "type": "string",
           "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/invitations/{invitation}": {
   "parameters": [
    {
     "name": "invitation",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^inv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "delete": {
    "operationId": "revokeInvitation",
    "tags": [
     "accounts"
    ],
    "summary": "Withdraw an open invitation",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Revoked"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/invitations/accept": {
   "post": {
    "operationId": "acceptInvitation",
    "tags": [
     "accounts"
    ],
    "summary": "Accept an invitation as the signed-in person (the invited address); no tenant header",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Joined",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "tenant_id": {
             "type": "string",
             "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "membership_id": {
             "type": "string",
             "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            },
            "role": {
             "type": "string"
            },
            "already_member": {
             "type": "boolean"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "token"
        ],
        "properties": {
         "token": {
          "type": "string"
         }
        }
       }
      }
     }
    }
   }
  },
  "/trials": {
   "post": {
    "operationId": "startTrial",
    "tags": [
     "accounts"
    ],
    "summary": "Start a 14-day trial organisation owned by the signed-in person, once per person (TEN-15)",
    "parameters": [],
    "responses": {
     "201": {
      "description": "Trial started",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "tenant": {
             "type": "object",
             "additionalProperties": false,
             "properties": {
              "id": {
               "type": "string",
               "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
              },
              "name": {
               "type": "string"
              },
              "slug": {
               "type": "string"
              },
              "status": {
               "enum": [
                "trial"
               ]
              },
              "trial_ends_at": {
               "type": "string",
               "format": "date-time"
              }
             }
            },
            "membership_id": {
             "type": "string",
             "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "name"
        ],
        "properties": {
         "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 100
         }
        }
       }
      }
     }
    }
   }
  },
  "/devices/{device}/revoke": {
   "post": {
    "operationId": "revokeDevice",
    "tags": [
     "devices"
    ],
    "summary": "Revoke a device: cut off at once, its sessions end, the screen can be enrolled again (SEC-02)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "device",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "reason"
        ],
        "properties": {
         "reason": {
          "type": "string",
          "minLength": 3,
          "maxLength": 200
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Device"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/devices/{device}/holds": {
   "get": {
    "operationId": "deviceHolds",
    "tags": [
     "devices"
    ],
    "summary": "A device's security holds with their evidence, newest first (SEC-03)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "device",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
             "opened_at": {
              "type": "string",
              "format": "date-time"
             },
             "reason": {
              "type": "string"
             },
             "evidence": {
              "type": "object"
             },
             "released_at": {
              "type": [
               "string",
               "null"
              ],
              "format": "date-time"
             },
             "released_by": {
              "type": [
               "string",
               "null"
              ]
             },
             "release_note": {
              "type": [
               "string",
               "null"
              ]
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/devices/{device}/hold/release": {
   "post": {
    "operationId": "releaseDeviceHold",
    "tags": [
     "devices"
    ],
    "summary": "Release a held device (Security Administrator only, with a note) (SEC-03)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "device",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "note"
        ],
        "properties": {
         "note": {
          "type": "string",
          "minLength": 3,
          "maxLength": 300
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Device"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/alert-templates": {
   "get": {
    "operationId": "listAlertTemplates",
    "tags": [
     "emergency"
    ],
    "summary": "Alert templates, most severe first (W4.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Templates",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/AlertTemplate"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createAlertTemplate",
    "tags": [
     "emergency"
    ],
    "summary": "Write an alert template (unapproved until approved)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AlertTemplateInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertTemplate"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/alert-templates/{template}": {
   "parameters": [
    {
     "name": "template",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "patch": {
    "operationId": "updateAlertTemplate",
    "tags": [
     "emergency"
    ],
    "summary": "Change an alert template; any change makes it unapproved",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AlertTemplateInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertTemplate"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "archiveAlertTemplate",
    "tags": [
     "emergency"
    ],
    "summary": "Archive an alert template",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/alert-templates/{template}/approve": {
   "parameters": [
    {
     "name": "template",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "approveAlertTemplate",
    "tags": [
     "emergency"
    ],
    "summary": "Approve an alert template (not by whoever changed it last, when two people are needed)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "version": {
          "type": "integer",
          "description": "The version you checked; 409 if it changed since"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Approved",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertTemplate"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/emergency-settings": {
   "get": {
    "operationId": "getEmergencySettings",
    "tags": [
     "emergency"
    ],
    "summary": "Whether broadcasts need two people",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Settings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EmergencySettings"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "updateEmergencySettings",
    "tags": [
     "emergency"
    ],
    "summary": "Choose whether broadcasts need two people (emergency.approve)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/EmergencySettings"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Settings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EmergencySettings"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/emergencies": {
   "get": {
    "operationId": "listEmergencies",
    "tags": [
     "emergency"
    ],
    "summary": "The newest 50 broadcasts, with how many screens fetched and showed each",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Broadcasts",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Emergency"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "startEmergency",
    "tags": [
     "emergency"
    ],
    "summary": "Start a broadcast from an approved template to chosen screens; it waits for a second person to confirm it unless the organisation chose one person (then it is signed and live at once)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "template_id",
         "mode",
         "target"
        ],
        "properties": {
         "template_id": {
          "type": "string",
          "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
         },
         "mode": {
          "enum": [
           "LIVE",
           "DRILL"
          ]
         },
         "target": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
           "all": {
            "type": "boolean"
           },
           "site_ids": {
            "type": "array",
            "items": {
             "type": "string",
             "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
           },
           "group_ids": {
            "type": "array",
            "items": {
             "type": "string",
             "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
           },
           "screen_ids": {
            "type": "array",
            "items": {
             "type": "string",
             "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
            }
           }
          }
         },
         "headline": {
          "oneOf": [
           {
            "type": "object",
            "maxProperties": 4,
            "propertyNames": {
             "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
            },
            "additionalProperties": {
             "type": [
              "string",
              "null"
             ]
            },
            "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
           },
           {
            "type": "null"
           }
          ]
         },
         "body": {
          "oneOf": [
           {
            "type": "object",
            "maxProperties": 4,
            "propertyNames": {
             "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
            },
            "additionalProperties": {
             "type": [
              "string",
              "null"
             ]
            },
            "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
           },
           {
            "type": "null"
           }
          ]
         },
         "instruction": {
          "oneOf": [
           {
            "type": "object",
            "maxProperties": 4,
            "propertyNames": {
             "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
            },
            "additionalProperties": {
             "type": [
              "string",
              "null"
             ]
            },
            "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
           },
           {
            "type": "null"
           }
          ]
         },
         "duration_minutes": {
          "type": "integer",
          "minimum": 5,
          "maximum": 1440
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Started",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Emergency"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   }
  },
  "/emergencies/{emergency}": {
   "parameters": [
    {
     "name": "emergency",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getEmergency",
    "tags": [
     "emergency"
    ],
    "summary": "One broadcast with its delivery report: when each screen fetched, showed and stopped showing it (ALR-03)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Broadcast",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EmergencyDetail"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/emergencies/{emergency}/confirm": {
   "parameters": [
    {
     "name": "emergency",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "confirmEmergency",
    "tags": [
     "emergency"
    ],
    "summary": "Confirm a broadcast another person started: it is signed and goes to the screens",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Broadcast",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Emergency"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   }
  },
  "/emergencies/{emergency}/cancel": {
   "parameters": [
    {
     "name": "emergency",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "cancelEmergency",
    "tags": [
     "emergency"
    ],
    "summary": "Cancel a broadcast still waiting for confirmation",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Broadcast",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Emergency"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/emergencies/{emergency}/clear": {
   "parameters": [
    {
     "name": "emergency",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "clearEmergency",
    "tags": [
     "emergency"
    ],
    "summary": "Take a live broadcast off the screens (signed, one person)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Broadcast",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Emergency"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   }
  },
  "/alert-feeds/sources": {
   "get": {
    "operationId": "alertFeedSources",
    "tags": [
     "emergency"
    ],
    "summary": "The allow-listed alert hosts and suggested feeds (W4.2)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Sources",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "allow_hosts",
            "suggestions"
           ],
           "properties": {
            "allow_hosts": {
             "type": "array",
             "items": {
              "type": "string"
             }
            },
            "suggestions": {
             "type": "array",
             "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
               "name",
               "url"
              ],
              "properties": {
               "name": {
                "type": "string"
               },
               "url": {
                "type": "string"
               }
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/alert-feeds": {
   "get": {
    "operationId": "listAlertFeeds",
    "tags": [
     "emergency"
    ],
    "summary": "Official alert feeds (CAP)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Feeds",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/AlertFeed"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createAlertFeed",
    "tags": [
     "emergency"
    ],
    "summary": "Add an alert feed from an allow-listed source (emergency.approve)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AlertFeedInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertFeed"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/alert-feeds/{feed}": {
   "parameters": [
    {
     "name": "feed",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "patch": {
    "operationId": "updateAlertFeed",
    "tags": [
     "emergency"
    ],
    "summary": "Change an alert feed",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AlertFeedInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertFeed"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "archiveAlertFeed",
    "tags": [
     "emergency"
    ],
    "summary": "Archive an alert feed",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/alert-feeds/{feed}/items": {
   "parameters": [
    {
     "name": "feed",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "listAlertFeedItems",
    "tags": [
     "emergency"
    ],
    "summary": "The newest 50 messages read from a feed and what became of each",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Items",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/AlertFeedItem"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/alert-feeds/{feed}/check": {
   "parameters": [
    {
     "name": "feed",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "checkAlertFeed",
    "tags": [
     "emergency"
    ],
    "summary": "Check the feed on the data worker's next round",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AlertFeed"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/display-schedules": {
   "get": {
    "operationId": "listDisplaySchedules",
    "tags": [
     "fleet"
    ],
    "summary": "Display schedules: when screens are on, volume, brightness (W4.3)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Schedules",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/DisplaySchedule"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createDisplaySchedule",
    "tags": [
     "fleet"
    ],
    "summary": "Write a display schedule (display.schedule)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DisplayScheduleInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DisplaySchedule"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/display-schedules/{schedule}": {
   "parameters": [
    {
     "name": "schedule",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dsch_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "patch": {
    "operationId": "updateDisplaySchedule",
    "tags": [
     "fleet"
    ],
    "summary": "Change a display schedule",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DisplayScheduleInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/DisplaySchedule"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "archiveDisplaySchedule",
    "tags": [
     "fleet"
    ],
    "summary": "Archive a display schedule",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reports/play-time": {
   "get": {
    "operationId": "reportPlayTime",
    "tags": [
     "reports"
    ],
    "summary": "Proof of play: how long and how often layouts and media were on screen (W5.2, ADV-04)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "description": "First day (YYYY-MM-DD, at each screen's site); default six days before to.",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "description": "Last day, included; default today (UTC).",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "description": "Only screens at this site.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "screen_id",
      "in": "query",
      "required": false,
      "description": "Only this screen.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "description": "csv for a CSV download (UTF-8 with a byte order mark).",
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      }
     },
     {
      "name": "by",
      "in": "query",
      "required": false,
      "description": "Group by screen (default), layout, asset (media) or day.",
      "schema": {
       "type": "string",
       "enum": [
        "screen",
        "layout",
        "asset",
        "day"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Play time",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "totals",
          "from",
          "to",
          "by"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "description": "By screen: id, name, site. By layout: id, name, screens. By asset: id, name, kind, screens. By day: date, screens. Always plays and seconds.",
            "required": [
             "plays",
             "seconds"
            ],
            "properties": {
             "id": {
              "type": "string"
             },
             "name": {
              "type": "string"
             },
             "site": {
              "type": [
               "string",
               "null"
              ]
             },
             "kind": {
              "type": [
               "string",
               "null"
              ]
             },
             "date": {
              "type": "string",
              "format": "date"
             },
             "screens": {
              "type": "integer"
             },
             "plays": {
              "type": "integer"
             },
             "seconds": {
              "type": "integer"
             }
            }
           }
          },
          "totals": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "plays",
            "seconds"
           ],
           "properties": {
            "plays": {
             "type": "integer"
            },
            "seconds": {
             "type": "integer"
            }
           }
          },
          "from": {
           "type": "string",
           "format": "date"
          },
          "to": {
           "type": "string",
           "format": "date"
          },
          "by": {
           "type": "string"
          }
         }
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/reports/uptime": {
   "get": {
    "operationId": "reportUptime",
    "tags": [
     "reports"
    ],
    "summary": "Each screen's share of time online, from heartbeats in 5-minute steps; at most 31 days, history 30 (W5.2, ANA-02)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "description": "First day (YYYY-MM-DD, at each screen's site); default six days before to.",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "description": "Last day, included; default today (UTC).",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "description": "Only screens at this site.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "screen_id",
      "in": "query",
      "required": false,
      "description": "Only this screen.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "description": "csv for a CSV download (UTF-8 with a byte order mark).",
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Uptime",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "from",
          "to",
          "history_days"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "id",
             "name",
             "site",
             "online_seconds",
             "expected_seconds",
             "percent",
             "last_seen_at"
            ],
            "properties": {
             "id": {
              "type": "string"
             },
             "name": {
              "type": "string"
             },
             "site": {
              "type": [
               "string",
               "null"
              ]
             },
             "online_seconds": {
              "type": "integer"
             },
             "expected_seconds": {
              "type": "integer"
             },
             "percent": {
              "type": [
               "number",
               "null"
              ]
             },
             "last_seen_at": {
              "type": [
               "string",
               "null"
              ],
              "format": "date-time"
             }
            }
           }
          },
          "from": {
           "type": "string",
           "format": "date"
          },
          "to": {
           "type": "string",
           "format": "date"
          },
          "history_days": {
           "type": "integer"
          }
         }
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/reports/errors": {
   "get": {
    "operationId": "reportPlaybackErrors",
    "tags": [
     "reports"
    ],
    "summary": "What players reported going wrong, and gaps in their play records, newest first (W5.2, ANA-02)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "description": "First day (YYYY-MM-DD, at each screen's site); default six days before to.",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "description": "Last day, included; default today (UTC).",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "description": "Only screens at this site.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "screen_id",
      "in": "query",
      "required": false,
      "description": "Only this screen.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "description": "csv for a CSV download (UTF-8 with a byte order mark).",
      "schema": {
       "type": "string",
       "enum": [
        "json",
        "csv"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Playback errors",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "from",
          "to"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "at",
             "local_date",
             "local_time",
             "screen_id",
             "screen",
             "type",
             "step",
             "detail"
            ],
            "properties": {
             "at": {
              "type": "string",
              "format": "date-time"
             },
             "local_date": {
              "type": "string",
              "format": "date"
             },
             "local_time": {
              "type": "string"
             },
             "screen_id": {
              "type": "string"
             },
             "screen": {
              "type": "string"
             },
             "type": {
              "type": "string"
             },
             "step": {
              "type": [
               "string",
               "null"
              ]
             },
             "detail": {
              "type": [
               "string",
               "null"
              ]
             }
            }
           }
          },
          "from": {
           "type": "string",
           "format": "date"
          },
          "to": {
           "type": "string",
           "format": "date"
          }
         }
        }
       },
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/assets/{asset}/restore": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "restoreAsset",
    "tags": [
     "content"
    ],
    "summary": "Take a file out of the bin (W5.5). A purged file is 409 asset-purged: upload the same file again.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "200": {
      "description": "The asset",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/assets/{asset}/purge": {
   "parameters": [
    {
     "name": "asset",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "purgeAsset",
    "tags": [
     "content"
    ],
    "summary": "Delete a file in the bin for good now (W5.5): its stored bytes and copies go, the record stays. 409 asset-not-in-bin or asset-in-use.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "204": {
      "description": "Deleted for good (or already)"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   }
  },
  "/cleanup": {
   "get": {
    "operationId": "getCleanup",
    "tags": [
     "content"
    ],
    "summary": "W5.5: what nothing uses: media no layout being edited, playlist or release still on uses; playlists no layout being edited plays; layouts with no version on screens or waiting for approval, unchanged for a week; playlists also not played by a release still on. Each part needs its read permission (asset.read; layout.read), else null.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Unused content",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "media": {
             "type": [
              "array",
              "null"
             ],
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               },
               "kind": {
                "type": "string"
               },
               "size": {
                "type": "integer"
               },
               "created_at": {
                "type": "string",
                "format": "date-time"
               },
               "saved_versions": {
                "type": "integer",
                "description": "saved layout versions that name it (they could not be published again)"
               }
              },
              "required": [
               "id",
               "name",
               "kind",
               "size",
               "created_at",
               "saved_versions"
              ],
              "additionalProperties": false
             },
             "description": "largest first"
            },
            "playlists": {
             "type": [
              "array",
              "null"
             ],
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               },
               "items": {
                "type": "integer"
               },
               "updated_at": {
                "type": "string",
                "format": "date-time"
               }
              },
              "required": [
               "id",
               "name",
               "items",
               "updated_at"
              ],
              "additionalProperties": false
             },
             "description": "oldest first"
            },
            "layouts": {
             "type": [
              "array",
              "null"
             ],
             "items": {
              "type": "object",
              "properties": {
               "id": {
                "type": "string"
               },
               "name": {
                "type": "string"
               },
               "versions": {
                "type": "integer"
               },
               "updated_at": {
                "type": "string",
                "format": "date-time"
               }
              },
              "required": [
               "id",
               "name",
               "versions",
               "updated_at"
              ],
              "additionalProperties": false
             },
             "description": "oldest first"
            }
           },
           "required": [
            "media",
            "playlists",
            "layouts"
           ],
           "additionalProperties": false
          },
          "meta": {
           "type": "object",
           "properties": {
            "more": {
             "type": "object",
             "properties": {
              "media": {
               "type": "boolean"
              },
              "playlists": {
               "type": "boolean"
              },
              "layouts": {
               "type": "boolean"
              }
             },
             "required": [
              "media",
              "playlists",
              "layouts"
             ],
             "additionalProperties": false,
             "description": "a list stops at 500: true when there are more"
            },
            "recent_days": {
             "type": "integer",
             "description": "layouts changed within this many days are left out"
            }
           },
           "required": [
            "more",
            "recent_days"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data",
          "meta"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/releases/{release}/hide": {
   "parameters": [
    {
     "name": "release",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "hideRelease",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: take an ended (revoked or expired) release off the lists; it is kept. 409 release-on while it is still on.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "204": {
      "description": "Off the lists"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   },
   "delete": {
    "operationId": "showRelease",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: put a release back on the lists",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "204": {
      "description": "On the lists again"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/layouts/{layout}/hide": {
   "parameters": [
    {
     "name": "layout",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "hideLayout",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: take a layout version off the lists; it is kept. 409 layout-in-use while a release still on or a request waiting for approval uses it.",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "204": {
      "description": "Off the lists"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   },
   "delete": {
    "operationId": "showLayout",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: put a layout version back on the lists",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "204": {
      "description": "On the lists again"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/releases/hide-ended": {
   "post": {
    "operationId": "hideEndedReleases",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: take every ended release this person can see off the lists",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "200": {
      "description": "How many came off",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "hidden": {
             "type": "integer"
            }
           },
           "required": [
            "hidden"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     }
    }
   }
  },
  "/layouts/hide-unused": {
   "post": {
    "operationId": "hideUnusedLayouts",
    "tags": [
     "content"
    ],
    "summary": "W5.5b: take every layout version nothing on screens or waiting for approval uses off the lists",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "200": {
      "description": "How many came off",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "hidden": {
             "type": "integer"
            }
           },
           "required": [
            "hidden"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     }
    }
   }
  },
  "/campaigns": {
   "get": {
    "operationId": "listCampaigns",
    "tags": [
     "content"
    ],
    "summary": "W5.6: campaigns (release.read)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "200": {
      "description": "Campaigns, newest first",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Campaign"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     }
    }
   },
   "post": {
    "operationId": "createCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6: a campaign, as a draft (layout.write): name, kind, layout_id, start_date, end_date and targets are needed",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CampaignInput"
       }
      }
     }
    },
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "201": {
      "description": "The draft",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/campaigns/{campaign}": {
   "parameters": [
    {
     "name": "campaign",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^cmp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6: one campaign",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "The campaign",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     }
    }
   },
   "patch": {
    "operationId": "updateCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6: change a campaign (a started or paused one needs release.publish; a started one reaches its screens again at once)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CampaignInput"
       }
      }
     }
    },
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "The campaign",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "deleteCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6: delete a draft (409 campaign-not-draft otherwise: end it)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "204": {
      "description": "Deleted"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/campaigns/{campaign}/start": {
   "parameters": [
    {
     "name": "campaign",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^cmp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "startCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6: start a draft or paused campaign: it reaches its screens now (release.publish)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "The campaign, with deliveries",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/campaigns/{campaign}/pause": {
   "parameters": [
    {
     "name": "campaign",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^cmp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "pauseCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6 (ADV-05): pause: it leaves its screens",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "The campaign, with deliveries",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/campaigns/{campaign}/end": {
   "parameters": [
    {
     "name": "campaign",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^cmp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "endCampaign",
    "tags": [
     "content"
    ],
    "summary": "W5.6 (ADV-05): end for good: it leaves its screens",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "200": {
      "description": "The campaign, with deliveries",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Campaign"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/maintenance-sessions": {
   "get": {
    "operationId": "listMaintenanceSessions",
    "tags": [
     "devices"
    ],
    "summary": "Remote maintenance sessions, newest first (W5.8, SEC-04)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "device_id",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Sessions",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/MaintenanceSession"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-sessions/{session}": {
   "parameters": [
    {
     "name": "session",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getMaintenanceSession",
    "tags": [
     "devices"
    ],
    "summary": "One maintenance session",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The session",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceSession"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/devices/{device}/maintenance-sessions": {
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "requestMaintenanceSession",
    "tags": [
     "devices"
    ],
    "summary": "Ask for a remote maintenance session: reason, scope, duration, source networks, and an SSH public key (or one is made for this session). Needs a fresh sign-in; opens at once unless the tenant requires approval",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "reason",
         "scope",
         "minutes"
        ],
        "properties": {
         "reason": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500
         },
         "scope": {
          "enum": [
           "shell",
           "admin",
           "view"
          ]
         },
         "minutes": {
          "type": "integer",
          "minimum": 15,
          "maximum": 480
         },
         "source_cidrs": {
          "type": "array",
          "minItems": 1,
          "maxItems": 4,
          "items": {
           "type": "string"
          }
         },
         "ssh_public_key": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "description": "source_cidrs is required for shell and admin, and refused (with ssh_public_key) for view"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Asked for (and opening, without approval)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceSession"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-sessions/{session}/approve": {
   "parameters": [
    {
     "name": "session",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "approveMaintenanceSession",
    "tags": [
     "devices"
    ],
    "summary": "Approve a waiting session (not your own); it opens now. Needs a fresh sign-in",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "note": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The session",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceSession"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-sessions/{session}/reject": {
   "parameters": [
    {
     "name": "session",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "rejectMaintenanceSession",
    "tags": [
     "devices"
    ],
    "summary": "Refuse a waiting session, with a note",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "note": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
         }
        },
        "required": [
         "note"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The session",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceSession"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-sessions/{session}/end": {
   "parameters": [
    {
     "name": "session",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "endMaintenanceSession",
    "tags": [
     "devices"
    ],
    "summary": "Withdraw a waiting request or end an open session now (the device is told to close it)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 300
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The session",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceSession"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-policy": {
   "get": {
    "operationId": "getMaintenancePolicy",
    "tags": [
     "devices"
    ],
    "summary": "Whether maintenance sessions need a second person's approval",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The policy",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "approval_required": {
             "type": "boolean"
            }
           },
           "required": [
            "approval_required"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "setMaintenancePolicy",
    "tags": [
     "devices"
    ],
    "summary": "Set whether maintenance sessions need approval (needs a fresh sign-in)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "approval_required"
        ],
        "properties": {
         "approval_required": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The policy",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "approval_required": {
             "type": "boolean"
            }
           },
           "required": [
            "approval_required"
           ],
           "additionalProperties": false
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-windows": {
   "get": {
    "operationId": "listMaintenanceWindows",
    "tags": [
     "fleet"
    ],
    "summary": "Maintenance windows not over yet (ended=1: all)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "ended",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Windows",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/MaintenanceWindow"
           }
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "post": {
    "operationId": "createMaintenanceWindow",
    "tags": [
     "fleet"
    ],
    "summary": "Plan a maintenance window (up to 14 days)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "targets": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
           "all": {
            "type": "boolean"
           },
           "site_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "zone_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "screen_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "tags": {
            "type": "array",
            "items": {
             "type": "string"
            }
           }
          }
         },
         "starts_at": {
          "type": "string",
          "format": "date-time"
         },
         "ends_at": {
          "type": "string",
          "format": "date-time"
         }
        },
        "required": [
         "name",
         "targets",
         "starts_at",
         "ends_at"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Planned",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceWindow"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/maintenance-windows/{window}": {
   "parameters": [
    {
     "name": "window",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mw_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getMaintenanceWindow",
    "tags": [
     "fleet"
    ],
    "summary": "One maintenance window",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The window",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceWindow"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "patch": {
    "operationId": "updateMaintenanceWindow",
    "tags": [
     "fleet"
    ],
    "summary": "Change a planned window (once started, only its end)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "targets": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
           "all": {
            "type": "boolean"
           },
           "site_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "zone_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "screen_ids": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "tags": {
            "type": "array",
            "items": {
             "type": "string"
            }
           }
          }
         },
         "starts_at": {
          "type": "string",
          "format": "date-time"
         },
         "ends_at": {
          "type": "string",
          "format": "date-time"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The window",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceWindow"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "deleteMaintenanceWindow",
    "tags": [
     "fleet"
    ],
    "summary": "Delete a window that has not started",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/maintenance-windows/{window}/end": {
   "parameters": [
    {
     "name": "window",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^mw_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "endMaintenanceWindow",
    "tags": [
     "fleet"
    ],
    "summary": "End a window now; what it muted and is still open is notified",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The window",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/MaintenanceWindow"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/devices/{device}/diagnostics": {
   "parameters": [
    {
     "name": "device",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "listDeviceDiagnostics",
    "tags": [
     "devices"
    ],
    "summary": "The device's newest screenshot and troubleshooting requests (W5.11), without what they carried; meta says what the device can send and whether a maintenance session is open on it",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Requests",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Diagnostics"
           }
          },
          "meta": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "available",
            "screenshot",
            "session"
           ],
           "properties": {
            "available": {
             "type": "boolean"
            },
            "screenshot": {
             "type": [
              "boolean",
              "null"
             ]
            },
            "session": {
             "oneOf": [
              {
               "type": "null"
              },
              {
               "type": "object",
               "additionalProperties": false,
               "required": [
                "id",
                "scope",
                "ends_at"
               ],
               "properties": {
                "id": {
                 "type": "string"
                },
                "scope": {
                 "enum": [
                  "shell",
                  "admin",
                  "view"
                 ]
                },
                "ends_at": {
                 "type": "string",
                 "format": "date-time"
                }
               }
              }
             ]
            }
           }
          }
         },
         "required": [
          "data",
          "meta"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "requestDeviceDiagnostics",
    "tags": [
     "devices"
    ],
    "summary": "Ask the device for a picture of its screen (screenshot, device.command; PLR-16) or, during a maintenance session on it, a troubleshooting report (full, device.troubleshoot; FLT-13). Signed for that device, it expires after 15 minutes",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "kind"
        ],
        "properties": {
         "kind": {
          "enum": [
           "screenshot",
           "full"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Signed and queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Diagnostics"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    }
   }
  },
  "/diagnostics/{diagnostics}": {
   "parameters": [
    {
     "name": "diagnostics",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dgn_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getDiagnostics",
    "tags": [
     "devices"
    ],
    "summary": "One request and what the device sent; the running state and log only to device.troubleshoot",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The request",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Diagnostics"
          }
         },
         "required": [
          "data"
         ],
         "additionalProperties": false
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/diagnostics/{diagnostics}/screenshot": {
   "parameters": [
    {
     "name": "diagnostics",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dgn_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getDiagnosticsScreenshot",
    "tags": [
     "devices"
    ],
    "summary": "The picture itself (JPEG or PNG; never cached)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The picture",
      "content": {
       "image/jpeg": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "image/png": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/rules/dry-run": {
   "post": {
    "operationId": "dryRunRule",
    "tags": [
     "rules"
    ],
    "summary": "W5.12 (SCH-09): try a rule as written (saved or not) against values you give (sample) or over the last 1–48 hours of its sources' recorded values (history). Nothing is stored, sent or changed",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "mode",
         "rule"
        ],
        "properties": {
         "mode": {
          "enum": [
           "sample",
           "history"
          ]
         },
         "rule": {
          "type": "object",
          "description": "The rule as for POST /rules (name optional)"
         },
         "samples": {
          "type": "object",
          "description": "sample: per data source id, {values, quality?}"
         },
         "at": {
          "type": "string",
          "format": "date-time",
          "description": "sample: the moment (default now)"
         },
         "hours": {
          "type": "integer",
          "minimum": 1,
          "maximum": 48,
          "default": 24
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "What would have happened",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "oneOf": [
            {
             "type": "object",
             "additionalProperties": false,
             "required": [
              "mode",
              "at",
              "holds",
              "inputs",
              "would",
              "note"
             ],
             "properties": {
              "mode": {
               "const": "sample"
              },
              "at": {
               "type": "string",
               "format": "date-time"
              },
              "holds": {
               "type": "boolean"
              },
              "inputs": {
               "type": "object"
              },
              "would": {
               "type": "array",
               "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                 "type",
                 "ok",
                 "detail"
                ],
                "properties": {
                 "type": {
                  "type": "string"
                 },
                 "ok": {
                  "type": "boolean"
                 },
                 "detail": {
                  "type": "string"
                 },
                 "screens": {
                  "type": "integer",
                  "description": "Screens showing that data source now"
                 }
                }
               }
              },
              "note": {
               "type": [
                "string",
                "null"
               ]
              }
             }
            },
            {
             "type": "object",
             "additionalProperties": false,
             "required": [
              "mode",
              "from",
              "to",
              "step_seconds",
              "fired",
              "cleared",
              "held_minutes",
              "state_at_end",
              "events",
              "more_events",
              "would",
              "would_clear",
              "notes"
             ],
             "properties": {
              "mode": {
               "const": "history"
              },
              "from": {
               "type": "string",
               "format": "date-time"
              },
              "to": {
               "type": "string",
               "format": "date-time"
              },
              "step_seconds": {
               "type": "integer"
              },
              "fired": {
               "type": "integer"
              },
              "cleared": {
               "type": "integer"
              },
              "held_minutes": {
               "type": "integer"
              },
              "state_at_end": {
               "enum": [
                "IDLE",
                "PENDING",
                "ACTIVE",
                "CLEARING"
               ]
              },
              "events": {
               "type": "array",
               "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                 "at",
                 "event",
                 "inputs"
                ],
                "properties": {
                 "at": {
                  "type": "string",
                  "format": "date-time"
                 },
                 "event": {
                  "enum": [
                   "FIRE",
                   "CLEAR",
                   "COOLING"
                  ]
                 },
                 "inputs": {
                  "type": "object"
                 }
                }
               }
              },
              "more_events": {
               "type": "boolean"
              },
              "would": {
               "type": "array",
               "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                 "type",
                 "ok",
                 "detail"
                ],
                "properties": {
                 "type": {
                  "type": "string"
                 },
                 "ok": {
                  "type": "boolean"
                 },
                 "detail": {
                  "type": "string"
                 },
                 "screens": {
                  "type": "integer",
                  "description": "Screens showing that data source now"
                 }
                }
               }
              },
              "would_clear": {
               "type": "array",
               "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                 "type",
                 "ok",
                 "detail"
                ],
                "properties": {
                 "type": {
                  "type": "string"
                 },
                 "ok": {
                  "type": "boolean"
                 },
                 "detail": {
                  "type": "string"
                 },
                 "screens": {
                  "type": "integer",
                  "description": "Screens showing that data source now"
                 }
                }
               }
              },
              "notes": {
               "type": "array",
               "items": {
                "type": "string"
               }
              }
             }
            }
           ]
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     }
    }
   }
  },
  "/screens/import": {
   "post": {
    "operationId": "importScreens",
    "tags": [
     "screens"
    ],
    "summary": "W5.13 (ONB-08): screens from a CSV (name, site, zone, tags, orientation, rotation, resolution), each with an enrolment code valid 1–14 days. dry_run checks only; otherwise all or nothing. Needs a fresh sign-in; takes no Idempotency-Key",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "csv"
        ],
        "properties": {
         "csv": {
          "type": "string",
          "maxLength": 262144
         },
         "dry_run": {
          "type": "boolean"
         },
         "valid_days": {
          "type": "integer",
          "minimum": 1,
          "maximum": 14,
          "default": 7
         },
         "name": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 120
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Checked (dry run)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "dry_run",
            "ok",
            "problems",
            "screens",
            "create",
            "existing"
           ],
           "properties": {
            "dry_run": {
             "type": "boolean"
            },
            "ok": {
             "type": "boolean"
            },
            "problems": {
             "type": "array",
             "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
               "row",
               "column",
               "message"
              ],
              "properties": {
               "row": {
                "type": "integer"
               },
               "column": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "message": {
                "type": "string"
               }
              }
             }
            },
            "screens": {
             "type": "array",
             "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
               "row",
               "action",
               "name",
               "site_id",
               "site",
               "zone_id",
               "zone",
               "tags",
               "orientation",
               "rotation",
               "resolution",
               "screen_id"
              ],
              "properties": {
               "row": {
                "type": "integer"
               },
               "action": {
                "enum": [
                 "create",
                 "existing"
                ]
               },
               "name": {
                "type": "string"
               },
               "site_id": {
                "type": "string"
               },
               "site": {
                "type": "string"
               },
               "zone_id": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "zone": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "tags": {
                "type": "array",
                "items": {
                 "type": "string"
                }
               },
               "orientation": {
                "enum": [
                 "landscape",
                 "portrait"
                ]
               },
               "rotation": {
                "enum": [
                 0,
                 90,
                 180,
                 270
                ]
               },
               "resolution": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "screen_id": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "code": {
                "type": "string",
                "description": "Only when created: shown once"
               }
              }
             }
            },
            "create": {
             "type": "integer"
            },
            "existing": {
             "type": "integer"
            },
            "batch": {
             "$ref": "#/components/schemas/EnrollmentBatch"
            }
           }
          }
         }
        }
       }
      }
     },
     "201": {
      "description": "Created, with the codes (shown once)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "dry_run",
            "ok",
            "problems",
            "screens",
            "create",
            "existing"
           ],
           "properties": {
            "dry_run": {
             "type": "boolean"
            },
            "ok": {
             "type": "boolean"
            },
            "problems": {
             "type": "array",
             "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
               "row",
               "column",
               "message"
              ],
              "properties": {
               "row": {
                "type": "integer"
               },
               "column": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "message": {
                "type": "string"
               }
              }
             }
            },
            "screens": {
             "type": "array",
             "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
               "row",
               "action",
               "name",
               "site_id",
               "site",
               "zone_id",
               "zone",
               "tags",
               "orientation",
               "rotation",
               "resolution",
               "screen_id"
              ],
              "properties": {
               "row": {
                "type": "integer"
               },
               "action": {
                "enum": [
                 "create",
                 "existing"
                ]
               },
               "name": {
                "type": "string"
               },
               "site_id": {
                "type": "string"
               },
               "site": {
                "type": "string"
               },
               "zone_id": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "zone": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "tags": {
                "type": "array",
                "items": {
                 "type": "string"
                }
               },
               "orientation": {
                "enum": [
                 "landscape",
                 "portrait"
                ]
               },
               "rotation": {
                "enum": [
                 0,
                 90,
                 180,
                 270
                ]
               },
               "resolution": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "screen_id": {
                "type": [
                 "string",
                 "null"
                ]
               },
               "code": {
                "type": "string",
                "description": "Only when created: shown once"
               }
              }
             }
            },
            "create": {
             "type": "integer"
            },
            "existing": {
             "type": "integer"
            },
            "batch": {
             "$ref": "#/components/schemas/EnrollmentBatch"
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/enrollment-batches": {
   "get": {
    "operationId": "listEnrollmentBatches",
    "tags": [
     "screens"
    ],
    "summary": "The newest bulk enrolments and how many of their screens are set up",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Batches",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/EnrollmentBatch"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/enrollment-batches/{batch}": {
   "parameters": [
    {
     "name": "batch",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^enb_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "get": {
    "operationId": "getEnrollmentBatch",
    "tags": [
     "screens"
    ],
    "summary": "One bulk enrolment with each screen's state (never its code)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "The batch",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EnrollmentBatch"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/enrollment-batches/{batch}/revoke": {
   "parameters": [
    {
     "name": "batch",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^enb_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "post": {
    "operationId": "revokeEnrollmentBatch",
    "tags": [
     "screens"
    ],
    "summary": "Its unused codes stop working",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Revoked",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/EnrollmentBatch"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/roles": {
   "get": {
    "operationId": "listRoles",
    "tags": [
     "members"
    ],
    "summary": "W5.14 (TEN-05): the roles this organisation can give, built-in and its own (archived ones with archived=1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "archived",
      "in": "query",
      "schema": {
       "type": "boolean"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Roles",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Role"
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createRole",
    "tags": [
     "members"
    ],
    "summary": "Make a role from the catalogue (role.manage, fresh sign-in): only permissions you have",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60
         },
         "description": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "permissions": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "minItems": 1,
          "maxItems": 100,
          "description": "From GET /permissions, and only ones you have"
         }
        },
        "required": [
         "name",
         "permissions"
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Made",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Role"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/roles/{role}": {
   "parameters": [
    {
     "name": "role",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^c_[0-9a-f]{32}$"
     }
    }
   ],
   "patch": {
    "operationId": "updateRole",
    "tags": [
     "members"
    ],
    "summary": "Change one of the organisation's roles (only one whose permissions you all have); applies at once",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60
         },
         "description": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "permissions": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "minItems": 1,
          "maxItems": 100,
          "description": "From GET /permissions, and only ones you have"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Role"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "archiveRole",
    "tags": [
     "members"
    ],
    "summary": "Archive one of the organisation's roles, once nobody has it and no open invitation offers it",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/permissions": {
   "get": {
    "operationId": "listPermissions",
    "tags": [
     "members"
    ],
    "summary": "The permission catalogue an organisation's roles are made from, and which of them you have",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Permissions",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "key",
             "description",
             "privileged",
             "yours"
            ],
            "properties": {
             "key": {
              "type": "string"
             },
             "description": {
              "type": "string"
             },
             "privileged": {
              "type": "boolean"
             },
             "yours": {
              "type": "boolean"
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/event-types": {
   "get": {
    "operationId": "listEventTypes",
    "tags": [
     "integrations"
    ],
    "summary": "The event catalog: every type, what it means and the fields of its data (W5.15, API-06)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The catalog",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "version"
         ],
         "properties": {
          "version": {
           "type": "string"
          },
          "data": {
           "type": "array",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "type",
             "description",
             "data",
             "security",
             "email"
            ],
            "properties": {
             "type": {
              "type": "string"
             },
             "description": {
              "type": "string"
             },
             "data": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "security": {
              "type": "boolean",
              "description": "Followed by webhook only by someone who reads the audit log"
             },
             "email": {
              "type": "boolean",
              "description": "Email channels can follow it"
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/events": {
   "get": {
    "operationId": "listEvents",
    "tags": [
     "integrations"
    ],
    "summary": "The event feed: catalog events in order, from a cursor (W5.15, API-06); also at /api/integrations/v1/events with an events.read API key",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "next_after of the previous page"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "format": "date-time"
      },
      "description": "First page only: from this time (default the last 24 hours)"
     },
     {
      "name": "types",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated event types (default all)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 500
      },
      "description": "At most 500"
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "json",
        "ndjson"
       ]
      },
      "description": "json (default) or ndjson"
     }
    ],
    "responses": {
     "200": {
      "description": "Events, oldest first",
      "headers": {
       "UDD-Next-After": {
        "description": "Continue with ?after=",
        "schema": {
         "type": "string"
        }
       },
       "UDD-More": {
        "description": "true when more are ready now",
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "next_after",
          "more"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/CatalogEvent"
           }
          },
          "next_after": {
           "type": "string"
          },
          "more": {
           "type": "boolean"
          }
         }
        }
       },
       "application/x-ndjson": {
        "schema": {
         "type": "string",
         "description": "One event per line"
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/security-log/export": {
   "get": {
    "operationId": "exportSecurityLog",
    "tags": [
     "integrations"
    ],
    "summary": "The security log for a SIEM: audit events about access and protection (and every failure or denial) and the platform's security events about this organisation, as JSON lines or RFC 5424 syslog (W5.15, SEC-17); also at /api/integrations/v1/security-log/export with a security.export API key",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "after",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "UDD-Next-After of the previous call"
     },
     {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "format": "date-time"
      },
      "description": "First call only: from this time"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 2000
      },
      "description": "At most 2000 of each source"
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "json",
        "syslog"
       ]
      },
      "description": "json (default, NDJSON) or syslog"
     }
    ],
    "responses": {
     "200": {
      "description": "Records, oldest first within each call (a platform security event waits a minute, so it can come after newer audit records); the first call (no cursor) is audited",
      "headers": {
       "UDD-Next-After": {
        "description": "Continue with ?after=",
        "schema": {
         "type": "string"
        }
       },
       "UDD-Events": {
        "description": "Records in this call",
        "schema": {
         "type": "string"
        }
       },
       "UDD-More": {
        "description": "true when more are ready now",
        "schema": {
         "type": "string"
        }
       }
      },
      "content": {
       "application/x-ndjson": {
        "schema": {
         "type": "string",
         "description": "One JSON object per line"
        }
       },
       "text/plain": {
        "schema": {
         "type": "string",
         "description": "One RFC 5424 syslog line per record"
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/notification-channels/{channel}/deliveries/{delivery}/redeliver": {
   "parameters": [
    {
     "name": "channel",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    },
    {
     "name": "delivery",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "post": {
    "operationId": "redeliverNotification",
    "tags": [
     "fleet"
    ],
    "summary": "Send a webhook delivery again: a new delivery of the same event, with the same X-UDD-Event-Id (W5.15, API-05)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "id",
            "status"
           ],
           "properties": {
            "id": {
             "type": "string"
            },
            "status": {
             "enum": [
              "PENDING"
             ]
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     },
     "402": {
      "$ref": "#/components/responses/PaymentRequired"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/templates": {
   "get": {
    "operationId": "listTemplates",
    "tags": [
     "content"
    ],
    "summary": "Layout templates and blocks: the platform's and the organisation's (W5.16)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "kind",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "LAYOUT",
        "BLOCK"
       ]
      }
     },
     {
      "name": "archived",
      "in": "query",
      "required": false,
      "schema": {
       "type": "boolean"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Templates",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/ContentTemplate"
           }
          }
         }
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "createTemplate",
    "tags": [
     "content"
    ],
    "summary": "Save a layout (draft_id or layout_id; brand.manage) or widgets (a block; layout.write) as the organisation's template",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "kind",
         "name"
        ],
        "properties": {
         "kind": {
          "enum": [
           "LAYOUT",
           "BLOCK"
          ]
         },
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "description": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "category": {
          "enum": [
           "basics",
           "reception",
           "corporate",
           "food",
           "retail",
           "manufacturing",
           "education",
           "healthcare",
           "data",
           "other"
          ]
         },
         "brand_locked": {
          "type": "boolean"
         },
         "draft_id": {
          "type": "string"
         },
         "layout_id": {
          "type": "string"
         },
         "width": {
          "type": "integer"
         },
         "height": {
          "type": "integer"
         },
         "widgets": {
          "type": "array",
          "maxItems": 100
         },
         "styles": {
          "type": "object"
         },
         "dataSources": {
          "type": "array"
         },
         "fonts": {
          "type": "array"
         },
         "defaultLocale": {
          "type": "string"
         },
         "locales": {
          "type": "array"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Saved",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ContentTemplate"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/templates/{template}": {
   "parameters": [
    {
     "name": "template",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^(platform:[a-z0-9-]{1,60}|tpl_[0-9a-f-]{36})$"
     }
    }
   ],
   "get": {
    "operationId": "getTemplate",
    "tags": [
     "content"
    ],
    "summary": "A template with its content, the brand kit applied (?branded=0: as saved)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "branded",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "0",
        "1"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The template",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ContentTemplate"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "patch": {
    "operationId": "updateTemplate",
    "tags": [
     "content"
    ],
    "summary": "Rename, describe, recategorise or (layouts) lock to the brand; not the platform's",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "maxLength": 120
         },
         "description": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 500
         },
         "category": {
          "enum": [
           "basics",
           "reception",
           "corporate",
           "food",
           "retail",
           "manufacturing",
           "education",
           "healthcare",
           "data",
           "other"
          ]
         },
         "brand_locked": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ContentTemplate"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "delete": {
    "operationId": "archiveTemplate",
    "tags": [
     "content"
    ],
    "summary": "Archive: no longer offered; layouts made from it keep what they have",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/brand-kit": {
   "get": {
    "operationId": "getBrandKit",
    "tags": [
     "content"
    ],
    "summary": "The brand kit (W5.16, CMS-19)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The kit (empty colours when none is set)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/BrandKit"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "saveBrandKit",
    "tags": [
     "content"
    ],
    "summary": "Set the whole brand kit (brand.manage)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "colors",
         "heading_font",
         "body_font",
         "logo_asset_id"
        ],
        "properties": {
         "colors": {
          "type": "object"
         },
         "heading_font": {
          "oneOf": [
           {
            "type": "null"
           },
           {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "asset_id",
             "family"
            ],
            "properties": {
             "asset_id": {
              "type": "string"
             },
             "family": {
              "type": "string",
              "pattern": "^[A-Za-z0-9 _-]{1,64}$"
             }
            }
           }
          ]
         },
         "body_font": {
          "oneOf": [
           {
            "type": "null"
           },
           {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "asset_id",
             "family"
            ],
            "properties": {
             "asset_id": {
              "type": "string"
             },
             "family": {
              "type": "string",
              "pattern": "^[A-Za-z0-9 _-]{1,64}$"
             }
            }
           }
          ]
         },
         "logo_asset_id": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Saved",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/BrandKit"
          }
         }
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/layout-drafts/{draft}/brand-lock": {
   "parameters": [
    {
     "name": "draft",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     }
    }
   ],
   "put": {
    "operationId": "setLayoutBrandLock",
    "tags": [
     "content"
    ],
    "summary": "Lock the layout to the brand, or unlock it (brand.manage; CMS-22)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "locked"
        ],
        "properties": {
         "locked": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The draft",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/LayoutDraftFull"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/asset-folders/{folder}/sharing": {
   "parameters": [
    {
     "name": "folder",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     }
    }
   ],
   "get": {
    "operationId": "getFolderSharing",
    "tags": [
     "assets"
    ],
    "summary": "Whether a folder is restricted and who it is shared with (folder.share; W5.17, CMS-26)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Sharing",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data",
          "people"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/FolderSharing"
          },
          "people": {
           "type": "array",
           "description": "Who it can be shared with: the organisation's active people",
           "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "user_id",
             "email",
             "name",
             "role",
             "external"
            ],
            "properties": {
             "user_id": {
              "type": "string"
             },
             "email": {
              "type": "string"
             },
             "name": {
              "type": [
               "string",
               "null"
              ]
             },
             "role": {
              "type": [
               "string",
               "null"
              ]
             },
             "external": {
              "type": "boolean"
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "shareFolder",
    "tags": [
     "assets"
    ],
    "summary": "Restrict a folder (or not) and set who it is shared with, to READ or WRITE; covers the folders inside it",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "restricted",
         "members"
        ],
        "properties": {
         "restricted": {
          "type": "boolean"
         },
         "members": {
          "type": "array",
          "maxItems": 100,
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "user_id",
            "access"
           ],
           "properties": {
            "user_id": {
             "type": "string"
            },
            "access": {
             "enum": [
              "READ",
              "WRITE"
             ]
            }
           }
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Shared",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/FolderSharing"
          }
         }
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/widgets": {
   "get": {
    "operationId": "listWidgets",
    "tags": [
     "content"
    ],
    "summary": "W5.20 (ADR-079): HTML widgets (apps), every version (?archived=1: archived ones too)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "archived",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "0",
        "1"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The versions",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Widget"
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "post": {
    "operationId": "uploadWidget",
    "tags": [
     "content"
    ],
    "summary": "Upload a widget: a ZIP file with index.html (and widget.json: name, version, fields); checked, malware-scanned; with widget_id a new version of that widget",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         },
         "widget_id": {
          "type": "string"
         },
         "name": {
          "type": "string",
          "maxLength": 120
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Widget"
          }
         }
        }
       }
      }
     },
     "200": {
      "description": "This exact file is already a version",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Widget"
          }
         }
        }
       }
      }
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   }
  },
  "/widgets/{widget}": {
   "parameters": [
    {
     "name": "widget",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^wdg_[0-9a-f-]{36}$"
     }
    }
   ],
   "get": {
    "operationId": "getWidget",
    "tags": [
     "content"
    ],
    "summary": "A widget's newest version",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The version",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Widget"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/widgets/{widget}/archive": {
   "parameters": [
    {
     "name": "widget",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^wdg_[0-9a-f-]{36}$"
     }
    }
   ],
   "post": {
    "operationId": "archiveWidget",
    "tags": [
     "content"
    ],
    "summary": "Archive a version (out of pickers; layouts and releases keep it), or ?restore=1",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "version",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "A version (default: the newest)"
     },
     {
      "name": "restore",
      "in": "query",
      "required": false,
      "schema": {
       "enum": [
        "0",
        "1"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Widget"
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/widgets/{widget}/preview": {
   "parameters": [
    {
     "name": "widget",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^wdg_[0-9a-f-]{36}$"
     }
    }
   ],
   "post": {
    "operationId": "previewWidget",
    "tags": [
     "content"
    ],
    "summary": "A link (an hour) to look at a version as screens show it, in a sandbox with no network",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "version",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "A version (default: the newest)"
     }
    ],
    "responses": {
     "200": {
      "description": "The link",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "url",
            "expires_at"
           ],
           "properties": {
            "url": {
             "type": "string",
             "description": "The folder of its files (index.html first), at a signed link"
            },
            "expires_at": {
             "type": "string",
             "format": "date-time"
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/sso": {
   "get": {
    "operationId": "getSso",
    "tags": [
     "identity"
    ],
    "summary": "W5.21 (ADR-080): the organisation's single sign-on, what its identity provider needs, and its domains",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The settings",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "putSso",
    "tags": [
     "identity"
    ],
    "summary": "Set up or change single sign-on: the provider (SAML metadata by address or XML; or an OpenID Connect issuer, client id and secret) and its rules. Needs a recent sign-in (403 reauth-required otherwise, ADR-060).",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "provider": {
          "type": "object",
          "required": [
           "protocol"
          ],
          "additionalProperties": false,
          "properties": {
           "protocol": {
            "enum": [
             "saml",
             "oidc"
            ]
           },
           "metadata_url": {
            "type": [
             "string",
             "null"
            ],
            "description": "SAML: a public https address of the metadata"
           },
           "metadata_xml": {
            "type": [
             "string",
             "null"
            ],
            "maxLength": 500000
           },
           "issuer": {
            "type": [
             "string",
             "null"
            ]
           },
           "client_id": {
            "type": [
             "string",
             "null"
            ]
           },
           "client_secret": {
            "type": [
             "string",
             "null"
            ],
            "description": "Kept by the sign-in service only; leave out to keep the one it has"
           }
          }
         },
         "display_name": {
          "type": "string",
          "maxLength": 60
         },
         "enabled": {
          "type": "boolean"
         },
         "required": {
          "type": "boolean"
         },
         "owners_may_use_password": {
          "type": "boolean"
         },
         "trust_mfa": {
          "type": "boolean"
         },
         "join_role": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "201": {
      "description": "Set up",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     },
     "503": {
      "$ref": "#/components/responses/ServiceUnavailable"
     }
    }
   },
   "delete": {
    "operationId": "deleteSso",
    "tags": [
     "identity"
    ],
    "summary": "Remove single sign-on (not while signed in through it). Needs a recent sign-in (403 reauth-required otherwise, ADR-060).",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Removed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "502": {
      "$ref": "#/components/responses/BadGateway"
     }
    }
   }
  },
  "/sso/domains": {
   "post": {
    "operationId": "addSsoDomain",
    "tags": [
     "identity"
    ],
    "summary": "Add a domain the organisation owns (shown with a DNS TXT record, then verified). Needs a recent sign-in (403 reauth-required otherwise, ADR-060).",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "domain"
        ],
        "properties": {
         "domain": {
          "type": "string",
          "maxLength": 300
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Already there",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "201": {
      "description": "Added",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/sso/domains/{domain}/verify": {
   "parameters": [
    {
     "name": "domain",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dom_[0-9a-f-]{36}$"
     }
    }
   ],
   "post": {
    "operationId": "verifySsoDomain",
    "tags": [
     "identity"
    ],
    "summary": "Check the domain's TXT record; verified, work addresses there find the organisation's single sign-on",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Verified",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    }
   }
  },
  "/sso/domains/{domain}": {
   "parameters": [
    {
     "name": "domain",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^dom_[0-9a-f-]{36}$"
     }
    }
   ],
   "delete": {
    "operationId": "removeSsoDomain",
    "tags": [
     "identity"
    ],
    "summary": "Remove a domain. Needs a recent sign-in (403 reauth-required otherwise, ADR-060).",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Removed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/SsoSettings"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/analytics": {
   "get": {
    "operationId": "getAnalytics",
    "tags": [
     "reports"
    ],
    "summary": "W5.22 (ADR-081): totals against the period before, play time per day, the week by hour, longest on screen, sites, screens offline most; at most 400 days",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "description": "First day (YYYY-MM-DD); default 29 days before to",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "description": "Last day, included; default today (UTC)",
      "schema": {
       "type": "string",
       "format": "date"
      }
     },
     {
      "name": "site_id",
      "in": "query",
      "required": false,
      "description": "Only screens at this site",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "group_id",
      "in": "query",
      "required": false,
      "description": "Only screens in this screen group",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Analytics",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Analytics"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   }
  },
  "/analytics/digest": {
   "get": {
    "operationId": "getAnalyticsDigest",
    "tags": [
     "reports"
    ],
    "summary": "Whether I get the weekly summary by email",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The person's weekly summary",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AnalyticsDigest"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "put": {
    "operationId": "subscribeAnalyticsDigest",
    "tags": [
     "reports"
    ],
    "summary": "Email me a weekly summary (Mondays 08:00 in my time zone)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The person's weekly summary",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AnalyticsDigest"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   },
   "delete": {
    "operationId": "unsubscribeAnalyticsDigest",
    "tags": [
     "reports"
    ],
    "summary": "Stop the weekly summary",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "The person's weekly summary",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/AnalyticsDigest"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     }
    }
   }
  },
  "/reseller": {
   "get": {
    "operationId": "getReseller",
    "tags": [
     "partners"
    ],
    "summary": "W5.23 (TEN-10, ADR-082): the partner: its limits, what it uses, the plans it may give, its branding",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "The partner",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Reseller"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reseller/organisations": {
   "get": {
    "operationId": "listResellerOrganisations",
    "tags": [
     "partners"
    ],
    "summary": "The partner's organisations",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "Its organisations",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/ResellerOrganisation"
           }
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "post": {
    "operationId": "createResellerOrganisation",
    "tags": [
     "partners"
    ],
    "summary": "A new organisation for a customer, on a plan the partner may give and within its limits; its first owner is invited (409 partner-limit)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "201": {
      "description": "Made",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ResellerOrganisation"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "name": {
          "type": "string",
          "minLength": 2,
          "maxLength": 100
         },
         "owner_email": {
          "type": "string",
          "maxLength": 254
         },
         "plan": {
          "type": "string"
         }
        },
        "required": [
         "name",
         "owner_email",
         "plan"
        ]
       }
      }
     }
    }
   }
  },
  "/reseller/organisations/{tenant}": {
   "patch": {
    "operationId": "updateResellerOrganisation",
    "tags": [
     "partners"
    ],
    "summary": "Suspend or resume one of its organisations (a reason to suspend), or move it to another plan it may give",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     },
     {
      "name": "tenant",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changed",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ResellerOrganisation"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "status": {
          "enum": [
           "active",
           "suspended"
          ]
         },
         "reason": {
          "type": [
           "string",
           "null"
          ],
          "maxLength": 300
         },
         "plan": {
          "type": "string"
         }
        }
       }
      }
     }
    }
   }
  },
  "/reseller/team": {
   "get": {
    "operationId": "getResellerTeam",
    "tags": [
     "partners"
    ],
    "summary": "The partner's people and open invitations",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "Its team",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ResellerTeam"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reseller/team/invitations": {
   "post": {
    "operationId": "inviteToReseller",
    "tags": [
     "partners"
    ],
    "summary": "Invite someone to the partner's team (owners)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "201": {
      "description": "Invited",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/ResellerInvitation"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "email": {
          "type": "string",
          "maxLength": 254
         },
         "role": {
          "enum": [
           "owner",
           "admin"
          ]
         }
        },
        "required": [
         "email",
         "role"
        ]
       }
      }
     }
    }
   }
  },
  "/reseller/team/invitations/{invitation}": {
   "delete": {
    "operationId": "revokeResellerInvitation",
    "tags": [
     "partners"
    ],
    "summary": "Withdraw an invitation (owners)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     },
     {
      "name": "invitation",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^rinv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "204": {
      "description": "Withdrawn"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reseller/team/members/{user}": {
   "delete": {
    "operationId": "removeResellerMember",
    "tags": [
     "partners"
    ],
    "summary": "Remove someone from the partner (owners; the last owner stays: 409)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     },
     {
      "name": "user",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     }
    ],
    "responses": {
     "204": {
      "description": "Removed"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/reseller/branding": {
   "put": {
    "operationId": "putResellerBranding",
    "tags": [
     "partners"
    ],
    "summary": "Set the partner's branding: product name, logo (PNG, JPEG or WebP data URL, at most 200 KB and 2000 px), colour, support contact",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "The partner",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Reseller"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "product_name": {
          "type": "string",
          "maxLength": 40
         },
         "logo": {
          "type": [
           "string",
           "null"
          ]
         },
         "colour": {
          "type": [
           "string",
           "null"
          ]
         },
         "support_email": {
          "type": [
           "string",
           "null"
          ]
         },
         "support_url": {
          "type": [
           "string",
           "null"
          ]
         }
        },
        "required": [
         "product_name"
        ]
       }
      }
     }
    }
   },
   "delete": {
    "operationId": "deleteResellerBranding",
    "tags": [
     "partners"
    ],
    "summary": "Remove the partner's branding",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "The partner",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Reseller"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reseller-invitations/accept": {
   "post": {
    "operationId": "acceptResellerInvitation",
    "tags": [
     "partners"
    ],
    "summary": "Join a partner's team as the signed-in person (the invited address)",
    "parameters": [],
    "responses": {
     "200": {
      "description": "Joined",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "reseller": {
             "type": "object",
             "additionalProperties": false,
             "properties": {
              "id": {
               "type": "string",
               "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
              },
              "name": {
               "type": "string"
              }
             }
            }
           }
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "token": {
          "type": "string"
         }
        },
        "required": [
         "token"
        ]
       }
      }
     }
    }
   }
  },
  "/partner-access": {
   "get": {
    "operationId": "getPartnerAccess",
    "tags": [
     "accounts"
    ],
    "summary": "W5.23 (ADR-082): the organisation's partner, and whether its people may open the organisation",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     }
    ],
    "responses": {
     "200": {
      "description": "Partner access",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/PartnerAccess"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "putPartnerAccess",
    "tags": [
     "accounts"
    ],
    "summary": "Let the partner's people in, or not (owners; 409 no-partner)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "Partner access",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "$ref": "#/components/schemas/PartnerAccess"
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "partner_access": {
          "type": "boolean"
         }
        },
        "required": [
         "partner_access"
        ]
       }
      }
     }
    }
   }
  },
  "/plan/free": {
   "post": {
    "operationId": "chooseFreePlan",
    "tags": [
     "accounts"
    ],
    "summary": "W5.23 (TEN-11): a trial (running or ended) continues on the free plan (owners; 409 not-trial or too-many-screens)",
    "parameters": [
     {
      "$ref": "#/components/parameters/TenantId"
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "200": {
      "description": "On the free plan",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "type": "object",
           "additionalProperties": false,
           "properties": {
            "plan": {
             "enum": [
              "free"
             ]
            },
            "status": {
             "enum": [
              "active"
             ]
            },
            "screens": {
             "type": "integer"
            }
           }
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     }
    }
   }
  },
  "/reseller/domain": {
   "get": {
    "operationId": "getResellerDomain",
    "tags": [
     "partners"
    ],
    "summary": "W5.24: the partner's own address and the DNS records it needs (null: none)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "The address",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "oneOf": [
            {
             "$ref": "#/components/schemas/PartnerDomain"
            },
            {
             "type": "null"
            }
           ]
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   },
   "put": {
    "operationId": "putResellerDomain",
    "tags": [
     "partners"
    ],
    "summary": "Use an address of the partner's own (owners; a subdomain such as signage.partner.com). A new address waits for DNS",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "hostname": {
          "type": "string",
          "maxLength": 253
         }
        },
        "required": [
         "hostname"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The address",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "oneOf": [
            {
             "$ref": "#/components/schemas/PartnerDomain"
            },
            {
             "type": "null"
            }
           ]
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "422": {
      "$ref": "#/components/responses/Unprocessable"
     }
    }
   },
   "delete": {
    "operationId": "deleteResellerDomain",
    "tags": [
     "partners"
    ],
    "summary": "Stop using the address (owners)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "204": {
      "description": "Removed"
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     }
    }
   }
  },
  "/reseller/domain/check": {
   "post": {
    "operationId": "checkResellerDomain",
    "tags": [
     "partners"
    ],
    "summary": "Check the DNS records now: the address works once both are found (409 domain-taken if another partner proved it first)",
    "parameters": [
     {
      "$ref": "#/components/parameters/ResellerId"
     }
    ],
    "responses": {
     "200": {
      "description": "The address",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": false,
         "properties": {
          "data": {
           "oneOf": [
            {
             "$ref": "#/components/schemas/PartnerDomain"
            },
            {
             "type": "null"
            }
           ]
          }
         },
         "required": [
          "data"
         ]
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/BadRequest"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "409": {
      "$ref": "#/components/responses/Conflict"
     },
     "429": {
      "$ref": "#/components/responses/TooManyRequests"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "keycloak": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "JWT",
    "description": "Keycloak access token (OIDC, PKCE client udd-admin-web), audience udd-api, lifetime 15 minutes (TEN-08)."
   }
  },
  "parameters": {
   "TenantId": {
    "name": "X-Tenant-Id",
    "in": "header",
    "required": true,
    "schema": {
     "type": "string",
     "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    },
    "description": "Tenant to act in; you need a membership in it (ADR-017)."
   },
   "IdempotencyKey": {
    "name": "Idempotency-Key",
    "in": "header",
    "required": false,
    "schema": {
     "type": "string",
     "minLength": 1,
     "maxLength": 255
    },
    "description": "Retry-safe POST: the first 2xx response is replayed for the same key and body; a different body is 409."
   },
   "Cursor": {
    "name": "cursor",
    "in": "query",
    "required": false,
    "schema": {
     "type": "string"
    }
   },
   "Limit": {
    "name": "limit",
    "in": "query",
    "required": false,
    "schema": {
     "type": "integer",
     "minimum": 1,
     "maximum": 100,
     "default": 25
    }
   },
   "ResellerId": {
    "name": "X-Reseller-Id",
    "in": "header",
    "required": true,
    "schema": {
     "type": "string",
     "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    },
    "description": "W5.23 (ADR-082): the partner to act for; you need to be one of its people."
   }
  },
  "responses": {
   "BadRequest": {
    "description": "Missing X-Tenant-Id or a malformed Idempotency-Key",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "Unauthorized": {
    "description": "Missing, expired or invalid bearer token",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "Forbidden": {
    "description": "Your role lacks the permission named in `permission`",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "NotFound": {
    "description": "No such resource, or no access to it (indistinguishable by design)",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "Conflict": {
    "description": "Resource still in use, or Idempotency-Key reused for a different request",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "Unprocessable": {
    "description": "Validation failed; see `errors`",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "BadGateway": {
    "description": "The release signer returned something the API does not trust",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "ServiceUnavailable": {
    "description": "The release signer is not reachable or not configured",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   },
   "TooManyRequests": {
    "description": "Too many requests",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    },
    "headers": {
     "RateLimit-Limit": {
      "$ref": "#/components/headers/RateLimit-Limit"
     },
     "RateLimit-Remaining": {
      "$ref": "#/components/headers/RateLimit-Remaining"
     },
     "RateLimit-Reset": {
      "$ref": "#/components/headers/RateLimit-Reset"
     },
     "Retry-After": {
      "$ref": "#/components/headers/Retry-After"
     }
    }
   },
   "PaymentRequired": {
    "description": "The organisation's trial has ended: reads still work, changes are refused until it is turned on (W3.4).",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   }
  },
  "schemas": {
   "Site": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "timezone": {
      "type": "string",
      "description": "IANA zone, default Asia/Kolkata"
     },
     "address": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "latitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -90,
      "maximum": 90,
      "description": "Where the site is (W4.2), to match an alert's area"
     },
     "longitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -180,
      "maximum": 180
     }
    },
    "required": [
     "id",
     "name",
     "timezone",
     "address",
     "created_at",
     "updated_at",
     "latitude",
     "longitude"
    ],
    "additionalProperties": false
   },
   "SiteCreate": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "timezone": {
      "type": "string"
     },
     "address": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 500
     },
     "latitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -90,
      "maximum": 90
     },
     "longitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -180,
      "maximum": 180
     }
    },
    "required": [
     "name"
    ],
    "additionalProperties": false
   },
   "SiteUpdate": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "timezone": {
      "type": "string"
     },
     "address": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 500
     },
     "latitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -90,
      "maximum": 90
     },
     "longitude": {
      "type": [
       "number",
       "null"
      ],
      "minimum": -180,
      "maximum": 180
     }
    },
    "required": [],
    "additionalProperties": false
   },
   "Zone": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "site_id": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "reserved_from_ads": {
      "type": "boolean",
      "description": "W5.6 (ADV-03): an operational zone advertising campaigns never reach"
     }
    },
    "required": [
     "id",
     "site_id",
     "name",
     "created_at",
     "updated_at"
    ],
    "additionalProperties": false
   },
   "ZoneCreate": {
    "type": "object",
    "properties": {
     "site_id": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     }
    },
    "required": [
     "site_id",
     "name"
    ],
    "additionalProperties": false
   },
   "ZoneUpdate": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "reserved_from_ads": {
      "type": "boolean"
     }
    },
    "required": [],
    "additionalProperties": false
   },
   "Screen": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "site_id": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "zone_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "orientation": {
      "enum": [
       "landscape",
       "portrait"
      ]
     },
     "rotation": {
      "type": "integer",
      "enum": [
       0,
       90,
       180,
       270
      ],
      "description": "W3.9d: degrees the screen's picture is turned clockwise (90 and 270: portrait). Changeable at any time; the player follows within a sync."
     },
     "resolution": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9]{3,5}x[0-9]{3,5}$"
     },
     "tags": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     }
    },
    "required": [
     "id",
     "site_id",
     "zone_id",
     "name",
     "orientation",
     "rotation",
     "resolution",
     "tags",
     "created_at",
     "updated_at"
    ],
    "additionalProperties": false
   },
   "ScreenCreate": {
    "type": "object",
    "properties": {
     "site_id": {
      "type": "string",
      "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "zone_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "orientation": {
      "enum": [
       "landscape",
       "portrait"
      ]
     },
     "rotation": {
      "type": "integer",
      "enum": [
       0,
       90,
       180,
       270
      ],
      "description": "W3.9d: degrees the screen's picture is turned clockwise (90 and 270: portrait). Changeable at any time; the player follows within a sync."
     },
     "resolution": {
      "type": [
       "string",
       "null"
      ]
     },
     "tags": {
      "type": "array",
      "maxItems": 20,
      "items": {
       "type": "string",
       "minLength": 1,
       "maxLength": 64
      }
     }
    },
    "required": [
     "site_id",
     "name"
    ],
    "additionalProperties": false
   },
   "ScreenPatch": {
    "type": "object",
    "description": "Changes to a screen (W3.9d: was mistakenly the Update screens result). A rotation sets the orientation too.",
    "properties": {
     "zone_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "orientation": {
      "enum": [
       "landscape",
       "portrait"
      ]
     },
     "rotation": {
      "type": "integer",
      "enum": [
       0,
       90,
       180,
       270
      ],
      "description": "W3.9d: degrees the screen's picture is turned clockwise (90 and 270: portrait). Changeable at any time; the player follows within a sync."
     },
     "resolution": {
      "type": [
       "string",
       "null"
      ]
     },
     "tags": {
      "type": "array",
      "maxItems": 20,
      "items": {
       "type": "string",
       "minLength": 1,
       "maxLength": 64
      }
     }
    },
    "additionalProperties": false
   },
   "ScreenUpdate": {
    "type": "object",
    "description": "W2.2.1: what Update screens did (or, in a dry run, would do)",
    "properties": {
     "mode": {
      "enum": [
       "publish",
       "request"
      ]
     },
     "dry_run": {
      "type": "boolean"
     },
     "layouts": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "name": {
         "type": "string"
        },
        "from": {
         "type": "string"
        },
        "from_version": {
         "type": [
          "integer",
          "null"
         ]
        },
        "id": {
         "type": [
          "string",
          "null"
         ],
         "description": "The new layout version (null in a dry run)"
        },
        "version": {
         "type": [
          "integer",
          "null"
         ],
         "description": "The new version number (also in a dry run: the number it would get)"
        },
        "problem": {
         "type": "string"
        }
       },
       "required": [
        "name",
        "from",
        "from_version",
        "id",
        "version"
       ],
       "additionalProperties": false
      }
     },
     "releases": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string",
         "description": "The release screens play now"
        },
        "sequence": {
         "type": "integer"
        },
        "targets": {
         "type": "object"
        },
        "release_id": {
         "type": "string",
         "description": "The new release (mode publish, not a dry run)"
        },
        "new_sequence": {
         "type": "integer"
        },
        "request_id": {
         "type": "string",
         "description": "The approval request (mode request, not a dry run)"
        },
        "screens": {
         "type": "integer",
         "description": "Screens that play it now or will"
        },
        "scheduled": {
         "type": "boolean",
         "description": "Starts later"
        },
        "ends_at": {
         "type": "string",
         "format": "date-time"
        },
        "problem": {
         "type": "string",
         "description": "Why it was not (or would not be) updated"
        },
        "older_players": {
         "type": "integer",
         "minimum": 1,
         "description": "W5.19: target screens whose players are too old for the new release (sound or a countdown needs player 1.22.0); they keep what they show"
        }
       },
       "required": [
        "id",
        "sequence",
        "targets",
        "screens",
        "scheduled",
        "ends_at"
       ],
       "additionalProperties": false
      },
      "description": "Live releases that get the playlist as it is now"
     },
     "up_to_date": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string",
         "description": "The release screens play now"
        },
        "sequence": {
         "type": "integer"
        },
        "targets": {
         "type": "object"
        },
        "release_id": {
         "type": "string",
         "description": "The new release (mode publish, not a dry run)"
        },
        "new_sequence": {
         "type": "integer"
        },
        "request_id": {
         "type": "string",
         "description": "The approval request (mode request, not a dry run)"
        },
        "older_players": {
         "type": "integer",
         "minimum": 1,
         "description": "W5.19: target screens whose players are too old for the new release (sound or a countdown needs player 1.22.0); they keep what they show"
        }
       },
       "required": [
        "id",
        "sequence",
        "targets"
       ],
       "additionalProperties": false
      },
      "description": "Live releases that already show it"
     },
     "waiting": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string",
         "description": "The release screens play now"
        },
        "sequence": {
         "type": "integer"
        },
        "targets": {
         "type": "object"
        },
        "release_id": {
         "type": "string",
         "description": "The new release (mode publish, not a dry run)"
        },
        "new_sequence": {
         "type": "integer"
        },
        "request_id": {
         "type": "string",
         "description": "The approval request (mode request, not a dry run)"
        },
        "screens": {
         "type": "integer",
         "description": "Screens that play it now or will"
        },
        "scheduled": {
         "type": "boolean",
         "description": "Starts later"
        },
        "ends_at": {
         "type": "string",
         "format": "date-time"
        },
        "problem": {
         "type": "string",
         "description": "Why it was not (or would not be) updated"
        },
        "older_players": {
         "type": "integer",
         "minimum": 1,
         "description": "W5.19: target screens whose players are too old for the new release (sound or a countdown needs player 1.22.0); they keep what they show"
        }
       },
       "required": [
        "id",
        "sequence",
        "targets",
        "screens",
        "scheduled",
        "ends_at"
       ],
       "additionalProperties": false
      },
      "description": "Releases with an Update screens request still waiting for approval"
     }
    },
    "required": [
     "mode",
     "dry_run",
     "layouts",
     "releases",
     "up_to_date",
     "waiting"
    ],
    "additionalProperties": false
   },
   "Device": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "screen_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "state": {
      "enum": [
       "unenrolled",
       "provisioning",
       "syncing",
       "verifying",
       "production",
       "offline",
       "maintenance",
       "quarantine",
       "recovery",
       "retired"
      ]
     },
     "platform": {
      "type": [
       "string",
       "null"
      ]
     },
     "model": {
      "type": [
       "string",
       "null"
      ]
     },
     "firmware": {
      "type": [
       "string",
       "null"
      ]
     },
     "player_version": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "key_thumbprint": {
      "type": [
       "string",
       "null"
      ],
      "description": "RFC 7638 thumbprint of the device's public key"
     },
     "last_seen_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "active_release_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "highest_sequence": {
      "type": "integer",
      "minimum": 0,
      "description": "Highest release sequence the device has accepted (anti-rollback, REL-04)"
     },
     "last_problem": {
      "type": [
       "string",
       "null"
      ],
      "description": "Last verification failure the device reported (quarantine reason)"
     },
     "device_control": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Remote actions the device reports it can do (capabilities.deviceControl); commands are accepted only for these (FLT-04)"
     },
     "last_command": {
      "description": "The device's newest remote action and its result (W1.6), or null",
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "id": {
          "type": "string",
          "pattern": "^cmd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
         },
         "command": {
          "enum": [
           "REBOOT",
           "REFRESH_CONTENT",
           "CLEAR_CACHE",
           "MAINTENANCE_OPEN",
           "MAINTENANCE_CLOSE",
           "DIAGNOSE"
          ]
         },
         "status": {
          "enum": [
           "pending",
           "delivered",
           "done",
           "failed",
           "refused",
           "expired"
          ],
          "description": "pending: waiting for the device; delivered: the device fetched it; done/failed: the device ran it; refused: it did not verify on the device; expired: never finished within 15 minutes"
         },
         "detail": {
          "type": [
           "string",
           "null"
          ],
          "description": "What the device reported"
         },
         "created_at": {
          "type": "string",
          "format": "date-time"
         },
         "expires_at": {
          "type": "string",
          "format": "date-time"
         },
         "finished_at": {
          "type": [
           "string",
           "null"
          ],
          "format": "date-time"
         }
        },
        "required": [
         "id",
         "command",
         "status",
         "detail",
         "created_at",
         "expires_at",
         "finished_at"
        ]
       }
      ]
     },
     "connectivity": {
      "enum": [
       "online",
       "late",
       "offline",
       "never"
      ],
      "description": "W3.1: online; late (missed a heartbeat); offline (missed the tenant's limit, FLT-05); never seen"
     },
     "offline_since": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "heartbeat_seconds": {
      "type": "integer",
      "minimum": 10,
      "maximum": 3600
     },
     "inventory": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "serial",
       "os_version",
       "network_type",
       "reported_address",
       "observed_address"
      ],
      "properties": {
       "serial": {
        "type": [
         "string",
         "null"
        ]
       },
       "os_version": {
        "type": [
         "string",
         "null"
        ]
       },
       "network_type": {
        "type": [
         "string",
         "null"
        ],
        "enum": [
         "ethernet",
         "wifi",
         "cellular",
         "other",
         "unknown",
         null
        ]
       },
       "reported_address": {
        "type": [
         "string",
         "null"
        ]
       },
       "observed_address": {
        "type": [
         "string",
         "null"
        ]
       }
      },
      "description": "FLT-01 (W3.1)"
     },
     "health": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "properties": {
       "cpu_percent": {
        "type": [
         "number",
         "null"
        ]
       },
       "memory_used_mb": {
        "type": [
         "integer",
         "null"
        ]
       },
       "memory_total_mb": {
        "type": [
         "integer",
         "null"
        ]
       },
       "storage_free_mb": {
        "type": [
         "integer",
         "null"
        ]
       },
       "storage_total_mb": {
        "type": [
         "integer",
         "null"
        ]
       },
       "temperature_c": {
        "type": [
         "number",
         "null"
        ]
       },
       "network_type": {
        "type": [
         "string",
         "null"
        ]
       },
       "uptime_seconds": {
        "type": [
         "integer",
         "null"
        ]
       }
      },
      "description": "FLT-02 (W3.1): latest health; null where the platform cannot tell"
     },
     "health_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "held": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "since",
       "reason"
      ],
      "properties": {
       "since": {
        "type": "string",
        "format": "date-time"
       },
       "reason": {
        "type": "string"
       }
      },
      "description": "W3.8a (SEC-03): held for a security check after an integrity failure; no content until a Security Administrator releases it"
     },
     "revoked": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "at",
       "reason"
      ],
      "properties": {
       "at": {
        "type": "string",
        "format": "date-time"
       },
       "reason": {
        "type": [
         "string",
         "null"
        ]
       }
      },
      "description": "W3.8a (SEC-02): revoked by an operator"
     },
     "key_created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "When the device's current key was enrolled or rotated (SEC-02)"
     },
     "lockdown": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "source",
       "controls",
       "at"
      ],
      "properties": {
       "source": {
        "type": "string",
        "enum": [
         "agent",
         "android",
         "browser"
        ]
       },
       "controls": {
        "type": "object",
        "additionalProperties": false,
        "description": "true: locked; false: open; absent: the player cannot tell",
        "properties": {
         "remote_shell": {
          "type": "boolean"
         },
         "inbound_firewall": {
          "type": "boolean"
         },
         "usb_storage": {
          "type": "boolean"
         },
         "radios": {
          "type": "boolean"
         },
         "kiosk": {
          "type": "boolean"
         },
         "virtual_terminals": {
          "type": "boolean"
         }
        }
       },
       "at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       }
      },
      "description": "W3.8b (SEC-06): the lockdown the player last reported"
     },
     "display": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "description": "W4.3: what the player made of its display schedule",
      "properties": {
       "power": {
        "enum": [
         "on",
         "off"
        ]
       },
       "volume": {
        "type": "integer"
       },
       "brightness": {
        "type": "integer"
       },
       "mode": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "power": {
          "enum": [
           "display",
           "software",
           "none"
          ]
         },
         "volume": {
          "enum": [
           "display",
           "software",
           "none"
          ]
         },
         "brightness": {
          "enum": [
           "display",
           "software",
           "none"
          ]
         }
        }
       },
       "reason": {
        "enum": [
         "schedule",
         "closed",
         "emergency",
         "always",
         "none"
        ]
       },
       "schedule_id": {
        "type": "string"
       },
       "error": {
        "type": "string"
       }
      }
     },
     "display_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "keys": {
      "description": "W4.4 (ADR-059): whether the player pins a root store and the newest key bundle it accepted; null before player 1.14.0.",
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "root",
       "bundle",
       "at"
      ],
      "properties": {
       "root": {
        "type": "boolean"
       },
       "bundle": {
        "type": [
         "integer",
         "null"
        ],
        "minimum": 1
       },
       "at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       }
      }
     },
     "maintenance_available": {
      "type": "boolean",
      "description": "W5.8 (SEC-04): the device can take remote maintenance sessions (a Linux player installed with the maintenance helper)."
     },
     "diagnostics": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "available",
       "screenshot"
      ],
      "description": "W5.11 (FLT-13, PLR-16): the player sends troubleshooting reports (1.20 and later), and can take a picture of its screen (a native player; a plain browser cannot).",
      "properties": {
       "available": {
        "type": "boolean"
       },
       "screenshot": {
        "type": "boolean"
       }
      }
     }
    },
    "required": [
     "active_release_id",
     "created_at",
     "device_control",
     "firmware",
     "highest_sequence",
     "id",
     "key_thumbprint",
     "last_command",
     "last_problem",
     "last_seen_at",
     "model",
     "platform",
     "player_version",
     "screen_id",
     "state",
     "updated_at"
    ],
    "additionalProperties": false
   },
   "AuditEvent": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^aud_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "seq": {
      "type": "integer",
      "minimum": 1
     },
     "time": {
      "type": "string",
      "format": "date-time"
     },
     "actor": {
      "type": "object",
      "properties": {
       "type": {
        "type": "string"
       },
       "id": {
        "type": [
         "string",
         "null"
        ]
       }
      },
      "required": [
       "type",
       "id"
      ],
      "additionalProperties": false
     },
     "action": {
      "type": "string",
      "examples": [
       "site.create"
      ]
     },
     "target": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "type": {
        "type": "string"
       },
       "id": {
        "type": [
         "string",
         "null"
        ]
       }
      },
      "required": [
       "type",
       "id"
      ],
      "additionalProperties": false
     },
     "result": {
      "enum": [
       "SUCCESS",
       "DENIED",
       "FAILURE"
      ]
     },
     "correlation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "meta": {
      "type": "object"
     },
     "prev_hash": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9a-f]{64}$"
     },
     "hash": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
     }
    },
    "required": [
     "id",
     "seq",
     "time",
     "actor",
     "action",
     "target",
     "result",
     "correlation_id",
     "meta",
     "prev_hash",
     "hash"
    ],
    "additionalProperties": false
   },
   "AuditVerification": {
    "type": "object",
    "properties": {
     "ok": {
      "type": "boolean"
     },
     "count": {
      "type": "integer"
     },
     "broken_at": {
      "type": [
       "integer",
       "null"
      ]
     },
     "reason": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "ok",
     "count",
     "broken_at",
     "reason"
    ],
    "additionalProperties": false
   },
   "Membership": {
    "type": "object",
    "properties": {
     "id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "null: access through the person's partner (W5.23), not a membership of their own"
     },
     "tenant": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string",
        "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
       },
       "name": {
        "type": "string"
       },
       "slug": {
        "type": "string"
       },
       "status": {
        "enum": [
         "trial",
         "active",
         "suspended"
        ]
       },
       "trial_ends_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "suspended_reason": {
        "type": [
         "string",
         "null"
        ]
       },
       "plan": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "key": {
          "type": "string"
         },
         "name": {
          "type": "string"
         }
        }
       },
       "licences": {
        "type": [
         "object",
         "null"
        ],
        "additionalProperties": false,
        "properties": {
         "units": {
          "type": [
           "integer",
           "null"
          ],
          "description": "null: no limit"
         },
         "used": {
          "type": "integer"
         }
        }
       },
       "features": {
        "type": "object",
        "additionalProperties": {
         "type": "boolean"
        },
        "description": "Feature flags as they apply to this organisation (ADM-02)"
       }
      },
      "required": [
       "id",
       "name",
       "slug",
       "status"
      ],
      "additionalProperties": false
     },
     "role": {
      "type": "object",
      "properties": {
       "key": {
        "type": "string"
       },
       "name": {
        "type": "string"
       },
       "privileged": {
        "type": "boolean"
       }
      },
      "required": [
       "key",
       "name",
       "privileged"
      ],
      "additionalProperties": false
     },
     "site_ids": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string",
       "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      },
      "description": "null = all sites"
     },
     "permissions": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^[a-z_]+\\.[a-z_]+$"
      }
     },
     "status": {
      "enum": [
       "active",
       "suspended"
      ]
     },
     "second_step_from_sso": {
      "type": "boolean",
      "description": "W5.21: this sign-in's provider gives the second step in this organisation (it trusts it)"
     },
     "through_partner": {
      "type": "boolean",
      "description": "W5.23 (ADR-082): the person works here for the organisation's partner"
     },
     "branding": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/Branding"
       },
       {
        "type": "null"
       }
      ],
      "description": "W5.23: the partner's branding this organisation shows (null: ours)"
     }
    },
    "required": [
     "id",
     "tenant",
     "role",
     "site_ids",
     "permissions"
    ],
    "additionalProperties": false
   },
   "Me": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "email": {
      "type": [
       "string",
       "null"
      ]
     },
     "memberships": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Membership"
      }
     },
     "mfa": {
      "type": "boolean",
      "description": "W3.4: this sign-in used a second factor"
     },
     "mfa_required_for_privileged": {
      "type": "boolean"
     },
     "signed_in_at": {
      "description": "W4.5 (ADR-060): when this sign-in happened (the token's auth_time); null when the token does not say.",
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "fresh_sign_in_seconds": {
      "description": "W4.5: how recent a sign-in the most dangerous changes need (403 reauth-required otherwise); null while MFA is not required.",
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1
     },
     "can_start_trial": {
      "type": "boolean"
     },
     "platform_admin": {
      "type": "boolean",
      "description": "W3.5: may use the platform console"
     },
     "announcement": {
      "type": [
       "string",
       "null"
      ],
      "description": "W3.5: the platform's announcement for everyone"
     },
     "preferences": {
      "$ref": "#/components/schemas/Preferences"
     },
     "signed_in_through": {
      "type": [
       "string",
       "null"
      ],
      "description": "W5.21 (ADR-080): the single sign-on this sign-in went through: an organisation's own (org-…), google or microsoft; null for a password"
     },
     "limited_to_tenant": {
      "type": [
       "string",
       "null"
      ],
      "description": "W5.21: signed in through an organisation's own single sign-on, this sign-in opens that organisation only (its id)"
     },
     "resellers": {
      "type": "array",
      "description": "W5.23 (ADR-082): the partner consoles this person may open (X-Reseller-Id)",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "name": {
         "type": "string"
        },
        "slug": {
         "type": "string"
        },
        "status": {
         "enum": [
          "active",
          "suspended"
         ]
        },
        "role": {
         "enum": [
          "owner",
          "admin"
         ]
        }
       }
      }
     }
    },
    "required": [
     "id",
     "email",
     "memberships",
     "preferences"
    ],
    "additionalProperties": false
   },
   "Problem": {
    "type": "object",
    "description": "RFC 9457 problem details. Branch on `type`.",
    "properties": {
     "type": {
      "type": "string",
      "examples": [
       "urn:udd:problem:not-found"
      ]
     },
     "title": {
      "type": "string"
     },
     "status": {
      "type": "integer"
     },
     "detail": {
      "type": "string"
     },
     "correlation_id": {
      "type": "string"
     },
     "permission": {
      "type": "string"
     },
     "errors": {
      "type": "object",
      "additionalProperties": {
       "type": "array",
       "items": {
        "type": "string"
       }
      }
     },
     "problems": {
      "type": "array",
      "description": "Document problems (invalid-document): a JSON pointer `path` for schema errors or a `rule` code (S1–S11, M1–M12) for rule errors. W5.13 bulk-enrol-problems: the file's `row` (1 is the header) and `column`.",
      "items": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string"
        },
        "rule": {
         "type": "string"
        },
        "message": {
         "type": "string"
        },
        "row": {
         "type": "integer"
        },
        "column": {
         "type": [
          "string",
          "null"
         ]
        }
       },
       "required": [
        "message"
       ],
       "additionalProperties": false
      }
     },
     "revision": {
      "type": "integer",
      "description": "draft-conflict (W2.1): the draft's current revision"
     },
     "usage": {
      "type": "object",
      "description": "W5.5: with asset-in-use, where the file is used (as GET /assets/{asset}/usage)"
     },
     "sso": {
      "type": "string",
      "description": "W5.21 (sso-required): the organisation's single sign-on to sign in through (kc_idp_hint)"
     },
     "record": {
      "type": "object",
      "description": "W5.21 (domain-unverified): the DNS TXT record to add",
      "properties": {
       "type": {
        "const": "TXT"
       },
       "name": {
        "type": "string"
       },
       "value": {
        "type": "string"
       }
      }
     }
    },
    "required": [
     "type",
     "title",
     "status"
    ],
    "additionalProperties": false
   },
   "Layout": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
     },
     "size": {
      "type": "integer",
      "minimum": 1
     },
     "requirements": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "warnings": {
      "type": "array",
      "description": "Only on create: non-blocking layout rule warnings (DCV-11).",
      "items": {
       "type": "object",
       "properties": {
        "rule": {
         "type": "string"
        },
        "message": {
         "type": "string"
        }
       },
       "required": [
        "rule",
        "message"
       ],
       "additionalProperties": false
      }
     },
     "scene": {
      "type": "object",
      "description": "Only on GET /layouts/{layout}: the scene graph (packages/scene-schema/schema.v1.json; W5.19: or schema.v1_1.json when it declares \"1.1\")."
     },
     "draft_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The editable layout this version was saved from (W2.1), or null"
     },
     "version": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1,
      "description": "Version number within its draft (1, 2, …), or null"
     },
     "hidden": {
      "type": "boolean",
      "description": "W5.5b: taken off the lists (kept: a signed record)"
     }
    },
    "required": [
     "id",
     "name",
     "sha256",
     "size",
     "requirements",
     "created_by",
     "created_at",
     "draft_id",
     "version"
    ],
    "additionalProperties": false
   },
   "LayoutCreate": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "scene": {
      "type": "object",
      "description": "A scene graph v1 document (packages/scene-schema/schema.v1.json; W5.19: or schema.v1_1.json when it declares \"1.1\")."
     }
    },
    "required": [
     "name",
     "scene"
    ],
    "additionalProperties": false
   },
   "Release": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "sequence": {
      "type": "integer",
      "minimum": 1
     },
     "environment": {
      "enum": [
       "development",
       "staging",
       "production"
      ]
     },
     "release_type": {
      "enum": [
       "STANDARD",
       "ROLLBACK"
      ]
     },
     "key_id": {
      "type": "string"
     },
     "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 of the signed manifest bytes"
     },
     "targets": {
      "type": "object"
     },
     "not_before": {
      "type": "string",
      "format": "date-time"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "manifest": {
      "type": "object",
      "description": "On create and GET /releases/{release}: the signed manifest (packages/manifest-schema/schema.v1.json). Players fetch the exact bytes from /releases/{release}/manifest."
     },
     "restores_release_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "ROLLBACK releases: the release whose content this one restores."
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "Set once the release is revoked (W1.5); screens drop it."
     },
     "revoke_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "revocation_list": {
      "type": "object",
      "description": "Only on revoke: the new signed list.",
      "properties": {
       "sequence": {
        "type": "integer",
        "minimum": 1
       },
       "sha256": {
        "type": "string",
        "pattern": "^[0-9a-f]{64}$"
       }
      },
      "required": [
       "sequence",
       "sha256"
      ],
      "additionalProperties": false
     },
     "request_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The approved request this release came from (W2.2), or null when published directly"
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "rollout_state": {
      "enum": [
       "ACTIVE",
       "HALTED",
       "COMPLETED",
       "ROLLED_BACK",
       null
      ],
      "description": "W3.3: the state of the release's staged rollout; null when it was offered to every screen at once."
     },
     "compatibility": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/ReleaseCompatibility"
       },
       {
        "type": "null"
       }
      ],
      "description": "W3.10: only in the answer to POST /releases"
     },
     "hidden": {
      "type": "boolean",
      "description": "W5.5b: taken off the lists (kept: a signed record)"
     },
     "campaign_delivery": {
      "type": [
       "object",
       "null"
      ],
      "description": "W5.6: made automatically to deliver campaigns to some screens: the release whose content it carries and the campaigns added",
      "properties": {
       "base_release_id": {
        "type": "string"
       },
       "campaign_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      },
      "required": [
       "base_release_id",
       "campaign_ids"
      ],
      "additionalProperties": false
     },
     "campaign_notes": {
      "type": "array",
      "description": "Only in the answer to a publish: running campaigns that show an older version of a layout this release carries (during their hours those screens show the campaign's version)",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "campaign_id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "layout": {
         "type": "string"
        },
        "campaign_version": {
         "type": [
          "integer",
          "null"
         ]
        },
        "published_version": {
         "type": [
          "integer",
          "null"
         ]
        }
       }
      }
     }
    },
    "required": [
     "created_at",
     "created_by",
     "environment",
     "expires_at",
     "id",
     "key_id",
     "not_before",
     "release_type",
     "restores_release_id",
     "revoke_reason",
     "revoked_at",
     "sequence",
     "sha256",
     "targets",
     "request_id",
     "requested_by"
    ],
    "additionalProperties": false
   },
   "ReleaseCompatibility": {
    "type": "object",
    "description": "W3.10 (CAP-04): whether each target screen's players can show the release (problems first; at most 500 listed, the counts cover all).",
    "properties": {
     "required": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "counts": {
      "type": "object",
      "properties": {
       "ok": {
        "type": "integer"
       },
       "missing": {
        "type": "integer"
       },
       "unknown": {
        "type": "integer"
       },
       "no_player": {
        "type": "integer"
       }
      },
      "required": [
       "ok",
       "missing",
       "unknown",
       "no_player"
      ],
      "additionalProperties": false
     },
     "screens": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "screen_id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "status": {
         "enum": [
          "ok",
          "missing",
          "unknown",
          "no_player"
         ]
        },
        "missing": {
         "type": "array",
         "items": {
          "type": "string"
         },
         "description": "Capability tokens a player there lacks, and (W5.19) \"player X.Y.Z\" when a player is older than the release needs (scene 1.1 needs 1.22.0)"
        },
        "players": {
         "type": "integer"
        }
       },
       "required": [
        "screen_id",
        "name",
        "status",
        "missing",
        "players"
       ],
       "additionalProperties": false
      }
     }
    },
    "required": [
     "required",
     "counts",
     "screens"
    ],
    "additionalProperties": false
   },
   "ReleaseCreate": {
    "type": "object",
    "properties": {
     "layout_id": {
      "type": "string",
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The DEFAULT layout: shown whenever no schedule item applies."
     },
     "targets": {
      "type": "object",
      "description": "At least one list. A screen is reached when it is in the location scope (listed screen, zone or site; any site when only tags are given) and carries one of the tags, if tags are given.",
      "properties": {
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "zone_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "tags": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        }
       }
      },
      "additionalProperties": false
     },
     "not_before": {
      "type": "string",
      "format": "date-time"
     },
     "expires_in_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
     },
     "schedule": {
      "type": "array",
      "maxItems": 100,
      "description": "W1.4: scheduled items on top of the default (SCH-01..03), in the screen's site time zone. Conflicts resolve by layer (EMERGENCY > OVERRIDE > CAMPAIGN), then priority, then latest start. Items become manifest rules rule-1, rule-2, … in this order.",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "layout_id",
        "layer"
       ],
       "properties": {
        "layout_id": {
         "type": "string",
         "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "layer": {
         "enum": [
          "CAMPAIGN",
          "OVERRIDE",
          "EMERGENCY"
         ]
        },
        "priority": {
         "type": "integer",
         "minimum": 0,
         "maximum": 1000,
         "default": 50
        },
        "start_date": {
         "type": [
          "string",
          "null"
         ],
         "format": "date"
        },
        "end_date": {
         "type": [
          "string",
          "null"
         ],
         "format": "date",
         "description": "Inclusive."
        },
        "start_time": {
         "type": [
          "string",
          "null"
         ],
         "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
        },
        "end_time": {
         "type": [
          "string",
          "null"
         ],
         "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$",
         "description": "Exclusive; earlier than start_time runs past midnight."
        },
        "days": {
         "type": "array",
         "maxItems": 7,
         "uniqueItems": true,
         "items": {
          "enum": [
           "MO",
           "TU",
           "WE",
           "TH",
           "FR",
           "SA",
           "SU"
          ]
         },
         "description": "Weekdays; none means every day."
        },
        "except_dates": {
         "type": "array",
         "maxItems": 366,
         "uniqueItems": true,
         "items": {
          "type": "string",
          "format": "date"
         }
        },
        "tags": {
         "type": "array",
         "maxItems": 50,
         "uniqueItems": true,
         "items": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
         },
         "description": "Only screens carrying one of these tags."
        }
       }
      }
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "W2.5: an exact end instead of expires_in_days (not both)"
     },
     "rollout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "waves"
      ],
      "description": "W3.3 (ADR-041): offer the release wave by wave. Only on POST /releases (direct publishing).",
      "properties": {
       "waves": {
        "type": "array",
        "minItems": 1,
        "maxItems": 10,
        "items": {
         "type": "integer",
         "minimum": 1,
         "maximum": 100
        },
        "description": "Cumulative share of the screens (other than the canary group) offered by the end of each wave; increasing, ending at 100."
       },
       "canary_group_id": {
        "type": [
         "string",
         "null"
        ],
        "description": "A screen group whose screens form a first wave of their own."
       },
       "auto_promote": {
        "type": "boolean",
        "default": true
       },
       "auto_rollback": {
        "type": "boolean",
        "default": true
       },
       "max_failure_percent": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
        "default": 20,
        "description": "Halt when more than this share of the offered screens refused the release or went offline after it was offered."
       },
       "observe_minutes": {
        "type": "integer",
        "minimum": 0,
        "maximum": 1440,
        "default": 10,
        "description": "How long a healthy wave is watched before the next is offered."
       }
      }
     },
     "delivery": {
      "type": "object",
      "additionalProperties": false,
      "description": "W3.6 (PLR-05, PLR-11): signed into the manifest's policies.",
      "properties": {
       "bandwidth_limit_kbps": {
        "type": "integer",
        "minimum": 64,
        "maximum": 10000000
       },
       "download_window": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "start",
         "end"
        ],
        "properties": {
         "start": {
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
         },
         "end": {
          "type": "string",
          "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$"
         }
        }
       },
       "clock_skew_tolerance_seconds": {
        "type": "integer",
        "minimum": 30,
        "maximum": 3600
       }
      }
     },
     "on_incompatible": {
      "enum": [
       "warn",
       "block"
      ],
      "description": "W3.10 (CAP-04): screens whose players cannot show it: publish and say so (warn, the default) or refuse with 422 incompatible-screens (block)"
     }
    },
    "required": [
     "layout_id",
     "targets"
    ],
    "additionalProperties": false
   },
   "EnrollmentCode": {
    "type": "object",
    "properties": {
     "code": {
      "type": "string",
      "pattern": "^[ABCDEFGHJKMNPQRSTVWXYZ2-9]{4}-[ABCDEFGHJKMNPQRSTVWXYZ2-9]{4}$",
      "description": "Shown once; type it into the player within the hour"
     },
     "screen_id": {
      "type": "string",
      "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     }
    },
    "required": [
     "code",
     "screen_id",
     "expires_at"
    ],
    "additionalProperties": false
   },
   "Asset": {
    "type": "object",
    "description": "An uploaded media file that passed type sniffing and a malware scan (W1.3, ADR-025). Its bytes never change (name, folder and tags may, W2.4). W5.5: deleting puts it in the bin for 30 days, then its bytes are deleted; the record stays.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "image",
       "video",
       "font",
       "audio",
       "document"
      ]
     },
     "media_type": {
      "enum": [
       "image/png",
       "image/jpeg",
       "image/webp",
       "image/gif",
       "video/mp4",
       "font/woff2",
       "audio/mpeg",
       "audio/mp4",
       "application/pdf"
      ]
     },
     "size": {
      "type": "integer",
      "minimum": 1
     },
     "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
     },
     "width": {
      "type": [
       "integer",
       "null"
      ]
     },
     "height": {
      "type": [
       "integer",
       "null"
      ]
     },
     "codec": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "H264",
       "H265",
       "VP9",
       "AV1",
       "MP3",
       "AAC",
       null
      ]
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "existing": {
      "type": "boolean",
      "description": "Only on upload: true when these bytes were already an asset of this tenant (200)."
     },
     "renditions": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AssetRendition"
      },
      "description": "W2.3: thumbnails and screen copies, in the asset list, on one asset and after an upload"
     },
     "folder_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "W2.4: the folder it is filed in (null: none)"
     },
     "tags": {
      "type": "array",
      "items": {
       "type": "string",
       "minLength": 1,
       "maxLength": 32,
       "description": "Letters and digits in any script and dashes, lowercase"
      },
      "maxItems": 20,
      "description": "W2.4: lowercase words, sorted"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "moved": {
      "type": "boolean",
      "description": "W2.4: with existing, an upload of the same bytes into a folder or with tags filed the existing file there"
     },
     "restored": {
      "type": "boolean",
      "description": "W3.12.4: on an upload of a file the library already had whose stored copy could not be read: this upload put it back."
     },
     "deleted_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "W5.5: in the bin since (null: in the library)"
     },
     "purge_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "W5.5: when a file in the bin is deleted for good (its stored bytes and copies); null when not in the bin or already purged"
     },
     "purged": {
      "type": "boolean",
      "description": "W5.5: its stored bytes were deleted; uploading the same file again brings it back"
     },
     "undeleted": {
      "type": "boolean",
      "description": "W5.5: on an upload of a file that was in the bin (or deleted for good): this upload brought it back"
     },
     "pages": {
      "type": "integer",
      "minimum": 0,
      "description": "W5.18 (ADR-077): only for a PDF: how many of its pages are drawn as pictures (0 until the media worker has done it). Screens show a PDF as these pictures, in a playlist one page after another."
     }
    },
    "required": [
     "id",
     "name",
     "kind",
     "media_type",
     "size",
     "sha256",
     "width",
     "height",
     "codec",
     "created_by",
     "created_at",
     "folder_id",
     "tags",
     "updated_at",
     "deleted_at",
     "purge_at",
     "purged"
    ],
    "additionalProperties": false
   },
   "DeviceCommand": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^cmd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "device_id": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "command": {
      "enum": [
       "REBOOT",
       "REFRESH_CONTENT",
       "CLEAR_CACHE",
       "MAINTENANCE_OPEN",
       "MAINTENANCE_CLOSE",
       "DIAGNOSE"
      ]
     },
     "status": {
      "enum": [
       "pending",
       "delivered",
       "done",
       "failed",
       "refused",
       "expired"
      ],
      "description": "pending: waiting for the device; delivered: the device fetched it; done/failed: the device ran it; refused: it did not verify on the device; expired: never finished within 15 minutes"
     },
     "detail": {
      "type": [
       "string",
       "null"
      ],
      "description": "What the device reported"
     },
     "issued_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "delivered_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "finished_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 of the exact signed command (udd.device-command v1)"
     }
    },
    "required": [
     "command",
     "created_at",
     "delivered_at",
     "detail",
     "device_id",
     "expires_at",
     "finished_at",
     "id",
     "issued_by",
     "sha256",
     "status"
    ]
   },
   "LayoutDraft": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "revision": {
      "type": "integer",
      "minimum": 1,
      "description": "Grows with every save; send it back as base_revision"
     },
     "size": {
      "type": "integer",
      "minimum": 2
     },
     "latest_version": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "brand_locked": {
      "type": "boolean",
      "description": "W5.16 (CMS-22): only a brand manager changes locked zones and widgets, fonts, named styles and the background"
     },
     "template_ref": {
      "type": [
       "string",
       "null"
      ],
      "description": "The template it was made from (platform:<key> or tpl_…)"
     }
    },
    "required": [
     "id",
     "name",
     "revision",
     "size",
     "latest_version",
     "created_by",
     "created_at",
     "updated_by",
     "updated_at",
     "brand_locked",
     "template_ref"
    ]
   },
   "LayoutDraftFull": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "revision": {
      "type": "integer",
      "minimum": 1,
      "description": "Grows with every save; send it back as base_revision"
     },
     "size": {
      "type": "integer",
      "minimum": 2
     },
     "latest_version": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "scene": {
      "type": "object",
      "description": "The working scene (may be unfinished)"
     },
     "ready": {
      "type": "boolean",
      "description": "True when Save version would succeed"
     },
     "problems": {
      "type": "array",
      "description": "Why it cannot become a version yet (schema, rules, media); empty when ready",
      "items": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string"
        },
        "rule": {
         "type": "string"
        },
        "message": {
         "type": "string"
        }
       },
       "required": [
        "message"
       ],
       "additionalProperties": false
      }
     },
     "warnings": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "rule": {
         "type": "string"
        },
        "message": {
         "type": "string"
        }
       },
       "required": [
        "rule",
        "message"
       ],
       "additionalProperties": false
      }
     },
     "zone_playlists": {
      "type": "object",
      "description": "Zone id → playlist that fills it (W2.2)",
      "additionalProperties": {
       "type": "string",
       "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      },
      "propertyNames": {
       "pattern": "^[a-z][a-z0-9_-]{0,63}$"
      }
     },
     "brand_locked": {
      "type": "boolean",
      "description": "W5.16 (CMS-22): only a brand manager changes locked zones and widgets, fonts, named styles and the background"
     },
     "template_ref": {
      "type": [
       "string",
       "null"
      ],
      "description": "The template it was made from (platform:<key> or tpl_…)"
     }
    },
    "required": [
     "id",
     "name",
     "revision",
     "size",
     "latest_version",
     "created_by",
     "created_at",
     "updated_by",
     "updated_at",
     "scene",
     "ready",
     "problems",
     "warnings",
     "zone_playlists",
     "brand_locked",
     "template_ref"
    ]
   },
   "PlaylistItem": {
    "oneOf": [
     {
      "$ref": "#/components/schemas/PlaylistMediaItem"
     },
     {
      "$ref": "#/components/schemas/PlaylistTagItem"
     },
     {
      "$ref": "#/components/schemas/PlaylistNestedItem"
     }
    ]
   },
   "Playlist": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PlaylistItem"
      }
     },
     "total_ms": {
      "type": "integer"
     },
     "revision": {
      "type": "integer",
      "minimum": 1
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "used_by": {
      "type": "array",
      "description": "Only on one playlist: the layouts being edited that play it",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^ld_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "name": {
         "type": "string"
        }
       },
       "required": [
        "id",
        "name"
       ]
      }
     }
    },
    "required": [
     "id",
     "name",
     "items",
     "total_ms",
     "revision",
     "created_by",
     "created_at",
     "updated_by",
     "updated_at"
    ]
   },
   "ReleaseRequest": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "status": {
      "enum": [
       "in_review",
       "approved",
       "rejected",
       "withdrawn"
      ]
     },
     "layout_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "targets": {
      "type": "object"
     },
     "schedule_items": {
      "type": "integer"
     },
     "expires_in_days": {
      "type": [
       "integer",
       "null"
      ]
     },
     "note": {
      "type": [
       "string",
       "null"
      ]
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "requested_at": {
      "type": "string",
      "format": "date-time"
     },
     "decided_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "decision_note": {
      "type": [
       "string",
       "null"
      ]
     },
     "release_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "payload": {
      "type": "object",
      "description": "What was submitted (the same fields as POST /releases)"
     },
     "release": {
      "$ref": "#/components/schemas/Release"
     },
     "replaces_release_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "W2.2.1: the release an Update screens request replaces"
     }
    },
    "required": [
     "id",
     "status",
     "layout_id",
     "targets",
     "schedule_items",
     "expires_in_days",
     "note",
     "requested_by",
     "requested_at",
     "decided_by",
     "decided_at",
     "decision_note",
     "release_id",
     "payload",
     "replaces_release_id"
    ]
   },
   "ReleaseRequestCreate": {
    "type": "object",
    "properties": {
     "layout_id": {
      "type": "string",
      "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The DEFAULT layout: shown whenever no schedule item applies."
     },
     "targets": {
      "type": "object",
      "description": "At least one list. A screen is reached when it is in the location scope (listed screen, zone or site; any site when only tags are given) and carries one of the tags, if tags are given.",
      "properties": {
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "zone_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^zone_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "tags": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
        }
       }
      },
      "additionalProperties": false
     },
     "not_before": {
      "type": "string",
      "format": "date-time"
     },
     "expires_in_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
     },
     "schedule": {
      "type": "array",
      "maxItems": 100,
      "description": "W1.4: scheduled items on top of the default (SCH-01..03), in the screen's site time zone. Conflicts resolve by layer (EMERGENCY > OVERRIDE > CAMPAIGN), then priority, then latest start. Items become manifest rules rule-1, rule-2, … in this order.",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "layout_id",
        "layer"
       ],
       "properties": {
        "layout_id": {
         "type": "string",
         "pattern": "^lv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "layer": {
         "enum": [
          "CAMPAIGN",
          "OVERRIDE",
          "EMERGENCY"
         ]
        },
        "priority": {
         "type": "integer",
         "minimum": 0,
         "maximum": 1000,
         "default": 50
        },
        "start_date": {
         "type": [
          "string",
          "null"
         ],
         "format": "date"
        },
        "end_date": {
         "type": [
          "string",
          "null"
         ],
         "format": "date",
         "description": "Inclusive."
        },
        "start_time": {
         "type": [
          "string",
          "null"
         ],
         "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
        },
        "end_time": {
         "type": [
          "string",
          "null"
         ],
         "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$",
         "description": "Exclusive; earlier than start_time runs past midnight."
        },
        "days": {
         "type": "array",
         "maxItems": 7,
         "uniqueItems": true,
         "items": {
          "enum": [
           "MO",
           "TU",
           "WE",
           "TH",
           "FR",
           "SA",
           "SU"
          ]
         },
         "description": "Weekdays; none means every day."
        },
        "except_dates": {
         "type": "array",
         "maxItems": 366,
         "uniqueItems": true,
         "items": {
          "type": "string",
          "format": "date"
         }
        },
        "tags": {
         "type": "array",
         "maxItems": 50,
         "uniqueItems": true,
         "items": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
         },
         "description": "Only screens carrying one of these tags."
        }
       }
      }
     },
     "note": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 500,
      "description": "For the reviewer"
     },
     "replaces_release_id": {
      "type": "string",
      "description": "W2.5: the release this edits (calendar); approval checks it is still on screens and keeps its end"
     },
     "delivery": {
      "type": "object",
      "additionalProperties": false,
      "description": "W3.6 (PLR-05, PLR-11): signed into the manifest's policies.",
      "properties": {
       "bandwidth_limit_kbps": {
        "type": "integer",
        "minimum": 64,
        "maximum": 10000000
       },
       "download_window": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "start",
         "end"
        ],
        "properties": {
         "start": {
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
         },
         "end": {
          "type": "string",
          "pattern": "^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$"
         }
        }
       },
       "clock_skew_tolerance_seconds": {
        "type": "integer",
        "minimum": 30,
        "maximum": 3600
       }
      }
     }
    },
    "required": [
     "layout_id",
     "targets"
    ],
    "additionalProperties": false,
    "description": "The same fields as POST /releases (ReleaseCreate), plus an optional note for the reviewer"
   },
   "AssetRendition": {
    "type": "object",
    "description": "W2.3 (ADR-031): a copy made by the media worker. thumb (preview, JPEG within 480x480), fhd (image within full HD), h264-fhd (H.264 video within full HD). Screen copies join release manifests after the original.",
    "properties": {
     "name": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{0,31}$"
     },
     "purpose": {
      "enum": [
       "preview",
       "screen"
      ]
     },
     "status": {
      "enum": [
       "pending",
       "processing",
       "ready",
       "failed"
      ]
     },
     "error": {
      "type": [
       "string",
       "null"
      ],
      "description": "Why it failed (failed only)"
     },
     "media_type": {
      "type": [
       "string",
       "null"
      ]
     },
     "size": {
      "type": [
       "integer",
       "null"
      ]
     },
     "sha256": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9a-f]{64}$"
     },
     "width": {
      "type": [
       "integer",
       "null"
      ]
     },
     "height": {
      "type": [
       "integer",
       "null"
      ]
     },
     "codec": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "H264",
       "H265",
       "VP9",
       "AV1",
       null
      ]
     }
    },
    "required": [
     "name",
     "purpose",
     "status",
     "error",
     "media_type",
     "size",
     "sha256",
     "width",
     "height",
     "codec"
    ],
    "additionalProperties": false
   },
   "AssetFolder": {
    "type": "object",
    "description": "W2.4: a folder in the media library (a tree, at most 8 levels)",
    "properties": {
     "id": {
      "type": "string"
     },
     "parent_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
     },
     "files": {
      "type": "integer",
      "description": "Files directly in it"
     },
     "folders": {
      "type": "integer",
      "description": "Folders directly in it"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "access": {
      "enum": [
       "READ",
       "WRITE",
       null
      ],
      "description": "W5.17: what this person may do in it (list only)"
     },
     "restricted": {
      "type": "boolean",
      "description": "W5.17 (CMS-26): seen only by the people it is shared with (list only)"
     },
     "shared_with": {
      "type": [
       "integer",
       "null"
      ],
      "description": "How many people it is shared with (for those who share; list only)"
     },
     "changeable": {
      "type": "boolean",
      "description": "W5.17: may rename, move or delete it (list only)"
     }
    },
    "required": [
     "id",
     "parent_id",
     "name",
     "files",
     "folders",
     "created_at",
     "updated_at"
    ],
    "additionalProperties": false
   },
   "DataSource": {
    "type": "object",
    "additionalProperties": false,
    "description": "W2.6 (ADR-034): a source of live values for widgets. `latest` is the newest data envelope (packages/data-envelope-schema).",
    "required": [
     "id",
     "name",
     "kind",
     "schema",
     "url",
     "root",
     "interval_seconds",
     "enabled",
     "sequence",
     "latest",
     "last_attempt_at",
     "last_success_at",
     "last_error",
     "failures",
     "next_fetch_at",
     "archived_at",
     "created_at",
     "updated_at",
     "auth_type",
     "auth_config",
     "has_secret",
     "headers",
     "mapping",
     "definition_version",
     "health"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^src_[0-9a-f-]{36}$"
     },
     "name": {
      "type": "string",
      "maxLength": 200
     },
     "kind": {
      "enum": [
       "MANUAL",
       "JSON_URL",
       "CSV_URL",
       "RSS",
       "WEBSOCKET",
       "FLEET"
      ],
      "description": "WEBSOCKET (W2.10): kept connected by the stream worker; each JSON message is mapped into the values. FLEET (W3.2): the platform keeps its values (devices online, offline, quarantined, open incidents; per site and group); one per tenant."
     },
     "schema": {
      "type": "string"
     },
     "url": {
      "type": [
       "string",
       "null"
      ]
     },
     "root": {
      "type": [
       "string",
       "null"
      ]
     },
     "interval_seconds": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 30,
      "maximum": 86400
     },
     "enabled": {
      "type": "boolean"
     },
     "sequence": {
      "type": "integer",
      "minimum": 0
     },
     "latest": {
      "type": [
       "object",
       "null"
      ],
      "description": "The newest data envelope, or null before the first values."
     },
     "last_attempt_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_success_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 300
     },
     "failures": {
      "type": "integer",
      "minimum": 0
     },
     "next_fetch_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "archived_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "auth_type": {
      "enum": [
       "NONE",
       "API_KEY",
       "BASIC",
       "OAUTH2_CC"
      ]
     },
     "auth_config": {
      "type": "object",
      "description": "The login without its secret: API_KEY {in: HEADER|QUERY, name}, BASIC {username}, OAUTH2_CC {token_url, client_id, scope}."
     },
     "has_secret": {
      "type": "boolean",
      "description": "Whether a secret is saved; the secret itself is never returned (CON-05)."
     },
     "headers": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      }
     },
     "mapping": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": {
       "type": "string"
      },
      "description": "Value name → JSONPath ($, .name, ['name'], [0], [*])."
     },
     "definition_version": {
      "type": "integer",
      "minimum": 1
     },
     "health": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "fetches",
       "error_rate",
       "last_latency_ms",
       "average_latency_ms"
      ],
      "properties": {
       "fetches": {
        "type": "integer",
        "description": "How many of the last 20 fetches are counted"
       },
       "error_rate": {
        "type": [
         "number",
         "null"
        ]
       },
       "last_latency_ms": {
        "type": [
         "integer",
         "null"
        ]
       },
       "average_latency_ms": {
        "type": [
         "integer",
         "null"
        ]
       }
      }
     },
     "subscribe_message": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 4096,
      "description": "WEBSOCKET: text sent after connecting (to subscribe), or null (W2.10)."
     },
     "stream": {
      "type": [
       "object",
       "null"
      ],
      "description": "WEBSOCKET only: the connection (CON-08, W2.10).",
      "required": [
       "state",
       "connected_at",
       "last_message_at"
      ],
      "properties": {
       "state": {
        "enum": [
         "CONNECTING",
         "CONNECTED",
         "DISCONNECTED"
        ]
       },
       "connected_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "last_message_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       }
      },
      "additionalProperties": false
     }
    }
   },
   "Rule": {
    "type": "object",
    "additionalProperties": false,
    "description": "W2.7 (ADR-035): WHEN condition holds (for min_duration_seconds) THEN actions; when it stops (as long), clear_actions. A change to what it does makes a new version.",
    "required": [
     "id",
     "name",
     "enabled",
     "version",
     "priority",
     "condition",
     "timezone",
     "stale_after_seconds",
     "min_duration_seconds",
     "cooldown_seconds",
     "actions",
     "clear_actions",
     "state",
     "state_since",
     "last_fired_at",
     "last_evaluated_at",
     "last_error",
     "archived_at",
     "created_at",
     "updated_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rule_[0-9a-f-]{36}$"
     },
     "name": {
      "type": "string"
     },
     "enabled": {
      "type": "boolean"
     },
     "version": {
      "type": "integer",
      "minimum": 1
     },
     "priority": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000
     },
     "condition": {
      "type": "object",
      "description": "The scene expression language (scene schema `expression`): AND, OR, NOT, EQ, NE, GT, GTE, LT, LTE, IN, QUALITY, TIME_BETWEEN; at most 6 levels and 50 parts."
     },
     "timezone": {
      "type": "string"
     },
     "stale_after_seconds": {
      "type": "integer"
     },
     "min_duration_seconds": {
      "type": "integer"
     },
     "cooldown_seconds": {
      "type": "integer"
     },
     "actions": {
      "type": "array",
      "items": {
       "type": "object",
       "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
       "required": [
        "type"
       ],
       "properties": {
        "type": {
         "enum": [
          "SET_VALUES",
          "RAISE_ALERT",
          "OPEN_INCIDENT"
         ]
        },
        "title": {
         "type": "string",
         "maxLength": 200
        }
       }
      }
     },
     "clear_actions": {
      "type": "array",
      "items": {
       "type": "object",
       "description": "An approved action (SCH-05): SET_VALUES {sourceId of a typed-in source, values} or RAISE_ALERT {severity, message, auto_clear}. OPEN_INCIDENT {severity, title} opens an incident for the rule (W3.2).",
       "required": [
        "type"
       ],
       "properties": {
        "type": {
         "enum": [
          "SET_VALUES",
          "RAISE_ALERT",
          "OPEN_INCIDENT"
         ]
        },
        "title": {
         "type": "string",
         "maxLength": 200
        }
       }
      }
     },
     "state": {
      "enum": [
       "IDLE",
       "PENDING",
       "ACTIVE",
       "CLEARING"
      ]
     },
     "state_since": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_fired_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_evaluated_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ]
     },
     "archived_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "offline_safe": {
      "type": "boolean",
      "description": "W5.9 (SCH-08): the rule runs on the screens (compiled into each release whose layouts use all its sources) instead of in the cloud; only SET_VALUES actions, which set values on those screens."
     }
    }
   },
   "RuleRun": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "rule_version",
     "occurred_at",
     "outcome",
     "inputs",
     "results"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^run_[0-9a-f-]{36}$"
     },
     "rule_version": {
      "type": "integer"
     },
     "occurred_at": {
      "type": "string",
      "format": "date-time"
     },
     "outcome": {
      "enum": [
       "FIRED",
       "CLEARED",
       "FAILED"
      ]
     },
     "inputs": {
      "type": "object",
      "description": "Every value and quality the condition looked at."
     },
     "results": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "type",
        "ok",
        "detail"
       ],
       "properties": {
        "type": {
         "type": "string"
        },
        "ok": {
         "type": "boolean"
        },
        "detail": {
         "type": "string"
        }
       }
      }
     },
     "device_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "W5.9: the screen's device that ran it (null: run in the cloud)"
     }
    }
   },
   "Alert": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "rule_id",
     "rule_name",
     "rule_version",
     "severity",
     "message",
     "auto_clear",
     "raised_at",
     "cleared_at",
     "acknowledged_at",
     "acknowledged_by",
     "source_id",
     "source_name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^alrt_[0-9a-f-]{36}$"
     },
     "rule_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "rule_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "rule_version": {
      "type": [
       "integer",
       "null"
      ]
     },
     "severity": {
      "enum": [
       "INFO",
       "WARNING",
       "CRITICAL"
      ]
     },
     "message": {
      "type": "string"
     },
     "auto_clear": {
      "type": "boolean"
     },
     "raised_at": {
      "type": "string",
      "format": "date-time"
     },
     "cleared_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "acknowledged_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "acknowledged_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "W2.8: set when a data source's health raised the alert"
     },
     "source_name": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "ConnectionTest": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "ok",
     "latency_ms",
     "error",
     "sample",
     "values"
    ],
    "description": "W2.8 (CON-09): what a fetch gave; nothing is stored. Secret-looking names and the source's own secret are hidden.",
    "properties": {
     "ok": {
      "type": "boolean"
     },
     "latency_ms": {
      "type": [
       "integer",
       "null"
      ]
     },
     "error": {
      "type": [
       "string",
       "null"
      ]
     },
     "sample": {
      "description": "The answer (JSON sources), redacted and cut short."
     },
     "values": {
      "description": "The values a screen would get, redacted."
     }
    }
   },
   "ApiKey": {
    "type": "object",
    "additionalProperties": false,
    "description": "W2.9 (SEC-15; ADR-037): a tenant API key: it pushes values to the sources it names (data.push), reads the event feed (events.read) or exports the security log (security.export, W5.15). The key itself appears only in the answer that creates or rotates it.",
    "required": [
     "id",
     "name",
     "scopes",
     "source_ids",
     "hint",
     "expires_at",
     "last_used_at",
     "revoked_at",
     "previous_works_until",
     "created_at",
     "updated_at",
     "expired"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^key_[0-9a-f-]{36}$"
     },
     "name": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "enum": [
        "data.push",
        "events.read",
        "security.export"
       ]
      }
     },
     "source_ids": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "hint": {
      "type": "string",
      "description": "udd_… and the last 4 characters"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "last_used_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "previous_works_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "While a rotation grace period runs: when the previous secret stops working; otherwise null."
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "key": {
      "type": [
       "string",
       "null"
      ],
      "description": "Only when created or rotated: udd_<id>_<secret>. Shown once; a replayed request gives null."
     },
     "key_already_shown": {
      "type": "boolean"
     },
     "expired": {
      "type": "boolean",
      "description": "The key has passed expires_at."
     }
    }
   },
   "Incident": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "number",
     "title",
     "kind",
     "severity",
     "status",
     "device_ids",
     "opened_by",
     "opened_at",
     "updated_at",
     "closed_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^inc_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "number": {
      "type": "integer",
      "minimum": 1
     },
     "title": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "DEVICE_OFFLINE",
       "SECURITY",
       "RULE",
       "MANUAL",
       "ROLLOUT"
      ]
     },
     "severity": {
      "enum": [
       "INFO",
       "WARNING",
       "CRITICAL"
      ]
     },
     "status": {
      "enum": [
       "OPEN",
       "INVESTIGATING",
       "CONTAINED",
       "RECOVERED",
       "CLOSED"
      ]
     },
     "device_ids": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "opened_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "opened_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "closed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "muted_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^mw_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "W5.10 (FLT-09): the maintenance window it was opened in (it sent no notifications then)"
     },
     "muted": {
      "type": "boolean",
      "description": "W5.10: still quiet (its window is not over)"
     }
    }
   },
   "IncidentFull": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "number",
     "title",
     "kind",
     "severity",
     "status",
     "device_ids",
     "opened_by",
     "opened_at",
     "updated_at",
     "closed_at",
     "device_details",
     "events"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^inc_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "number": {
      "type": "integer",
      "minimum": 1
     },
     "title": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "DEVICE_OFFLINE",
       "SECURITY",
       "RULE",
       "MANUAL",
       "ROLLOUT"
      ]
     },
     "severity": {
      "enum": [
       "INFO",
       "WARNING",
       "CRITICAL"
      ]
     },
     "status": {
      "enum": [
       "OPEN",
       "INVESTIGATING",
       "CONTAINED",
       "RECOVERED",
       "CLOSED"
      ]
     },
     "device_ids": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "opened_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "opened_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "closed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "device_details": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "screen_name",
        "state",
        "offline_since",
        "added_at"
       ],
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "screen_name": {
         "type": [
          "string",
          "null"
         ]
        },
        "state": {
         "type": "string"
        },
        "offline_since": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "added_at": {
         "type": "string",
         "format": "date-time"
        }
       }
      }
     },
     "events": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "at",
        "type",
        "actor",
        "status_from",
        "status_to",
        "body",
        "meta"
       ],
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^ie_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "at": {
         "type": "string",
         "format": "date-time"
        },
        "type": {
         "enum": [
          "OPENED",
          "STATUS",
          "NOTE",
          "DEVICE_ADDED",
          "DEVICE_EVENT"
         ]
        },
        "actor": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "type",
          "id",
          "name"
         ],
         "properties": {
          "type": {
           "enum": [
            "user",
            "device",
            "system",
            "rule"
           ]
          },
          "id": {
           "type": [
            "string",
            "null"
           ]
          },
          "name": {
           "type": [
            "string",
            "null"
           ]
          }
         }
        },
        "status_from": {
         "type": [
          "string",
          "null"
         ]
        },
        "status_to": {
         "type": [
          "string",
          "null"
         ]
        },
        "body": {
         "type": [
          "string",
          "null"
         ]
        },
        "meta": {
         "type": "object"
        }
       }
      }
     },
     "muted_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^mw_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "W5.10 (FLT-09): the maintenance window it was opened in (it sent no notifications then)"
     },
     "muted": {
      "type": "boolean",
      "description": "W5.10: still quiet (its window is not over)"
     }
    }
   },
   "ScreenGroup": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "description",
     "screen_ids",
     "created_at",
     "updated_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "screen_ids": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "FleetSettings": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "missed_heartbeats",
     "auto_close_offline"
    ],
    "properties": {
     "missed_heartbeats": {
      "type": "integer",
      "minimum": 2,
      "maximum": 20
     },
     "auto_close_offline": {
      "type": "boolean"
     }
    }
   },
   "FleetSummary": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "devices",
     "open_incidents"
    ],
    "properties": {
     "devices": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "total",
       "offline",
       "online",
       "never_seen",
       "quarantine",
       "with_problem"
      ],
      "properties": {
       "total": {
        "type": "integer",
        "minimum": 0
       },
       "offline": {
        "type": "integer",
        "minimum": 0
       },
       "online": {
        "type": "integer",
        "minimum": 0
       },
       "never_seen": {
        "type": "integer",
        "minimum": 0
       },
       "quarantine": {
        "type": "integer",
        "minimum": 0
       },
       "with_problem": {
        "type": "integer",
        "minimum": 0
       }
      }
     },
     "open_incidents": {
      "oneOf": [
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "critical",
         "warning",
         "info"
        ],
        "properties": {
         "critical": {
          "type": "integer",
          "minimum": 0
         },
         "warning": {
          "type": "integer",
          "minimum": 0
         },
         "info": {
          "type": "integer",
          "minimum": 0
         }
        }
       },
       {
        "type": "null"
       }
      ]
     }
    }
   },
   "TimelineItem": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "at",
     "kind",
     "type",
     "result",
     "actor",
     "detail",
     "ref"
    ],
    "properties": {
     "at": {
      "type": "string",
      "format": "date-time"
     },
     "kind": {
      "enum": [
       "audit",
       "command",
       "incident"
      ]
     },
     "type": {
      "type": "string"
     },
     "result": {
      "type": [
       "string",
       "null"
      ]
     },
     "actor": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "type": {
        "type": "string"
       },
       "id": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "detail": {
      "type": "object"
     },
     "ref": {
      "type": "string"
     }
    }
   },
   "DeviceMetric": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "at",
     "samples",
     "cpu_percent",
     "memory_percent",
     "storage_free_mb",
     "temperature_c"
    ],
    "properties": {
     "at": {
      "type": "string",
      "format": "date-time"
     },
     "samples": {
      "type": "integer",
      "minimum": 1
     },
     "cpu_percent": {
      "type": [
       "number",
       "null"
      ]
     },
     "memory_percent": {
      "type": [
       "number",
       "null"
      ]
     },
     "storage_free_mb": {
      "type": [
       "integer",
       "null"
      ]
     },
     "temperature_c": {
      "type": [
       "number",
       "null"
      ]
     }
    }
   },
   "NotificationChannel": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "kind",
     "emails",
     "url",
     "has_secret",
     "min_severity",
     "events",
     "enabled",
     "pending",
     "last_delivery",
     "created_at",
     "updated_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^nch_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "EMAIL",
       "WEBHOOK"
      ]
     },
     "emails": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      }
     },
     "url": {
      "type": [
       "string",
       "null"
      ]
     },
     "has_secret": {
      "type": "boolean"
     },
     "min_severity": {
      "enum": [
       "INFO",
       "WARNING",
       "CRITICAL"
      ]
     },
     "events": {
      "type": "array",
      "items": {
       "enum": [
        "api_key.created",
        "api_key.revoked",
        "device.enrolled",
        "device.held",
        "device.hold_released",
        "device.offline",
        "device.online",
        "device.quarantined",
        "device.verification_failed",
        "emergency.cleared",
        "emergency.live",
        "incident.opened",
        "incident.status",
        "incident.updated",
        "maintenance.ended",
        "maintenance.opened",
        "membership.invited",
        "membership.joined",
        "membership.removed",
        "membership.updated",
        "release.deployed",
        "release.published",
        "release.revoked",
        "release.rolled_back",
        "release.rollout_completed",
        "release.rollout_halted",
        "release.rollout_started",
        "role.archived",
        "role.created",
        "role.updated",
        "screen.created",
        "screen.deleted",
        "sso.changed"
       ]
      }
     },
     "enabled": {
      "type": "boolean"
     },
     "pending": {
      "type": "integer",
      "minimum": 0
     },
     "last_delivery": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "status",
         "error",
         "at"
        ],
        "properties": {
         "status": {
          "enum": [
           "SENT",
           "FAILED"
          ]
         },
         "error": {
          "type": [
           "string",
           "null"
          ]
         },
         "at": {
          "type": "string",
          "format": "date-time"
         }
        }
       }
      ]
     },
     "secret": {
      "type": "string",
      "description": "The webhook signing secret: only when made or renewed"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "NotificationDelivery": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "event",
     "status",
     "attempts",
     "incident",
     "response_status",
     "last_error",
     "next_attempt_at",
     "sent_at",
     "created_at",
     "event_id",
     "redelivery_of"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ntf_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "event": {
      "enum": [
       "api_key.created",
       "api_key.revoked",
       "device.enrolled",
       "device.held",
       "device.hold_released",
       "device.offline",
       "device.online",
       "device.quarantined",
       "device.verification_failed",
       "emergency.cleared",
       "emergency.live",
       "incident.opened",
       "incident.status",
       "incident.updated",
       "maintenance.ended",
       "maintenance.opened",
       "membership.invited",
       "membership.joined",
       "membership.removed",
       "membership.updated",
       "release.deployed",
       "release.published",
       "release.revoked",
       "release.rolled_back",
       "release.rollout_completed",
       "release.rollout_halted",
       "release.rollout_started",
       "role.archived",
       "role.created",
       "role.updated",
       "screen.created",
       "screen.deleted",
       "sso.changed",
       "test"
      ]
     },
     "status": {
      "enum": [
       "PENDING",
       "SENT",
       "FAILED"
      ]
     },
     "attempts": {
      "type": "integer"
     },
     "incident": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "id",
         "number",
         "title"
        ],
        "properties": {
         "id": {
          "type": "string",
          "pattern": "^inc_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
         },
         "number": {
          "type": "integer"
         },
         "title": {
          "type": "string"
         }
        }
       }
      ]
     },
     "response_status": {
      "type": [
       "integer",
       "null"
      ]
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ]
     },
     "next_attempt_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "sent_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "event_id": {
      "type": "string",
      "pattern": "^evt_[0-9a-f-]{36}$",
      "description": "The event this delivery carries (X-UDD-Event-Id): the same for every try and redelivery"
     },
     "redelivery_of": {
      "type": [
       "string",
       "null"
      ],
      "description": "For a redelivery: the delivery it repeats"
     }
    }
   },
   "Rollout": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "release_id",
     "state",
     "current_wave",
     "wave_count",
     "waves",
     "stats"
    ],
    "properties": {
     "release_id": {
      "type": "string",
      "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "state": {
      "enum": [
       "ACTIVE",
       "HALTED",
       "COMPLETED",
       "ROLLED_BACK"
      ]
     },
     "current_wave": {
      "type": "integer",
      "minimum": 1
     },
     "wave_count": {
      "type": "integer",
      "minimum": 1
     },
     "wave_started_at": {
      "type": "string",
      "format": "date-time"
     },
     "next_promotion_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "waves": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "index": {
         "type": "integer",
         "minimum": 1
        },
        "kind": {
         "enum": [
          "CANARY",
          "PERCENT"
         ]
        },
        "percent": {
         "type": [
          "integer",
          "null"
         ]
        },
        "devices": {
         "type": "integer",
         "minimum": 0
        },
        "active": {
         "type": "integer",
         "minimum": 0
        },
        "failed": {
         "type": "integer",
         "minimum": 0
        },
        "pending": {
         "type": "integer",
         "minimum": 0
        },
        "offered": {
         "type": "boolean"
        }
       }
      }
     },
     "canary_group_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "auto_promote": {
      "type": "boolean"
     },
     "auto_rollback": {
      "type": "boolean"
     },
     "max_failure_percent": {
      "type": "integer"
     },
     "observe_minutes": {
      "type": "integer"
     },
     "halted_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "halted_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "rollback_release_ids": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^rel_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "stats": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "offered": {
        "type": "integer",
        "minimum": 0
       },
       "active": {
        "type": "integer",
        "minimum": 0
       },
       "failed": {
        "type": "integer",
        "minimum": 0
       },
       "offline": {
        "type": "integer",
        "minimum": 0
       },
       "pending": {
        "type": "integer",
        "minimum": 0
       }
      }
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "finished_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "devices": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "device_id": {
         "type": "string"
        },
        "screen_id": {
         "type": [
          "string",
          "null"
         ]
        },
        "screen_name": {
         "type": [
          "string",
          "null"
         ]
        },
        "wave": {
         "type": "integer",
         "minimum": 1
        },
        "status": {
         "enum": [
          "WAITING",
          "OFFERED",
          "ACTIVE",
          "FAILED",
          "OFFLINE"
         ]
        },
        "detail": {
         "type": [
          "string",
          "null"
         ]
        },
        "offered_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "activated_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "failed_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "previous_release_id": {
         "type": [
          "string",
          "null"
         ]
        },
        "active_release_id": {
         "type": [
          "string",
          "null"
         ]
        }
       }
      }
     }
    }
   },
   "Member": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "user_id",
     "email",
     "role",
     "site_ids",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^mbr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "user_id": {
      "type": "string",
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "email": {
      "type": [
       "string",
       "null"
      ]
     },
     "role": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "key": {
        "type": "string"
       },
       "name": {
        "type": "string"
       },
       "privileged": {
        "type": "boolean"
       }
      }
     },
     "site_ids": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string",
       "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "status": {
      "enum": [
       "active",
       "suspended"
      ]
     },
     "suspended_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "invited_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "last_seen_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "you": {
      "type": "boolean",
      "description": "This is the caller's own membership."
     }
    }
   },
   "Invitation": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "email",
     "role",
     "state"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^inv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "email": {
      "type": "string"
     },
     "role": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "key": {
        "type": "string"
       },
       "name": {
        "type": "string"
       }
      }
     },
     "site_ids": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string",
       "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
      }
     },
     "state": {
      "enum": [
       "OPEN",
       "ACCEPTED",
       "REVOKED",
       "EXPIRED"
      ]
     },
     "invited_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "accepted_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "link": {
      "type": [
       "string",
       "null"
      ],
      "description": "On create only: the link to accept (carries a one-time token). Never stored for idempotent replays."
     },
     "link_already_shown": {
      "type": "boolean"
     },
     "emailed": {
      "type": "boolean"
     }
    }
   },
   "PlatformTenant": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "status",
     "plan",
     "units",
     "used",
     "first_live_at",
     "minutes_to_first_live"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "status": {
      "enum": [
       "trial",
       "active",
       "suspended"
      ]
     },
     "suspended_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "trial_ends_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "plan": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "key": {
        "type": "string"
       },
       "name": {
        "type": "string"
       }
      }
     },
     "overage_policy": {
      "enum": [
       "BLOCK",
       "ALLOW"
      ]
     },
     "units": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Licence units now (sum of the ledger); null: no limit"
     },
     "used": {
      "type": "integer"
     },
     "members": {
      "type": "integer"
     },
     "over": {
      "type": "boolean"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "owners": {
      "type": "array",
      "items": {
       "type": [
        "string",
        "null"
       ]
      }
     },
     "features": {
      "type": "object",
      "additionalProperties": {
       "type": "boolean"
      }
     },
     "feature_overrides": {
      "type": "object",
      "additionalProperties": {
       "type": "boolean"
      }
     },
     "ledger": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^ent_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "units": {
         "type": "integer"
        },
        "kind": {
         "enum": [
          "PLAN",
          "GRANT",
          "ADJUST",
          "OPENING"
         ]
        },
        "reason": {
         "type": "string"
        },
        "plan": {
         "type": [
          "string",
          "null"
         ]
        },
        "expires_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "by": {
         "type": [
          "string",
          "null"
         ]
        },
        "created_at": {
         "type": "string",
         "format": "date-time"
        }
       }
      }
     },
     "owner_invitation_link": {
      "type": "string",
      "description": "On create only"
     },
     "first_live_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "minutes_to_first_live": {
      "type": [
       "integer",
       "null"
      ]
     },
     "suspended_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "W5.7 (TEN-12): suspended since"
     },
     "screens_pause_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "W5.7 (TEN-12): when its screens pause (they keep playing until then)"
     },
     "reseller": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "W5.23: the partner that runs it"
     }
    }
   },
   "Plan": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "key": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "units": {
      "type": [
       "integer",
       "null"
      ]
     },
     "features": {
      "type": "object",
      "additionalProperties": {
       "type": "boolean"
      }
     }
    }
   },
   "PlatformSettings": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "signups_open": {
      "type": "boolean"
     },
     "announcement": {
      "type": [
       "string",
       "null"
      ]
     },
     "suspension_playback_days": {
      "type": "integer",
      "minimum": 0,
      "maximum": 365,
      "description": "W5.7 (TEN-12): days a suspended organisation's screens keep playing (0: they pause at once)"
     }
    }
   },
   "Preferences": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "timezone",
     "locale"
    ],
    "properties": {
     "timezone": {
      "type": [
       "string",
       "null"
      ]
     },
     "locale": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "Dashboard": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "fleet",
     "releases",
     "connectors",
     "incidents",
     "getting_started",
     "generated_at"
    ],
    "properties": {
     "fleet": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "total",
         "online",
         "offline",
         "never_seen",
         "no_content",
         "with_problem",
         "held",
         "not_locked_down"
        ],
        "properties": {
         "total": {
          "type": "integer"
         },
         "online": {
          "type": "integer"
         },
         "offline": {
          "type": "integer"
         },
         "never_seen": {
          "type": "integer"
         },
         "no_content": {
          "type": "integer"
         },
         "with_problem": {
          "type": "integer"
         },
         "held": {
          "type": "integer"
         },
         "not_locked_down": {
          "type": "integer"
         }
        }
       }
      ]
     },
     "releases": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "latest",
         "showing_content",
         "on_latest",
         "rollouts"
        ],
        "properties": {
         "latest": {
          "oneOf": [
           {
            "type": "null"
           },
           {
            "type": "object",
            "additionalProperties": false,
            "required": [
             "id",
             "sequence",
             "created_at"
            ],
            "properties": {
             "id": {
              "type": "string"
             },
             "sequence": {
              "type": "integer"
             },
             "created_at": {
              "type": [
               "string",
               "null"
              ],
              "format": "date-time"
             }
            }
           }
          ]
         },
         "showing_content": {
          "type": "integer"
         },
         "on_latest": {
          "type": "integer"
         },
         "rollouts": {
          "type": "array",
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "release_id",
            "sequence",
            "state",
            "wave",
            "waves",
            "halted_reason",
            "devices",
            "active",
            "offered",
            "failed",
            "updated_at"
           ],
           "properties": {
            "release_id": {
             "type": "string"
            },
            "sequence": {
             "type": "integer"
            },
            "state": {
             "type": "string",
             "enum": [
              "ACTIVE",
              "HALTED",
              "COMPLETED",
              "ROLLED_BACK"
             ]
            },
            "wave": {
             "type": "integer"
            },
            "waves": {
             "type": "integer"
            },
            "halted_reason": {
             "type": [
              "string",
              "null"
             ]
            },
            "devices": {
             "type": "integer"
            },
            "active": {
             "type": "integer"
            },
            "offered": {
             "type": "integer"
            },
            "failed": {
             "type": "integer"
            },
            "updated_at": {
             "type": [
              "string",
              "null"
             ],
             "format": "date-time"
            }
           }
          }
         }
        }
       }
      ]
     },
     "connectors": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "total",
         "ok",
         "stale",
         "failing",
         "waiting",
         "disabled",
         "problems"
        ],
        "properties": {
         "total": {
          "type": "integer"
         },
         "ok": {
          "type": "integer"
         },
         "stale": {
          "type": "integer"
         },
         "failing": {
          "type": "integer"
         },
         "waiting": {
          "type": "integer"
         },
         "disabled": {
          "type": "integer"
         },
         "problems": {
          "type": "array",
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "id",
            "name",
            "kind",
            "health",
            "last_success_at",
            "last_error",
            "failures"
           ],
           "properties": {
            "id": {
             "type": "string"
            },
            "name": {
             "type": "string"
            },
            "kind": {
             "type": "string"
            },
            "health": {
             "type": "string",
             "enum": [
              "failing",
              "stale"
             ]
            },
            "last_success_at": {
             "type": [
              "string",
              "null"
             ],
             "format": "date-time"
            },
            "last_error": {
             "type": [
              "string",
              "null"
             ]
            },
            "failures": {
             "type": "integer"
            }
           }
          }
         }
        }
       }
      ]
     },
     "incidents": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "critical",
         "warning",
         "info",
         "latest"
        ],
        "properties": {
         "critical": {
          "type": "integer"
         },
         "warning": {
          "type": "integer"
         },
         "info": {
          "type": "integer"
         },
         "latest": {
          "type": "array",
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "id",
            "title",
            "severity",
            "status",
            "opened_at"
           ],
           "properties": {
            "id": {
             "type": "string"
            },
            "title": {
             "type": "string"
            },
            "severity": {
             "type": "string"
            },
            "status": {
             "type": "string"
            },
            "opened_at": {
             "type": [
              "string",
              "null"
             ],
             "format": "date-time"
            }
           }
          }
         }
        }
       }
      ]
     },
     "getting_started": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "steps",
       "done",
       "total",
       "tenant_created_at",
       "first_enrolled_at",
       "first_live_at",
       "minutes_to_first_live"
      ],
      "properties": {
       "steps": {
        "type": "array",
        "items": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "key",
          "done",
          "tab"
         ],
         "properties": {
          "key": {
           "type": "string",
           "enum": [
            "site",
            "screen",
            "enroll",
            "media",
            "layout",
            "publish",
            "live"
           ]
          },
          "done": {
           "type": "boolean"
          },
          "tab": {
           "type": "string"
          }
         }
        }
       },
       "done": {
        "type": "integer"
       },
       "total": {
        "type": "integer"
       },
       "tenant_created_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "first_enrolled_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "first_live_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       },
       "minutes_to_first_live": {
        "type": [
         "integer",
         "null"
        ]
       }
      }
     },
     "generated_at": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "AssetUpload": {
    "type": "object",
    "description": "W3.10 (CMS-01): an upload in chunks that resumes.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^upl_[0-9a-f-]{36}$"
     },
     "name": {
      "type": "string"
     },
     "size": {
      "type": "integer"
     },
     "offset": {
      "type": "integer",
      "description": "bytes received so far: the next chunk starts here"
     },
     "chunk_bytes": {
      "type": "integer",
      "description": "the largest chunk accepted"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     }
    },
    "required": [
     "id",
     "name",
     "size",
     "offset",
     "chunk_bytes",
     "expires_at"
    ],
    "additionalProperties": false
   },
   "AlertTemplate": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "severity",
     "headline",
     "body",
     "instruction",
     "background",
     "foreground",
     "flash",
     "duration_minutes",
     "version",
     "approved",
     "approved_by",
     "approved_at",
     "updated_by",
     "updated_at",
     "sound"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ],
      "description": "CAP severity"
     },
     "headline": {
      "type": "object",
      "maxProperties": 4,
      "propertyNames": {
       "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
      },
      "additionalProperties": {
       "type": [
        "string",
        "null"
       ]
      },
      "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
     },
     "body": {
      "oneOf": [
       {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       {
        "type": "null"
       }
      ]
     },
     "instruction": {
      "oneOf": [
       {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       {
        "type": "null"
       }
      ]
     },
     "background": {
      "type": "string",
      "pattern": "^#[0-9A-F]{6}$"
     },
     "foreground": {
      "type": "string",
      "pattern": "^#[0-9A-F]{6}$"
     },
     "flash": {
      "type": "boolean"
     },
     "duration_minutes": {
      "type": "integer",
      "minimum": 5,
      "maximum": 1440
     },
     "version": {
      "type": "integer",
      "minimum": 1
     },
     "approved": {
      "type": "boolean",
      "description": "Only approved templates can be broadcast; any change makes it unapproved"
     },
     "approved_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "approved_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "updated_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "updated_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     }
    }
   },
   "AlertTemplateInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ],
      "description": "CAP severity"
     },
     "headline": {
      "type": "object",
      "maxProperties": 4,
      "propertyNames": {
       "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
      },
      "additionalProperties": {
       "type": [
        "string",
        "null"
       ]
      },
      "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
     },
     "body": {
      "oneOf": [
       {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       {
        "type": "null"
       }
      ]
     },
     "instruction": {
      "oneOf": [
       {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       {
        "type": "null"
       }
      ]
     },
     "background": {
      "type": "string",
      "pattern": "^#[0-9A-Fa-f]{6}$"
     },
     "foreground": {
      "type": "string",
      "pattern": "^#[0-9A-Fa-f]{6}$"
     },
     "flash": {
      "type": "boolean"
     },
     "duration_minutes": {
      "type": "integer",
      "minimum": 5,
      "maximum": 1440
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     }
    }
   },
   "Emergency": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "template_id",
     "template_name",
     "template_version",
     "mode",
     "severity",
     "message",
     "style",
     "target",
     "screens",
     "fetched",
     "shown",
     "refused",
     "duration_minutes",
     "status",
     "requested_by",
     "requested_at",
     "confirm_before",
     "confirmed_by",
     "confirmed_at",
     "expires_at",
     "cleared_by",
     "cleared_at",
     "cancelled_at",
     "sha256",
     "feed_id",
     "sound"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "template_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "template_name": {
      "type": "string"
     },
     "template_version": {
      "type": "integer"
     },
     "mode": {
      "enum": [
       "LIVE",
       "DRILL"
      ]
     },
     "severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ],
      "description": "CAP severity"
     },
     "message": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "headline"
      ],
      "properties": {
       "headline": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       "body": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       "instruction": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       }
      }
     },
     "style": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "background",
       "foreground",
       "flash"
      ],
      "properties": {
       "background": {
        "type": "string"
       },
       "foreground": {
        "type": "string"
       },
       "flash": {
        "type": "boolean"
       }
      }
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     },
     "screens": {
      "type": "integer",
      "description": "Devices it was (or will be) signed for"
     },
     "fetched": {
      "type": "integer"
     },
     "shown": {
      "type": "integer"
     },
     "refused": {
      "type": "integer"
     },
     "duration_minutes": {
      "type": "integer"
     },
     "status": {
      "enum": [
       "awaiting",
       "not_confirmed",
       "live",
       "ended",
       "cleared",
       "cancelled"
      ],
      "description": "awaiting: a second person must confirm it (within 15 minutes); not_confirmed: nobody did; live: on screens; ended: expired; cleared; cancelled"
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "requested_at": {
      "type": "string",
      "format": "date-time"
     },
     "confirm_before": {
      "type": "string",
      "format": "date-time"
     },
     "confirmed_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "confirmed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "cleared_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "cleared_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "cancelled_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "sha256": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 of the signed SHOW document (udd.emergency v1)"
     },
     "feed_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     }
    }
   },
   "EmergencyDetail": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "template_id",
     "template_name",
     "template_version",
     "mode",
     "severity",
     "message",
     "style",
     "target",
     "screens",
     "fetched",
     "shown",
     "refused",
     "duration_minutes",
     "status",
     "requested_by",
     "requested_at",
     "confirm_before",
     "confirmed_by",
     "confirmed_at",
     "expires_at",
     "cleared_by",
     "cleared_at",
     "cancelled_at",
     "sha256",
     "deliveries",
     "feed_id",
     "sound"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "template_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^atpl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "template_name": {
      "type": "string"
     },
     "template_version": {
      "type": "integer"
     },
     "mode": {
      "enum": [
       "LIVE",
       "DRILL"
      ]
     },
     "severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ],
      "description": "CAP severity"
     },
     "message": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "headline"
      ],
      "properties": {
       "headline": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       "body": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       },
       "instruction": {
        "type": "object",
        "maxProperties": 4,
        "propertyNames": {
         "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
        },
        "additionalProperties": {
         "type": [
          "string",
          "null"
         ]
        },
        "description": "Text by language (en, hi, en-IN …): 1..4 languages, plain text"
       }
      }
     },
     "style": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "background",
       "foreground",
       "flash"
      ],
      "properties": {
       "background": {
        "type": "string"
       },
       "foreground": {
        "type": "string"
       },
       "flash": {
        "type": "boolean"
       }
      }
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     },
     "screens": {
      "type": "integer",
      "description": "Devices it was (or will be) signed for"
     },
     "fetched": {
      "type": "integer"
     },
     "shown": {
      "type": "integer"
     },
     "refused": {
      "type": "integer"
     },
     "duration_minutes": {
      "type": "integer"
     },
     "status": {
      "enum": [
       "awaiting",
       "not_confirmed",
       "live",
       "ended",
       "cleared",
       "cancelled"
      ],
      "description": "awaiting: a second person must confirm it (within 15 minutes); not_confirmed: nobody did; live: on screens; ended: expired; cleared; cancelled"
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "requested_at": {
      "type": "string",
      "format": "date-time"
     },
     "confirm_before": {
      "type": "string",
      "format": "date-time"
     },
     "confirmed_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "confirmed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "cleared_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "cleared_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "cancelled_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "sha256": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 of the signed SHOW document (udd.emergency v1)"
     },
     "deliveries": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "device_id",
        "screen_id",
        "screen",
        "site",
        "fetched_at",
        "shown_at",
        "ended_at",
        "refused",
        "last_seen_at"
       ],
       "properties": {
        "device_id": {
         "type": "string",
         "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "screen_id": {
         "type": [
          "string",
          "null"
         ],
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "screen": {
         "type": [
          "string",
          "null"
         ]
        },
        "site": {
         "type": [
          "string",
          "null"
         ]
        },
        "fetched_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "shown_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "ended_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "refused": {
         "type": [
          "string",
          "null"
         ]
        },
        "last_seen_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        }
       }
      }
     },
     "feed_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     }
    }
   },
   "EmergencySettings": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "two_person"
    ],
    "properties": {
     "two_person": {
      "type": "boolean",
      "description": "A broadcast needs a second person to confirm it, and a template another person to approve it (default true)"
     }
    }
   },
   "AlertFeed": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "url",
     "min_severity",
     "exercises",
     "target",
     "in_area",
     "unlocated",
     "confirm",
     "sound",
     "max_minutes",
     "interval_seconds",
     "enabled",
     "last_attempt_at",
     "last_success_at",
     "last_error",
     "failures",
     "updated_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^afd_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "url": {
      "type": "string",
      "description": "An RSS or Atom list of CAP 1.2 messages, or one CAP message, on an allow-listed host"
     },
     "min_severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ]
     },
     "exercises": {
      "type": "boolean",
      "description": "Exercise messages are shown as drills"
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     },
     "in_area": {
      "type": "boolean",
      "description": "Only screens whose site lies in the alert's polygons or circles"
     },
     "unlocated": {
      "type": "boolean",
      "description": "With in_area: also sites without a location"
     },
     "confirm": {
      "type": "boolean",
      "description": "A person confirms each alert before it goes out"
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     },
     "max_minutes": {
      "type": "integer"
     },
     "interval_seconds": {
      "type": "integer"
     },
     "enabled": {
      "type": "boolean"
     },
     "last_attempt_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_success_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ]
     },
     "failures": {
      "type": "integer"
     },
     "updated_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "AlertFeedInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string"
     },
     "url": {
      "type": "string",
      "description": "An RSS or Atom list of CAP 1.2 messages, or one CAP message, on an allow-listed host"
     },
     "min_severity": {
      "enum": [
       "EXTREME",
       "SEVERE",
       "MODERATE",
       "MINOR"
      ]
     },
     "exercises": {
      "type": "boolean",
      "description": "Exercise messages are shown as drills"
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     },
     "in_area": {
      "type": "boolean",
      "description": "Only screens whose site lies in the alert's polygons or circles"
     },
     "unlocated": {
      "type": "boolean",
      "description": "With in_area: also sites without a location"
     },
     "confirm": {
      "type": "boolean",
      "description": "A person confirms each alert before it goes out"
     },
     "sound": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "chime",
       "siren",
       null
      ],
      "description": "A sound when it comes on screen (players 1.12.0 and later)"
     },
     "max_minutes": {
      "type": "integer"
     },
     "interval_seconds": {
      "type": "integer"
     },
     "enabled": {
      "type": "boolean"
     }
    }
   },
   "AlertFeedItem": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "link",
     "identifier",
     "sender",
     "sent_at",
     "msg_type",
     "status",
     "severity",
     "event",
     "headline",
     "area",
     "expires_at",
     "outcome",
     "emergency_id",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^afi_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "link": {
      "type": "string"
     },
     "identifier": {
      "type": [
       "string",
       "null"
      ]
     },
     "sender": {
      "type": [
       "string",
       "null"
      ]
     },
     "sent_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "msg_type": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ]
     },
     "severity": {
      "type": [
       "string",
       "null"
      ]
     },
     "event": {
      "type": [
       "string",
       "null"
      ]
     },
     "headline": {
      "type": [
       "string",
       "null"
      ]
     },
     "area": {
      "type": [
       "string",
       "null"
      ]
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "outcome": {
      "type": "string",
      "description": "What became of it: on screens, waiting for a person, or why not shown"
     },
     "emergency_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^emg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "DisplayRules": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "on",
     "closed",
     "volume",
     "brightness"
    ],
    "properties": {
     "on": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "days",
        "from",
        "to"
       ],
       "properties": {
        "days": {
         "type": "array",
         "items": {
          "type": "integer",
          "minimum": 1,
          "maximum": 7
         }
        },
        "from": {
         "type": "string",
         "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
        },
        "to": {
         "type": "string",
         "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
        },
        "level": {
         "type": "integer",
         "minimum": 0,
         "maximum": 100
        }
       }
      },
      "description": "When on (ISO weekdays, site time); none: always on"
     },
     "closed": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "date"
      }
     },
     "volume": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "level",
       "windows"
      ],
      "properties": {
       "level": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100
       },
       "windows": {
        "type": "array",
        "items": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "days",
          "from",
          "to"
         ],
         "properties": {
          "days": {
           "type": "array",
           "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
           }
          },
          "from": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "to": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
          },
          "level": {
           "type": "integer",
           "minimum": 0,
           "maximum": 100
          }
         }
        }
       }
      }
     },
     "brightness": {
      "type": [
       "object",
       "null"
      ],
      "additionalProperties": false,
      "required": [
       "level",
       "windows"
      ],
      "properties": {
       "level": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100
       },
       "windows": {
        "type": "array",
        "items": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "days",
          "from",
          "to"
         ],
         "properties": {
          "days": {
           "type": "array",
           "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
           }
          },
          "from": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "to": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
          },
          "level": {
           "type": "integer",
           "minimum": 0,
           "maximum": 100
          }
         }
        }
       }
      }
     }
    }
   },
   "DisplaySchedule": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "name",
     "rules",
     "target",
     "version",
     "updated_by",
     "updated_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^dsch_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "rules": {
      "$ref": "#/components/schemas/DisplayRules"
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     },
     "version": {
      "type": "integer"
     },
     "updated_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "screens": {
      "type": "integer",
      "description": "Screens that follow it (index only)"
     }
    }
   },
   "DisplayScheduleInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "rules": {
      "type": "object",
      "additionalProperties": false,
      "required": [],
      "properties": {
       "on": {
        "type": "array",
        "items": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "days",
          "from",
          "to"
         ],
         "properties": {
          "days": {
           "type": "array",
           "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
           }
          },
          "from": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "to": {
           "type": "string",
           "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
          },
          "level": {
           "type": "integer",
           "minimum": 0,
           "maximum": 100
          }
         }
        },
        "description": "When on (ISO weekdays, site time); none: always on"
       },
       "closed": {
        "type": "array",
        "items": {
         "type": "string",
         "format": "date"
        }
       },
       "volume": {
        "type": [
         "object",
         "null"
        ],
        "additionalProperties": false,
        "required": [
         "level",
         "windows"
        ],
        "properties": {
         "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
         },
         "windows": {
          "type": "array",
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "days",
            "from",
            "to"
           ],
           "properties": {
            "days": {
             "type": "array",
             "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 7
             }
            },
            "from": {
             "type": "string",
             "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            },
            "to": {
             "type": "string",
             "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
            },
            "level": {
             "type": "integer",
             "minimum": 0,
             "maximum": 100
            }
           }
          }
         }
        }
       },
       "brightness": {
        "type": [
         "object",
         "null"
        ],
        "additionalProperties": false,
        "required": [
         "level",
         "windows"
        ],
        "properties": {
         "level": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
         },
         "windows": {
          "type": "array",
          "items": {
           "type": "object",
           "additionalProperties": false,
           "required": [
            "days",
            "from",
            "to"
           ],
           "properties": {
            "days": {
             "type": "array",
             "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 7
             }
            },
            "from": {
             "type": "string",
             "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            },
            "to": {
             "type": "string",
             "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$|^24:00$"
            },
            "level": {
             "type": "integer",
             "minimum": 0,
             "maximum": 100
            }
           }
          }
         }
        }
       }
      }
     },
     "target": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^site_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "group_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^grp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string",
         "pattern": "^scr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        }
       }
      }
     }
    }
   },
   "Campaign": {
    "type": "object",
    "description": "W5.6 (CMS-08, ADV-01/03/05; ADR-065): a layout version on its target screens between two dates (optionally at set hours and days), at a priority, as a CAMPAIGN rule in signed releases.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^cmp_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "advertising",
       "operational"
      ]
     },
     "advertiser": {
      "type": [
       "string",
       "null"
      ]
     },
     "layout_id": {
      "type": "string"
     },
     "priority": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000
     },
     "start_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "end_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "start_time": {
      "type": [
       "string",
       "null"
      ]
     },
     "end_time": {
      "type": [
       "string",
       "null"
      ]
     },
     "days": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "enum": [
        "MO",
        "TU",
        "WE",
        "TH",
        "FR",
        "SA",
        "SU"
       ]
      }
     },
     "targets": {
      "type": "object",
      "properties": {
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "zone_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "tags": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      },
      "additionalProperties": false,
      "required": [
       "site_ids",
       "zone_ids",
       "screen_ids",
       "tags"
      ]
     },
     "status": {
      "enum": [
       "draft",
       "active",
       "paused",
       "ended"
      ]
     },
     "screens": {
      "type": "integer",
      "description": "screens it reaches now"
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "started_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "ended_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "deliveries": {
      "type": "object",
      "description": "after a start, pause or end: releases made, and groups of screens that could not be served",
      "properties": {
       "built": {
        "type": "integer"
       },
       "problems": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      },
      "required": [
       "built",
       "problems"
      ],
      "additionalProperties": false
     },
     "layout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "name",
       "version",
       "newer"
      ],
      "description": "The layout version it shows; newer: a version of the same layout saved since (the campaign keeps its own until given another)",
      "properties": {
       "name": {
        "type": "string"
       },
       "version": {
        "type": [
         "integer",
         "null"
        ]
       },
       "newer": {
        "type": [
         "object",
         "null"
        ],
        "additionalProperties": false,
        "properties": {
         "layout_id": {
          "type": "string"
         },
         "version": {
          "type": "integer"
         }
        }
       }
      }
     }
    },
    "required": [
     "id",
     "name",
     "kind",
     "advertiser",
     "layout_id",
     "priority",
     "start_date",
     "end_date",
     "start_time",
     "end_time",
     "days",
     "targets",
     "status",
     "screens",
     "created_by",
     "created_at",
     "updated_at",
     "started_at",
     "ended_at"
    ],
    "additionalProperties": false
   },
   "CampaignInput": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
     },
     "kind": {
      "enum": [
       "advertising",
       "operational"
      ]
     },
     "advertiser": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 200
     },
     "layout_id": {
      "type": "string"
     },
     "priority": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000
     },
     "start_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "end_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "start_time": {
      "type": [
       "string",
       "null"
      ]
     },
     "end_time": {
      "type": [
       "string",
       "null"
      ]
     },
     "days": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "enum": [
        "MO",
        "TU",
        "WE",
        "TH",
        "FR",
        "SA",
        "SU"
       ]
      }
     },
     "targets": {
      "type": "object",
      "properties": {
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "zone_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "tags": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      },
      "additionalProperties": false
     }
    },
    "additionalProperties": false
   },
   "MaintenanceSession": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.8 (SEC-04, ADR-067): a remote maintenance session on one device.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "device_id": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "status": {
      "enum": [
       "pending_approval",
       "rejected",
       "cancelled",
       "expired",
       "opening",
       "open",
       "ended",
       "verified",
       "unverified"
      ],
      "description": "pending_approval: waits for a second person; opening: the signed grant waits for the device; open: the device opened it; ended: over (time up, ended early, or the device could not open it), waiting for the device to report remote access closed; verified: it did; unverified: it did not within 30 minutes (a security incident is raised)"
     },
     "reason": {
      "type": "string"
     },
     "scope": {
      "enum": [
       "shell",
       "admin",
       "view"
      ],
      "description": "view (W5.11): opens nothing on the device (no SSH, key or networks); it allows troubleshooting reports"
     },
     "minutes": {
      "type": "integer",
      "minimum": 15,
      "maximum": 480
     },
     "source_cidrs": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "ssh_public_key": {
      "type": [
       "string",
       "null"
      ]
     },
     "key_fingerprint": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^SHA256:[A-Za-z0-9+/]{43}$"
     },
     "key_generated": {
      "type": "boolean",
      "description": "The key was made for this session; its private half was in the answer to the request only"
     },
     "port": {
      "type": [
       "integer",
       "null"
      ]
     },
     "user": {
      "type": [
       "string",
       "null"
      ]
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "requested_at": {
      "type": "string",
      "format": "date-time"
     },
     "decided_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "decision_note": {
      "type": [
       "string",
       "null"
      ]
     },
     "opened_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "ends_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "ended_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "end_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "device_detail": {
      "type": [
       "string",
       "null"
      ]
     },
     "verified_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "verification": {
      "type": [
       "string",
       "null"
      ]
     },
     "private_key": {
      "type": "string",
      "description": "Only in the answer to a request without ssh_public_key: the OpenSSH private key made for this session. It is not stored."
     }
    },
    "required": [
     "id",
     "device_id",
     "status",
     "reason",
     "scope",
     "minutes",
     "source_cidrs",
     "ssh_public_key",
     "key_fingerprint",
     "key_generated",
     "port",
     "user",
     "requested_at",
     "ends_at",
     "ended_at"
    ]
   },
   "MaintenanceWindow": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.10 (FLT-09, ADR-069): planned work on some screens; incidents only about them opened during it send no notifications (security incidents always do); those still open when it is over are notified then.",
    "required": [
     "id",
     "name",
     "targets",
     "starts_at",
     "ends_at",
     "state",
     "incidents",
     "muted_now"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^mw_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "targets": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "all": {
        "type": "boolean"
       },
       "site_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "zone_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "screen_ids": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "tags": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      }
     },
     "starts_at": {
      "type": "string",
      "format": "date-time"
     },
     "ends_at": {
      "type": "string",
      "format": "date-time"
     },
     "state": {
      "enum": [
       "planned",
       "active",
       "ended"
      ]
     },
     "incidents": {
      "type": "integer"
     },
     "muted_now": {
      "type": "integer"
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "cancelled_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "Diagnostics": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.11 (FLT-13, PLR-16, ADR-070): one request to one device for a picture of its screen, or (during a maintenance session) a troubleshooting report. What the device sent is kept for 7 days, then emptied (purged_at).",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^dgn_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "device_id": {
      "type": "string",
      "pattern": "^dev_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "kind": {
      "enum": [
       "screenshot",
       "full"
      ]
     },
     "session_id": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^mnt_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "status": {
      "enum": [
       "waiting",
       "received",
       "failed",
       "refused",
       "expired"
      ]
     },
     "detail": {
      "type": [
       "string",
       "null"
      ],
      "description": "What the device said, when it did not send anything"
     },
     "requested_by": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "requested_at": {
      "type": "string",
      "format": "date-time"
     },
     "received_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "purged_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "note": {
      "type": [
       "string",
       "null"
      ],
      "description": "Why there is no picture, or what was not kept"
     },
     "screenshot": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "type",
         "width",
         "height"
        ],
        "properties": {
         "type": {
          "enum": [
           "image/jpeg",
           "image/png"
          ]
         },
         "width": {
          "type": "integer"
         },
         "height": {
          "type": "integer"
         }
        }
       }
      ]
     },
     "state": {
      "type": [
       "object",
       "null"
      ],
      "description": "Full reports, to device.troubleshoot only: what the player is doing (release, state, cache, clock, outbox, display, lockdown)"
     },
     "logs": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      },
      "description": "Full reports, to device.troubleshoot only: the player's (and the Linux agent's) recent log, secrets hidden"
     },
     "content_hidden": {
      "type": "boolean",
      "description": "There is a state or log this user may not see"
     }
    },
    "required": [
     "id",
     "device_id",
     "kind",
     "session_id",
     "status",
     "detail",
     "requested_by",
     "requested_at",
     "received_at",
     "purged_at",
     "note",
     "screenshot"
    ]
   },
   "EnrollmentBatch": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.13 (ONB-08): screens from one CSV import with pre-generated enrolment codes (never shown again)",
    "required": [
     "id",
     "name",
     "screens",
     "created_screens",
     "enrolled",
     "state",
     "expires_at",
     "created_by",
     "created_at",
     "revoked_at",
     "outside_my_sites",
     "waiting"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^enb_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "screens": {
      "type": "integer"
     },
     "created_screens": {
      "type": "integer"
     },
     "enrolled": {
      "type": "integer"
     },
     "state": {
      "enum": [
       "open",
       "done",
       "expired",
       "revoked"
      ]
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "created_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "outside_my_sites": {
      "type": "boolean",
      "description": "Some of its screens are in sites this person does not work in"
     },
     "screen_list": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "screen_id",
        "name",
        "site",
        "status",
        "enrolled_at"
       ],
       "properties": {
        "screen_id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "site": {
         "type": "string"
        },
        "status": {
         "enum": [
          "waiting",
          "enrolled",
          "expired",
          "revoked"
         ]
        },
        "enrolled_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        }
       }
      }
     },
     "waiting": {
      "type": "integer",
      "description": "Codes still usable"
     }
    }
   },
   "Role": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.14 (TEN-05): a role the organisation can give: built-in, or its own (custom, key c_…)",
    "required": [
     "key",
     "name",
     "description",
     "custom",
     "privileged",
     "permissions",
     "members",
     "yours_to_give",
     "archived_at"
    ],
    "properties": {
     "key": {
      "type": "string",
      "pattern": "^([a-z_]{2,48}|c_[0-9a-f]{32})$"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "custom": {
      "type": "boolean"
     },
     "privileged": {
      "type": "boolean",
      "description": "Needs a second sign-in step"
     },
     "permissions": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "members": {
      "type": "integer"
     },
     "yours_to_give": {
      "type": "boolean",
      "description": "This person may give it (a custom role: they hold all its permissions)"
     },
     "archived_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "CatalogEvent": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.15 (API-06; ADR-074): an event of the catalog, as webhooks carry it and the feed lists it",
    "required": [
     "id",
     "type",
     "version",
     "occurred_at",
     "sequence",
     "tenant_id",
     "actor",
     "subject",
     "result",
     "data"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^evt_[0-9a-f-]{36}$"
     },
     "type": {
      "enum": [
       "api_key.created",
       "api_key.revoked",
       "device.enrolled",
       "device.held",
       "device.hold_released",
       "device.offline",
       "device.online",
       "device.quarantined",
       "device.verification_failed",
       "emergency.cleared",
       "emergency.live",
       "incident.opened",
       "incident.status",
       "maintenance.ended",
       "maintenance.opened",
       "membership.invited",
       "membership.joined",
       "membership.removed",
       "membership.updated",
       "release.deployed",
       "release.published",
       "release.revoked",
       "release.rolled_back",
       "release.rollout_completed",
       "release.rollout_halted",
       "release.rollout_started",
       "role.archived",
       "role.created",
       "role.updated",
       "screen.created",
       "screen.deleted",
       "sso.changed"
      ]
     },
     "version": {
      "type": "string"
     },
     "occurred_at": {
      "type": "string",
      "format": "date-time"
     },
     "sequence": {
      "type": "integer",
      "minimum": 1,
      "description": "The audit log's order"
     },
     "tenant_id": {
      "type": "string"
     },
     "actor": {
      "type": "object",
      "required": [
       "type",
       "id"
      ],
      "properties": {
       "type": {
        "type": "string"
       },
       "id": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "subject": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "required": [
         "type",
         "id"
        ],
        "properties": {
         "type": {
          "type": "string"
         },
         "id": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       }
      ]
     },
     "result": {
      "enum": [
       "SUCCESS",
       "FAILURE",
       "DENIED"
      ]
     },
     "data": {
      "type": "object",
      "description": "Only the fields the catalog lists for the type"
     }
    }
   },
   "ContentTemplate": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.16 (CMS-18, DCV-12; ADR-075): a layout template or a block, the platform's or the organisation's",
    "required": [
     "id",
     "kind",
     "name",
     "description",
     "category",
     "platform",
     "brand_locked",
     "width",
     "height",
     "logo",
     "created_at",
     "updated_at",
     "archived_at"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "enum": [
       "LAYOUT",
       "BLOCK"
      ]
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "category": {
      "enum": [
       "basics",
       "reception",
       "corporate",
       "food",
       "retail",
       "manufacturing",
       "education",
       "healthcare",
       "data",
       "other"
      ]
     },
     "platform": {
      "type": "boolean"
     },
     "brand_locked": {
      "type": "boolean"
     },
     "width": {
      "type": "integer"
     },
     "height": {
      "type": "integer"
     },
     "logo": {
      "type": "boolean",
      "description": "Has a place for the brand kit's logo"
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "updated_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "archived_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "content": {
      "type": "object",
      "description": "GET one only: a scene (LAYOUT) or {width, height, widgets, styles, dataSources, fonts} (BLOCK), with the brand kit applied unless ?branded=0"
     }
    }
   },
   "BrandKit": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.16 (CMS-19): the organisation's colours, fonts and logo, applied to templates and blocks",
    "required": [
     "colors",
     "heading_font",
     "body_font",
     "logo_asset_id",
     "updated_at"
    ],
    "properties": {
     "colors": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "primary": {
        "type": "string",
        "pattern": "^#[0-9A-Fa-f]{6}$"
       },
       "secondary": {
        "type": "string",
        "pattern": "^#[0-9A-Fa-f]{6}$"
       },
       "accent": {
        "type": "string",
        "pattern": "^#[0-9A-Fa-f]{6}$"
       },
       "background": {
        "type": "string",
        "pattern": "^#[0-9A-Fa-f]{6}$"
       },
       "text": {
        "type": "string",
        "pattern": "^#[0-9A-Fa-f]{6}$"
       }
      }
     },
     "heading_font": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "asset_id",
         "family"
        ],
        "properties": {
         "asset_id": {
          "type": "string"
         },
         "family": {
          "type": "string",
          "pattern": "^[A-Za-z0-9 _-]{1,64}$"
         }
        }
       }
      ]
     },
     "body_font": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "asset_id",
         "family"
        ],
        "properties": {
         "asset_id": {
          "type": "string"
         },
         "family": {
          "type": "string",
          "pattern": "^[A-Za-z0-9 _-]{1,64}$"
         }
        }
       }
      ]
     },
     "logo_asset_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "updated_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "PlaylistTime": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "start",
     "end"
    ],
    "description": "W5.17 (SCH-10): shown only between these local times (\"HH:MM\"; start after end spans midnight)",
    "properties": {
     "start": {
      "type": "string",
      "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
     },
     "end": {
      "type": "string",
      "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
     }
    }
   },
   "PlaylistMediaItem": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "assetId": {
      "type": "string",
      "pattern": "^ast_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "durationMs": {
      "type": "integer",
      "minimum": 1000,
      "maximum": 86400000
     },
     "fit": {
      "enum": [
       "CONTAIN",
       "COVER",
       "FILL"
      ]
     },
     "transition": {
      "enum": [
       "NONE",
       "FADE",
       "SLIDE_LEFT",
       "SLIDE_UP"
      ]
     },
     "playToEnd": {
      "type": "boolean"
     },
     "sound": {
      "type": "boolean",
      "description": "W3.9c: a video plays with its sound (false: muted)."
     },
     "between": {
      "$ref": "#/components/schemas/PlaylistTime"
     },
     "everyMinutes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1440,
      "description": "W5.17 (SCH-10): comes round at least this often"
     }
    },
    "required": [
     "assetId",
     "durationMs",
     "fit",
     "transition",
     "playToEnd",
     "sound"
    ]
   },
   "PlaylistTagItem": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "tag",
     "durationMs",
     "fit",
     "transition",
     "order",
     "limit"
    ],
    "description": "W5.17 (CMS-27): the images, videos and PDFs with this tag",
    "properties": {
     "tag": {
      "type": "string",
      "pattern": "^[\\p{L}\\p{N}][\\p{L}\\p{N}-]{0,31}$"
     },
     "durationMs": {
      "type": "integer",
      "minimum": 1000,
      "maximum": 86400000
     },
     "fit": {
      "enum": [
       "CONTAIN",
       "COVER",
       "FILL"
      ]
     },
     "transition": {
      "enum": [
       "NONE",
       "FADE",
       "SLIDE_LEFT",
       "SLIDE_UP"
      ]
     },
     "order": {
      "enum": [
       "NAME",
       "NEWEST"
      ]
     },
     "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50
     },
     "between": {
      "$ref": "#/components/schemas/PlaylistTime"
     }
    }
   },
   "PlaylistNestedItem": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "playlistId"
    ],
    "description": "W5.17 (SCH-10): another playlist, in place (at most 3 deep)",
    "properties": {
     "playlistId": {
      "type": "string",
      "pattern": "^pl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "between": {
      "$ref": "#/components/schemas/PlaylistTime"
     }
    }
   },
   "FolderSharing": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "restricted",
     "members"
    ],
    "properties": {
     "restricted": {
      "type": "boolean"
     },
     "members": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "user_id",
        "email",
        "name",
        "role",
        "access",
        "external"
       ],
       "properties": {
        "user_id": {
         "type": "string"
        },
        "email": {
         "type": "string"
        },
        "name": {
         "type": [
          "string",
          "null"
         ]
        },
        "role": {
         "type": [
          "string",
          "null"
         ]
        },
        "access": {
         "enum": [
          "READ",
          "WRITE"
         ]
        },
        "external": {
         "type": "boolean"
        }
       }
      }
     }
    }
   },
   "Widget": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.20 (DCV-09, ADR-079): one version of an HTML widget (\"app\"): a checked ZIP file with index.html; screens show it in a sandbox with no network.",
    "required": [
     "id",
     "name",
     "version",
     "sha256",
     "size",
     "files",
     "fields",
     "created_at",
     "archived_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^wdg_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "The widget (all its versions share it)"
     },
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]{0,3})\\.(0|[1-9][0-9]{0,3})\\.(0|[1-9][0-9]{0,3})$"
     },
     "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "Of the ZIP file, as release manifests pin it"
     },
     "size": {
      "type": "integer",
      "minimum": 1
     },
     "files": {
      "type": "integer",
      "minimum": 1,
      "description": "How many files it holds"
     },
     "fields": {
      "type": "array",
      "maxItems": 50,
      "description": "The settings a layout gives it (from its widget.json)",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "key",
        "label",
        "type"
       ],
       "properties": {
        "key": {
         "type": "string"
        },
        "label": {
         "type": "string"
        },
        "type": {
         "enum": [
          "text",
          "number",
          "boolean",
          "color"
         ]
        },
        "default": {
         "type": [
          "string",
          "number",
          "boolean"
         ]
        }
       }
      }
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "archived_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "existing": {
      "type": "boolean",
      "description": "Only on upload: this exact file was already a version (200)"
     }
    }
   },
   "SsoSettings": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.21 (TEN-06, ADR-080): the organisation's own single sign-on (SAML 2.0 or OpenID Connect) and its domains.",
    "required": [
     "available",
     "allowed",
     "alias",
     "provider",
     "service_provider",
     "sign_in_link",
     "signed_in_through_it",
     "domains"
    ],
    "properties": {
     "available": {
      "type": "boolean",
      "description": "The server can manage single sign-on (its Keycloak client is set up)"
     },
     "allowed": {
      "type": "boolean",
      "description": "The plan feature single_sign_on (Enterprise, or turned on by the platform); without it nothing can be set up"
     },
     "alias": {
      "type": "string",
      "pattern": "^org-[0-9a-f]{32}$",
      "description": "The provider's name in the sign-in service"
     },
     "provider": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "protocol",
         "display_name",
         "enabled",
         "required",
         "owners_may_use_password",
         "trust_mfa",
         "join_role",
         "settings",
         "updated_at"
        ],
        "properties": {
         "protocol": {
          "enum": [
           "saml",
           "oidc"
          ]
         },
         "display_name": {
          "type": "string",
          "maxLength": 60
         },
         "enabled": {
          "type": "boolean"
         },
         "required": {
          "type": "boolean",
          "description": "Its people sign in through it"
         },
         "owners_may_use_password": {
          "type": "boolean",
          "description": "Owners may still sign in with their password (so a broken provider cannot lock the organisation out)"
         },
         "trust_mfa": {
          "type": "boolean",
          "description": "A sign-in through it counts as the second step here"
         },
         "join_role": {
          "type": [
           "string",
           "null"
          ],
          "description": "Someone it signs in who is not a member joins with this role (never a privileged one)"
         },
         "settings": {
          "type": "object",
          "description": "What was given (no secrets): metadata_url, idp_entity_id, sign_in_url, certificate_expires_at (SAML); issuer, client_id (OpenID Connect)"
         },
         "updated_at": {
          "type": "string",
          "format": "date-time"
         }
        }
       }
      ]
     },
     "service_provider": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "saml",
       "oidc"
      ],
      "description": "What to enter at the organisation's identity provider",
      "properties": {
       "saml": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "entity_id",
         "acs_url",
         "metadata_url"
        ],
        "properties": {
         "entity_id": {
          "type": "string"
         },
         "acs_url": {
          "type": "string"
         },
         "metadata_url": {
          "type": "string"
         }
        }
       },
       "oidc": {
        "type": "object",
        "additionalProperties": false,
        "required": [
         "redirect_uri"
        ],
        "properties": {
         "redirect_uri": {
          "type": "string"
         }
        }
       }
      }
     },
     "sign_in_link": {
      "type": "string",
      "description": "Signs in through it straight away (to try it)"
     },
     "signed_in_through_it": {
      "type": "boolean"
     },
     "domains": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "domain",
        "verified_at",
        "checked_at",
        "record"
       ],
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^dom_[0-9a-f-]{36}$"
        },
        "domain": {
         "type": "string"
        },
        "verified_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "checked_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        },
        "record": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "type",
          "name",
          "value"
         ],
         "properties": {
          "type": {
           "const": "TXT"
          },
          "name": {
           "type": "string"
          },
          "value": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    }
   },
   "Analytics": {
    "type": "object",
    "additionalProperties": false,
    "description": "W5.22 (ANA-01, ADR-081): an organisation's analytics for a range of days (calendar days at each screen's site), against the period of the same length before.",
    "required": [
     "from",
     "to",
     "days",
     "previous",
     "previous_complete",
     "uptime_from",
     "totals",
     "previous_totals",
     "daily",
     "week",
     "top_media",
     "top_layouts",
     "sites",
     "lowest_uptime"
    ],
    "properties": {
     "from": {
      "type": "string",
      "format": "date"
     },
     "to": {
      "type": "string",
      "format": "date"
     },
     "days": {
      "type": "integer",
      "minimum": 1
     },
     "previous": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "from",
       "to"
      ],
      "properties": {
       "from": {
        "type": "string",
        "format": "date"
       },
       "to": {
        "type": "string",
        "format": "date"
       }
      }
     },
     "uptime_from": {
      "type": [
       "string",
       "null"
      ],
      "format": "date",
      "description": "The first day uptime is known for (heartbeats are kept 30 days); null: none in the range"
     },
     "totals": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "seconds",
       "plays",
       "screens_played",
       "uptime_percent",
       "problems",
       "screens"
      ],
      "properties": {
       "seconds": {
        "type": "integer",
        "minimum": 0
       },
       "plays": {
        "type": "integer",
        "minimum": 0
       },
       "screens_played": {
        "type": "integer",
        "minimum": 0
       },
       "uptime_percent": {
        "type": [
         "number",
         "null"
        ],
        "minimum": 0,
        "maximum": 100
       },
       "problems": {
        "type": "integer",
        "minimum": 0
       },
       "screens": {
        "type": "integer",
        "minimum": 0
       }
      },
      "description": "seconds: time screens showed content; plays: media items started; screens_played: screens that showed content; screens: screens in scope now; uptime_percent: share of time online; problems: failures players reported"
     },
     "previous_totals": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "seconds",
       "plays",
       "screens_played",
       "uptime_percent",
       "problems"
      ],
      "properties": {
       "seconds": {
        "type": "integer",
        "minimum": 0
       },
       "plays": {
        "type": "integer",
        "minimum": 0
       },
       "screens_played": {
        "type": "integer",
        "minimum": 0
       },
       "uptime_percent": {
        "type": [
         "number",
         "null"
        ],
        "minimum": 0,
        "maximum": 100
       },
       "problems": {
        "type": "integer",
        "minimum": 0
       }
      }
     },
     "daily": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "date",
        "seconds",
        "screens",
        "uptime_percent"
       ],
       "properties": {
        "date": {
         "type": "string",
         "format": "date"
        },
        "seconds": {
         "type": "integer",
         "minimum": 0
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        },
        "uptime_percent": {
         "type": [
          "number",
          "null"
         ],
         "minimum": 0,
         "maximum": 100
        }
       }
      }
     },
     "week": {
      "type": "array",
      "minItems": 7,
      "maxItems": 7,
      "description": "Seconds on screen by weekday (Monday first) and local hour (0-23)",
      "items": {
       "type": "array",
       "minItems": 24,
       "maxItems": 24,
       "items": {
        "type": "integer",
        "minimum": 0
       }
      }
     },
     "top_media": {
      "type": "array",
      "maxItems": 10,
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "name",
        "plays",
        "seconds",
        "screens"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "kind": {
         "type": "string"
        },
        "plays": {
         "type": "integer",
         "minimum": 0
        },
        "seconds": {
         "type": "integer",
         "minimum": 0
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        }
       }
      }
     },
     "top_layouts": {
      "type": "array",
      "maxItems": 10,
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "name",
        "plays",
        "seconds",
        "screens"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "kind": {
         "type": "string"
        },
        "plays": {
         "type": "integer",
         "minimum": 0
        },
        "seconds": {
         "type": "integer",
         "minimum": 0
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        }
       }
      }
     },
     "sites": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "name",
        "screens",
        "seconds",
        "uptime_percent"
       ],
       "properties": {
        "id": {
         "type": [
          "string",
          "null"
         ]
        },
        "name": {
         "type": "string"
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        },
        "seconds": {
         "type": "integer",
         "minimum": 0
        },
        "uptime_percent": {
         "type": [
          "number",
          "null"
         ],
         "minimum": 0,
         "maximum": 100
        }
       }
      }
     },
     "lowest_uptime": {
      "type": "array",
      "maxItems": 10,
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "name",
        "site",
        "uptime_percent",
        "last_seen_at"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "site": {
         "type": [
          "string",
          "null"
         ]
        },
        "uptime_percent": {
         "type": [
          "number",
          "null"
         ],
         "minimum": 0,
         "maximum": 100
        },
        "last_seen_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        }
       }
      }
     },
     "previous_complete": {
      "type": "boolean",
      "description": "The period before is whole (within the 400 days play time is kept); compare with it only then"
     }
    }
   },
   "AnalyticsDigest": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "subscribed",
     "next_at",
     "last_week",
     "last_error"
    ],
    "description": "W5.22 (ANA-08 in part): the weekly summary by email for the person asking (Mondays 08:00 in their time zone).",
    "properties": {
     "subscribed": {
      "type": "boolean"
     },
     "next_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_week": {
      "type": [
       "string",
       "null"
      ],
      "format": "date"
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "PlatformAnalytics": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "organisations",
     "screens",
     "weeks",
     "daily",
     "largest",
     "first_live"
    ],
    "description": "W5.22 (ANA-03): the platform's own analytics.",
    "properties": {
     "organisations": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "by_status",
       "by_plan"
      ],
      "properties": {
       "by_status": {
        "type": "object",
        "additionalProperties": {
         "type": "integer",
         "minimum": 0
        }
       },
       "by_plan": {
        "type": "array",
        "items": {
         "type": "object",
         "additionalProperties": false,
         "required": [
          "plan",
          "name",
          "count"
         ],
         "properties": {
          "plan": {
           "type": "string"
          },
          "name": {
           "type": "string"
          },
          "count": {
           "type": "integer",
           "minimum": 0
          }
         }
        }
       }
      }
     },
     "screens": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "total",
       "online"
      ],
      "properties": {
       "total": {
        "type": "integer",
        "minimum": 0
       },
       "online": {
        "type": "integer",
        "minimum": 0
       }
      }
     },
     "weeks": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "week",
        "organisations",
        "screens"
       ],
       "properties": {
        "week": {
         "type": "string",
         "format": "date"
        },
        "organisations": {
         "type": "integer",
         "minimum": 0
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        }
       }
      }
     },
     "daily": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "date",
        "seconds",
        "screens",
        "organisations"
       ],
       "properties": {
        "date": {
         "type": "string",
         "format": "date"
        },
        "seconds": {
         "type": "integer",
         "minimum": 0
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        },
        "organisations": {
         "type": "integer",
         "minimum": 0
        }
       }
      }
     },
     "largest": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "id",
        "name",
        "status",
        "plan",
        "screens",
        "online"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "status": {
         "type": "string"
        },
        "plan": {
         "type": "string"
        },
        "screens": {
         "type": "integer",
         "minimum": 0
        },
        "online": {
         "type": "integer",
         "minimum": 0
        }
       }
      }
     },
     "first_live": {
      "type": "object",
      "additionalProperties": false,
      "required": [
       "median_seconds",
       "organisations"
      ],
      "properties": {
       "median_seconds": {
        "type": [
         "integer",
         "null"
        ]
       },
       "organisations": {
        "type": "integer",
        "minimum": 0
       }
      }
     }
    }
   },
   "Branding": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "product_name": {
      "type": "string",
      "maxLength": 40
     },
     "logo": {
      "type": [
       "string",
       "null"
      ],
      "description": "A PNG, JPEG or WebP data URL"
     },
     "colour": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^#[0-9a-f]{6}$"
     },
     "support_email": {
      "type": [
       "string",
       "null"
      ]
     },
     "support_url": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "product_name",
     "logo",
     "colour",
     "support_email",
     "support_url"
    ],
    "description": "W5.23 (TEN-11, ADR-082): a partner's branding, shown in its organisations"
   },
   "Reseller": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "status": {
      "enum": [
       "active",
       "suspended"
      ]
     },
     "role": {
      "enum": [
       "owner",
       "admin"
      ]
     },
     "limits": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "organisations": {
        "type": [
         "integer",
         "null"
        ]
       },
       "units": {
        "type": [
         "integer",
         "null"
        ]
       }
      }
     },
     "usage": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "organisations": {
        "type": "integer"
       },
       "units": {
        "type": "integer"
       }
      }
     },
     "plans": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "key": {
         "type": "string"
        },
        "name": {
         "type": "string"
        },
        "units": {
         "type": [
          "integer",
          "null"
         ]
        }
       }
      }
     },
     "branding": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/Branding"
       },
       {
        "type": "null"
       }
      ]
     },
     "sign_in_link": {
      "type": "string"
     }
    },
    "required": [
     "id",
     "name",
     "slug",
     "status",
     "role",
     "limits",
     "usage",
     "plans",
     "branding"
    ]
   },
   "ResellerOrganisation": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^ten_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "status": {
      "enum": [
       "trial",
       "active",
       "suspended"
      ]
     },
     "suspended_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "plan": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "key": {
        "type": "string"
       },
       "name": {
        "type": "string"
       }
      }
     },
     "screens": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "allowed": {
        "type": [
         "integer",
         "null"
        ]
       },
       "used": {
        "type": "integer"
       },
       "online": {
        "type": "integer"
       }
      }
     },
     "members": {
      "type": "integer"
     },
     "partner_access": {
      "type": "boolean",
      "description": "Whether the organisation's owners let the partner's people in"
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "owner_invitation_link": {
      "type": "string",
      "description": "On create only"
     },
     "suspended_by": {
      "enum": [
       "platform",
       "partner",
       null
      ],
      "description": "Who suspended it: the platform's suspension is the platform's to lift (409 platform-suspended)"
     }
    },
    "required": [
     "id",
     "name",
     "status",
     "plan",
     "screens",
     "partner_access"
    ]
   },
   "ResellerInvitation": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rinv_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "email": {
      "type": [
       "string",
       "null"
      ]
     },
     "role": {
      "enum": [
       "owner",
       "admin"
      ]
     },
     "expires_at": {
      "type": "string",
      "format": "date-time"
     },
     "link": {
      "type": "string",
      "description": "On create only"
     }
    },
    "required": [
     "id",
     "email",
     "role"
    ]
   },
   "ResellerTeam": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "members": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "user_id": {
         "type": "string",
         "pattern": "^usr_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "email": {
         "type": [
          "string",
          "null"
         ]
        },
        "name": {
         "type": [
          "string",
          "null"
         ]
        },
        "role": {
         "enum": [
          "owner",
          "admin"
         ]
        },
        "since": {
         "type": "string",
         "format": "date-time"
        },
        "me": {
         "type": "boolean"
        }
       }
      }
     },
     "invitations": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ResellerInvitation"
      }
     }
    },
    "required": [
     "members",
     "invitations"
    ]
   },
   "PlatformReseller": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "name": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "status": {
      "enum": [
       "active",
       "suspended"
      ]
     },
     "suspended_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "limits": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "organisations": {
        "type": [
         "integer",
         "null"
        ]
       },
       "units": {
        "type": [
         "integer",
         "null"
        ]
       }
      }
     },
     "plans": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "usage": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
       "organisations": {
        "type": "integer"
       },
       "units": {
        "type": "integer"
       }
      }
     },
     "members": {
      "type": "integer"
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "owner_invitation_link": {
      "type": [
       "string",
       "null"
      ],
      "description": "On create only"
     }
    },
    "required": [
     "id",
     "name",
     "slug",
     "status",
     "limits",
     "plans",
     "usage"
    ]
   },
   "PartnerAccess": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "partner": {
      "oneOf": [
       {
        "type": "object",
        "additionalProperties": false,
        "properties": {
         "id": {
          "type": "string",
          "pattern": "^rsl_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
         },
         "name": {
          "type": "string"
         },
         "status": {
          "enum": [
           "active",
           "suspended"
          ]
         },
         "support_email": {
          "type": [
           "string",
           "null"
          ]
         },
         "support_url": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       },
       {
        "type": "null"
       }
      ]
     },
     "partner_access": {
      "type": "boolean"
     }
    },
    "required": [
     "partner",
     "partner_access"
    ]
   },
   "PartnerDomain": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "hostname": {
      "type": "string"
     },
     "verified": {
      "type": "boolean"
     },
     "verified_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "checked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "problem": {
      "type": [
       "string",
       "null"
      ]
     },
     "url": {
      "type": "string"
     },
     "records": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "type": {
         "enum": [
          "CNAME",
          "TXT"
         ]
        },
        "name": {
         "type": "string"
        },
        "value": {
         "type": "string"
        }
       },
       "required": [
        "type",
        "name",
        "value"
       ]
      }
     }
    },
    "required": [
     "hostname",
     "verified",
     "records",
     "url"
    ],
    "description": "W5.24 (TEN-11, ADR-083): the partner's own address for the app, proved by DNS"
   },
   "StatusNotice": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^stn_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
     },
     "title": {
      "type": "string"
     },
     "impact": {
      "enum": [
       "maintenance",
       "minor",
       "major"
      ]
     },
     "components": {
      "type": "array",
      "items": {
       "enum": [
        "app",
        "api",
        "sign_in",
        "media",
        "player",
        "downloads",
        "screens"
       ]
      }
     },
     "starts_at": {
      "type": "string",
      "format": "date-time"
     },
     "ends_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "resolved_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "state": {
      "enum": [
       "open",
       "planned",
       "closed"
      ]
     },
     "updates": {
      "type": "array",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "status": {
         "enum": [
          "scheduled",
          "investigating",
          "identified",
          "monitoring",
          "resolved",
          "in_progress",
          "completed"
         ]
        },
        "message": {
         "type": "string"
        },
        "at": {
         "type": "string",
         "format": "date-time"
        }
       },
       "required": [
        "status",
        "message",
        "at"
       ]
      }
     }
    },
    "required": [
     "id",
     "title",
     "impact",
     "components",
     "starts_at",
     "state",
     "updates"
    ],
    "description": "W5.25 (ADR-084): a notice on the public status page"
   }
  },
  "headers": {
   "RateLimit-Limit": {
    "description": "Requests allowed in the current window",
    "schema": {
     "type": "integer"
    }
   },
   "RateLimit-Remaining": {
    "description": "Requests left in the current window",
    "schema": {
     "type": "integer"
    }
   },
   "RateLimit-Reset": {
    "description": "Seconds until the window resets",
    "schema": {
     "type": "integer"
    }
   },
   "Retry-After": {
    "description": "Seconds to wait before trying again",
    "schema": {
     "type": "integer"
    }
   }
  }
 }
}
