{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/socialbu-com/json-schema/socialbu-com-listening-stream-request-schema.json",
  "title": "ListeningStreamRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/socialbu-com-openapi.yml#/components/schemas/ListeningStreamRequest",
  "type": "object",
  "required": [
    "name",
    "query",
    "sources"
  ],
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 180
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional monitoring purpose used for automatic Instagram hashtag refinement; the first 2000 characters are used."
    },
    "query": {
      "description": "Shared searches used when a source has no platform override. Each selected source needs at least one positive query in its effective list; negative-only entries are allowed as exclusions alongside positive entries. Threads accepts one from:username optionally followed by content terms. TikTok author searches use from:username without additional positive terms. Instagram keywords and phrases become one hashtag per query; exclusions are applied locally. New or changed effective Instagram hashtags may be automatically refined by AI. Replacements are saved in platform_queries.instagram, preserving shared queries and exclusions. A successful uncached batch review costs 1 owner AI credit, even if no replacement is available. Identical per-owner hashtag/context verdicts are cached for 24 hours. If no safe replacement is available, credits are exhausted, or the service fails, the original query is saved. Refinement does not measure live post volume. Existing unchanged hashtags are not reviewed.",
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
        "type": "string",
        "maxLength": 500
      }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "bluesky",
          "hackernews",
          "instagram",
          "linkedin",
          "reddit",
          "threads",
          "tiktok",
          "twitter",
          "youtube"
        ]
      }
    },
    "team_id": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Team to create the stream in. `0` or null creates a personal stream."
    },
    "options": {
      "type": "object",
      "properties": {
        "ai_filter_enabled": {
          "type": "boolean"
        },
        "ai_filter_prompt": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 1000,
          "description": "Relevance criteria when ai_filter_enabled is true. Tagging rules also apply with ai_generate_tags alone, without rejecting items."
        },
        "ai_analyze_sentiment": {
          "type": "boolean"
        },
        "ai_generate_tags": {
          "type": "boolean",
          "description": "Evaluate all existing Listen tags in this stream's personal/team scope and apply matching tags to newly collected items. Does not create tags or reprocess saved items. Tagging rules can be included in ai_filter_prompt alongside relevance criteria."
        }
      }
    },
    "platform_queries": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "maxItems": 10,
        "items": {
          "type": "string",
          "maxLength": 500
        }
      }
    }
  }
}