{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/feed-fm/json-schema/feed-fm-station-search-request-schema.json",
  "title": "StationSearchRequest",
  "description": "Body for `POST /station`, which finds a station and creates a play from\nit in one call.\n\nThe example below is the common fallback chain: replay one specific\nstation from 42 seconds in, and if that station has nothing left to\nplay, start any pop radio station instead.\n",
  "x-generated": "2026-12-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/feed-fm-v3-openapi.yml#/components/schemas/StationSearchRequest",
  "type": "object",
  "required": [
    "q"
  ],
  "properties": {
    "q": {
      "type": "array",
      "description": "The ordered list of searches to try. An empty array is legal and\nmeans \"give me the first playable station\", which is the simplest\nway to start music without knowing the customer's station layout.\n",
      "items": {
        "$ref": "#/$defs/StationSearchQuery"
      }
    },
    "client_id": {
      "type": "string",
      "maxLength": 23,
      "description": "The client the resulting play belongs to. Required, but may instead\narrive as a `cid` cookie or a `client_id` query parameter — see\n*Identifying a client*. Values longer than 23 characters are\nsilently truncated.\n"
    },
    "formats": {
      "type": "string",
      "description": "Comma-separated list of acceptable codecs, in preference order, e.g.\n`aac,mp3`. Valid codecs are `mp3` and `aac`.\n"
    },
    "max_bitrate": {
      "type": "integer",
      "description": "Upper bound on the delivered bitrate, in kbps.\n"
    }
  },
  "$defs": {
    "StationSearchQuery": {
      "type": "object",
      "description": "One candidate in a `POST /station` search. The searches are tried in\norder and the first that yields a playable track wins, which lets a\nclient express a fallback chain such as \"replay this track, else start a\nradio station\".\n",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "radio",
            "first_play",
            "replay"
          ],
          "description": "The kind of station to look for: `radio`, `first_play`, or `replay`.\n"
        },
        "filter": {
          "type": "object",
          "additionalProperties": true,
          "description": "Criteria narrowing which stations this query may match. A station\nmatches when **every** property of the filter matches it, and an\nempty object matches every station.\n\nA property is either a field or one of the two combinators.\n\n### Fields\n\nA field names a station property. Only `name` and `uuid` address\nthe station itself. Every other name is matched against the\nstation's `options`, so `{\"genre\": \"pop\"}` tests `options.genre`.\nWhich option names exist depends on how your catalog is tagged.\nMatch one specific station on `uuid`, which is stable; `name` is\ndisplay text and may be edited.\n\nA field's value is one of:\n\n* An exact value. Strings, numbers and booleans compare exactly.\n  Where the option holds an array, the value matches if the array\n  contains it, so `{\"genre\": \"rock\"}` matches a station whose\n  `options.genre` is `[\"rock\", \"pop\"]`.\n* A wildcard string, with `*` at the start, at the end, or at both\n  ends: `\"Workout*\"`, `\"*Radio\"`, `\"*Cycling*\"`. A `*` anywhere\n  else in the string is matched literally, and there is no way to\n  escape one.\n* An operator object holding exactly one of `{\"$in\": [...]}`,\n  `{\"$nin\": [...]}`, `{\"$ne\": value}` or\n  `{\"$exists\": true|false}`. `$exists: false` matches both a\n  missing option and one set to `null`.\n\n### Combinators\n\n`$and` takes an array of filters, all of which must match. `$or`\ntakes an array of filters, at least one of which must match. Both\nnest to any depth.\n\nEither may sit alongside fields, and alongside each other, in the\nsame object. Every property of an object is combined with AND, so\n\n```json\n{ \"$or\": [ { \"genre\": \"pop\" }, { \"genre\": \"rock\" } ],\n  \"class\": \"cycling\" }\n```\n\nrequires the class *and* one of the two genres.\n\n`{\"$or\": []}` matches no station. `{\"$and\": []}` matches every\nstation.\n\n### Outside the grammar\n\nNothing else is supported: no other operators, no dotted paths into\nnested options, no array as a field value, and no second operator\ninside one operator object. `filter` is not validated, so none of\nthese is reported as an error. They match no station, and the\nsearch falls through to the next entry in `q`.\n"
        },
        "at": {
          "type": "number",
          "minimum": 0,
          "description": "Start offset in seconds for the resulting play. Must be a\nnon-negative number; anything else returns `invalidParameter`\n(code 15).\n"
        }
      }
    }
  }
}