private-tenant.schema.json

Account-wide private policy, read only by the back end (config-schema §3.3–3.5, §8a, §8b, §8c): the default network rule, named networks and who is on which, access levels, server keys (public halves only), budgets, the transcript store, Discover link sharing.

All pages ↓

private-tenant.schema.json JSON · 137 lines · Validates private/tenant.json Raw file
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://streamliner.work/schema/v1/private-tenant.schema.json",
  "title": "private/tenant.json",
  "description": "Account-wide private policy, read only by the back end (config-schema §3.3–3.5, §8a, §8b, §8c): the default network rule, named networks and who is on which, access levels, server keys (public halves only), budgets, the transcript store, Discover link sharing. Never served to a device.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "$schema": { "$ref": "defs.schema.json#/$defs/schemaRef" },
    "network": { "$ref": "defs.schema.json#/$defs/networkRule", "description": "The account's default network rule, for every streamline that has none of its own. Absent = unrestricted." },
    "networks": {
      "type": "object",
      "description": "The account's named networks (§3.4). A client's \"locations\" map onto these.",
      "propertyNames": { "$ref": "defs.schema.json#/$defs/networkId" },
      "additionalProperties": {
        "type": "object",
        "required": ["name", "cidrs"],
        "additionalProperties": false,
        "properties": {
          "name": { "type": "string", "minLength": 1, "description": "Display name (\"Harbor Point store Wi-Fi\")." },
          "cidrs": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "$ref": "defs.schema.json#/$defs/cidr" }, "description": "The client IPs (as Cloudflare sees them) that count as this network." }
        }
      }
    },
    "roles": {
      "type": "object",
      "description": "Per role: the networks everyone holding it is on. Keys are role ids from `tenant.json`.",
      "propertyNames": { "$ref": "defs.schema.json#/$defs/roleId" },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": { "type": "string", "description": "Overrides the role's display name." },
          "networks": { "type": "array", "uniqueItems": true, "items": { "$ref": "defs.schema.json#/$defs/networkId" }, "description": "Networks every holder of this role is on." }
        }
      }
    },
    "users": {
      "type": "object",
      "description": "Directory entries published with the config (the pushed directory overrides them, §8b). On a demo account, keys must be demo users.",
      "propertyNames": { "$ref": "defs.schema.json#/$defs/userId" },
      "additionalProperties": { "$ref": "#/$defs/directoryUser" }
    },
    "access": {
      "type": "object",
      "description": "Access-level seeds: user id → `member` | `admin` | `owner` (separate from job roles).",
      "propertyNames": { "$ref": "defs.schema.json#/$defs/userId" },
      "additionalProperties": { "enum": ["member", "admin", "owner"] }
    },
    "serverKeys": {
      "type": "array",
      "description": "The account's server credentials (never an employee's): Ed25519 public halves only; the account's system holds the private key and signs each request (§8b).",
      "items": {
        "type": "object",
        "required": ["id", "alg", "publicKey", "scopes"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^[A-Za-z0-9_.@-]{1,64}$", "description": "Sent as `X-Streamline-Key`." },
          "alg": { "const": "Ed25519", "description": "`Ed25519`." },
          "publicKey": { "$ref": "defs.schema.json#/$defs/base64url32", "description": "The public half, base64url of the raw 32 bytes. Never a private key." },
          "scopes": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["config", "config:streamlines", "config:check", "directory", "invites", "members", "usage:read", "transcripts:read", "credentials"] }, "description": "`config` (publishing), `config:streamlines` (streamline files only), `config:check` (the config index and dry runs only: never writes), `directory`, `invites`, `members`, `usage:read`, `transcripts:read`, `credentials` (the organization's model keys, config-schema §8b)." },
          "expiresAt": { "type": "string", "format": "date-time", "description": "When the key stops working (ISO 8601): from then on every request it signs is `401 key_expired`. Optional here; keys an owner issues from the app always have one (§8b *Owner-issued server keys*)." },
          "label": { "type": "string", "maxLength": 64, "description": "What the key is for, as people read it (Server Keys, Activity)." },
          "disabled": { "type": "boolean", "description": "true: the key is refused as if absent (kept for the record)." }
        }
      }
    },
    "budgets": {
      "type": "object",
      "description": "Daily caps checked in the ledger before the provider (§8a). The first cap at or over its limit refuses the call (429 budget_exceeded).",
      "additionalProperties": false,
      "properties": {
        "warnAt": { "type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 1, "description": "Fraction of any cap past which calls carry `X-Streamline-Budget-Warning`. Default 0.8." },
        "perUser": { "$ref": "#/$defs/cap", "description": "Each user, all streamlines." },
        "users": { "type": "object", "propertyNames": { "$ref": "defs.schema.json#/$defs/userId" }, "additionalProperties": { "$ref": "#/$defs/cap" }, "description": "One user's own cap (replaces `perUser` for them)." },
        "roles": { "type": "object", "propertyNames": { "$ref": "defs.schema.json#/$defs/roleId" }, "additionalProperties": { "$ref": "#/$defs/cap" }, "description": "Everyone holding the role, together." },
        "streamlines": { "type": "object", "propertyNames": { "$ref": "defs.schema.json#/$defs/kindId" }, "additionalProperties": { "$ref": "#/$defs/cap" }, "description": "Everyone using the streamline, together." }
      }
    },
    "discover": {
      "type": "object",
      "description": "Discover (§8c): the organization's links. Sharing a streamline by link is an organization action.",
      "additionalProperties": false,
      "properties": {
        "sharing": { "enum": ["admins", "owners", "off"], "description": "`admins` (the default): the organization's owners and admins share links; members never do. `owners`: owners only (an admin's new link or version: 403 sharing_owners). Owners can always share. `off` (older) reads as `owners` (Round 2, 2026-10-17); owners and admins can always list and stop the links already shared." }
      }
    },
    "transcripts": {
      "type": "object",
      "description": "The organization's transcript store (§3.5). Sealed values are never in a transcript.",
      "additionalProperties": false,
      "properties": {
        "retentionDays": { "type": "integer", "minimum": 0, "description": "How long the back end keeps a stream's record from its last event. Default 365; 0 = keep until the account is deleted." },
        "continuity": { "type": "boolean", "description": "Chats follow people across their devices (§8b *Chats on every device*): each person's own chats, read back by their own session on their other devices. Default true; false = the person's routes answer 403 continuity_off and devices stop pulling. Never widens who reads what." },
        "readers": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "description": "Access levels and role ids that may read through the export API (owners always may). Not built." },
        "forward": {
          "type": "object",
          "description": "Each appended batch also goes to the organization's own storage or webhook, signed. Not built.",
          "required": ["url"],
          "additionalProperties": false,
          "properties": {
            "url": { "$ref": "defs.schema.json#/$defs/httpsUrl", "description": "The organization's endpoint." },
            "credentialRef": { "$ref": "defs.schema.json#/$defs/credentialRef" }
          }
        }
      }
    }
  },
  "$defs": {
    "cap": {
      "type": "object",
      "description": "A daily cap: tokens (input + output + cache) and/or estimated USD per UTC day.",
      "minProperties": 1,
      "additionalProperties": false,
      "properties": {
        "tokensPerDay": { "type": "number", "exclusiveMinimum": 0, "description": "Tokens per UTC day." },
        "costPerDayUSD": { "type": "number", "exclusiveMinimum": 0, "description": "Estimated USD per UTC day." }
      }
    },
    "directoryUser": {
      "type": "object",
      "description": "A directory user (the shape the directory API takes, §8b).",
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "description": "Full name." },
        "roles": { "type": "array", "items": { "$ref": "defs.schema.json#/$defs/roleId" }, "description": "Job role ids." },
        "networks": { "type": "array", "uniqueItems": true, "items": { "$ref": "defs.schema.json#/$defs/networkId" }, "description": "Networks this user is on." },
        "email": { "type": "string", "format": "email", "description": "Email for the email-code sign-in." },
        "username": { "type": "string", "description": "Username on the account's `connection` sign-in." },
        "access": { "enum": ["member", "admin", "owner"], "description": "Access level." },
        "disabled": { "type": "boolean", "description": "A disabled user is refused everywhere." },
        "store": { "type": "string", "description": "Location (`user.store`)." },
        "title": { "type": "string", "description": "Job title." }
      }
    }
  }
}

← All Schemas