{
  "components": {
    "headers": {
      "API-Version": {
        "description": "Version of the API that served the response.",
        "schema": {
          "example": "0.2.0",
          "type": "string"
        }
      },
      "Deprecation": {
        "description": "RFC 9745 deprecation timestamp when an endpoint is scheduled for replacement.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Limit": {
        "description": "Maximum number of requests permitted in the current rate-limit window.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "RateLimit-Policy": {
        "description": "IETF RateLimit policy declaration (for example `600;w=60`).",
        "schema": {
          "type": "string"
        }
      },
      "RateLimit-Remaining": {
        "description": "Number of requests remaining in the current rate-limit window.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the rate-limit quota resets.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying after a 429 Too Many Requests response.",
        "schema": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "Sunset": {
        "description": "RFC 8594 HTTP-date after which a deprecated endpoint will be removed (at least 90 days notice).",
        "schema": {
          "type": "string"
        }
      }
    },
    "parameters": {
      "ApiVersion": {
        "description": "Requested API version label (defaults to the current stable version).",
        "in": "header",
        "name": "API-Version",
        "required": false,
        "schema": {
          "default": "0.2.0",
          "type": "string"
        }
      }
    },
    "schemas": {
      "ProblemDetails": {
        "properties": {
          "code": {
            "description": "Machine-readable error code.",
            "type": "string"
          },
          "detail": {
            "description": "Explanation of this specific error.",
            "type": "string"
          },
          "hint": {
            "description": "Actionable recovery guidance for callers.",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code.",
            "type": "integer"
          },
          "title": {
            "description": "Short summary of the error.",
            "type": "string"
          },
          "type": {
            "description": "Stable URI identifying the error class.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "description": "Least-privilege OAuth 2.1 scopes for authenticated operations; public read operations also accept anonymous requests.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://beats.ferrite.run/oauth/authorize",
            "scopes": {
              "apps:discover": "Discover available operations, schemas, and public metadata.",
              "apps:read": "Read-only access to declared GET and read-only operations.",
              "apps:write": "Invoke mutating operations and asynchronous jobs."
            },
            "tokenUrl": "https://beats.ferrite.run/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "description": "Beats is a music player that people and agents share: 44 tracks in six genres, with search, play counts, liked tracks, listening history and playlists. Use it to find a track, see what is played most, like something, or build a playlist. Every change runs through the same replay-safe actions the player uses, so a retried request never counts a play twice. Calls without a browser session act as the shared demo listener.\n\nVersioning and deprecation policy: endpoints are versioned via URL path and the optional `API-Version` header (current version: 0.2.0). Deprecated endpoints emit RFC 9745 `Deprecation` and RFC 8594 `Sunset` response headers at least 90 days before removal. Rate limits are communicated via IETF `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, `RateLimit-Policy`, and `Retry-After` headers.",
    "title": "beats",
    "version": "0.2.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/favorites": {
      "get": {
        "operationId": "list_favorites",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "tracks": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "tracks"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List the tracks the listener likes, the most recently liked first. Use it to learn their taste before suggesting or collecting tracks. Returns the tracks, or an empty list when nothing is liked yet.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/genres": {
      "get": {
        "operationId": "list_genres",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "genres": {
                      "items": {
                        "description": "getGenres() → { genre, count }[].",
                        "properties": {
                          "count": {
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "genre",
                          "count"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "genres"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List every genre in the catalogue. Use it before list_genre_tracks, which needs the exact genre name. Returns each genre with how many tracks it holds, largest first.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/genres/{genre}": {
      "get": {
        "operationId": "list_genre_tracks",
        "parameters": [
          {
            "in": "path",
            "name": "genre",
            "required": true,
            "schema": {
              "description": "the genre name exactly as list_genres gives it",
              "examples": [
                "electronic"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "tracks": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "tracks"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List every track in one genre, most played first. Use it to answer a request for a mood or a style rather than a title. Returns the tracks, or an empty list when no genre has that name.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/home": {
      "get": {
        "operationId": "get_home",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "discover": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "most_played": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "recently_played": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "recently_played",
                    "most_played",
                    "discover"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Read the three panels of the listener's home screen. Use it first for an overview of the catalogue and to find track ids. Returns up to eight recently played tracks, eight most played ones, and eight to discover that the listener has not liked.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/playlists": {
      "get": {
        "operationId": "list_playlists",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "playlists": {
                      "items": {
                        "description": "Upstream types/playlist.ts PlaylistSummary.",
                        "properties": {
                          "cover_color": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "track_count": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "cover_color",
                          "track_count"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "playlists"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List the playlists the listener can open: the three demo playlists and the ones they created. Use it to find a playlist id. Returns each playlist's id, name, description and number of tracks.",
        "x-idempotent": true,
        "x-read-only": true
      },
      "post": {
        "operationId": "create_playlist",
        "parameters": [
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "name": {
                    "description": "the playlist name, 1 to 100 characters",
                    "examples": [
                      "Friday afternoon"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "{ ok: true, playlist } or { ok: false, error }. Upstream uses a discriminated union; the contract carries both arms as optionals and the adapter narrows on ok, so the component code that reads created.ok ? created.playlist.id : created.error is unchanged.",
                  "properties": {
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "playlist": {
                      "oneOf": [
                        {
                          "description": "Upstream returns the created Prisma row; the components read .id and .name, which is what crosses here.",
                          "properties": {
                            "cover_color": {
                              "type": "string"
                            },
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "cover_color"
                          ],
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Create an empty playlist that belongs to the listener. Use it before add_to_playlist, which needs the new id. Returns ok with the playlist's id, name and cover colour, or ok false with the reason.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/playlists/{id}": {
      "get": {
        "operationId": "get_playlist",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the playlist id, from list_playlists",
              "examples": [
                "pl1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Upstream PlaylistWithTracks.",
                  "properties": {
                    "cover_color": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "track_count": {
                      "type": "integer"
                    },
                    "tracks": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "description",
                    "cover_color",
                    "track_count",
                    "tracks"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Read one playlist and its tracks in order. Use it before adding or removing tracks, or to play through a collection. Returns the playlist with its name, description and full track list.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/playlists/{id}/delete": {
      "post": {
        "operationId": "delete_playlist",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the playlist to delete",
              "examples": [
                "pl1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "description": "the playlist to delete",
                    "examples": [
                      "pl1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The upstream { ok: true } | { ok: false, error } union, as one shape. A refused mutation is NOT a transport error upstream — it is a value the component shows as a toast — so it is a value here too. The transport error path (a problem document) is reserved for the things upstream would have thrown.",
                  "properties": {
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Delete one of the listener's own playlists for good. Use it only when that is clearly wanted; the demo playlists are read-only and no track is deleted. Returns ok, or ok false with the reason.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/playlists/{id}/tracks": {
      "post": {
        "operationId": "add_to_playlist",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the playlist id, from create_playlist or list_playlists",
              "examples": [
                "pl1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "description": "the playlist id, from create_playlist or list_playlists",
                    "examples": [
                      "pl1"
                    ],
                    "type": "string"
                  },
                  "track_id": {
                    "description": "the track to add",
                    "examples": [
                      "t1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "track_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The upstream { ok: true } | { ok: false, error } union, as one shape. A refused mutation is NOT a transport error upstream — it is a value the component shows as a toast — so it is a value here too. The transport error path (a problem document) is reserved for the things upstream would have thrown.",
                  "properties": {
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Append a track to one of the listener's own playlists. Use it after create_playlist; the demo playlists pl1, pl2 and pl3 are read-only. Returns ok, or ok false with the reason, such as a track that is already there.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/playlists/{id}/tracks/remove": {
      "post": {
        "operationId": "remove_from_playlist",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the playlist to change",
              "examples": [
                "pl1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "description": "the playlist to change",
                    "examples": [
                      "pl1"
                    ],
                    "type": "string"
                  },
                  "track_id": {
                    "description": "the track to remove",
                    "examples": [
                      "t1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "track_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The upstream { ok: true } | { ok: false, error } union, as one shape. A refused mutation is NOT a transport error upstream — it is a value the component shows as a toast — so it is a value here too. The transport error path (a problem document) is reserved for the things upstream would have thrown.",
                  "properties": {
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Remove a track from one of the listener's own playlists. Use it to correct a playlist; the demo playlists are read-only and the track itself stays in the catalogue. Returns ok, or ok false with the reason.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/plays": {
      "post": {
        "operationId": "record_play",
        "parameters": [
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "track_id": {
                    "description": "the track that was played",
                    "examples": [
                      "t1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "track_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The { ok: true } every upstream action returns on success.",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Count one play of a track and put it at the top of the listener's history. Use it when playback starts; repeating the same idempotency key does not count it twice. Returns ok, or a 404 problem when no track has that id.",
        "x-idempotent": true,
        "x-read-only": false
      }
    },
    "/api/search": {
      "get": {
        "operationId": "search",
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "part of a title, artist, album or playlist name",
              "examples": [
                "neon"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "playlists": {
                      "items": {
                        "description": "Upstream types/playlist.ts PlaylistSummary.",
                        "properties": {
                          "cover_color": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "track_count": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "cover_color",
                          "track_count"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "tracks": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "tracks",
                    "playlists"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Search track titles, artists and albums, and the names of the playlists the listener can see, ignoring case. Use it when you know part of a name. Returns up to 30 matching tracks, most played first, and the matching playlists.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/tracks": {
      "get": {
        "operationId": "list_tracks",
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "next_cursor from the previous page; leave out for the first page",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "getLibrary(page) → { hasMore, tracks }.",
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "description": "Pass as cursor to read the next page; null on the last one.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "page": {
                      "description": "The page this view is for, echoed so the client can key it.",
                      "type": "integer"
                    },
                    "tracks": {
                      "items": {
                        "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                        "properties": {
                          "album": {
                            "type": "string"
                          },
                          "artist": {
                            "type": "string"
                          },
                          "cover_color": {
                            "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                            "type": "string"
                          },
                          "created_at": {
                            "description": "Epoch milliseconds.",
                            "type": "string"
                          },
                          "duration": {
                            "description": "Seconds.",
                            "type": "integer"
                          },
                          "genre": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "is_favorite": {
                            "type": "boolean"
                          },
                          "last_played_at": {
                            "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "play_count": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "artist",
                          "album",
                          "duration",
                          "genre",
                          "cover_color",
                          "play_count",
                          "is_favorite",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "has_more",
                    "tracks",
                    "page",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "List the whole catalogue, newest track first, up to 100 per page. Use it to browse or to collect every track when a search would be too narrow. Returns the tracks with artist, album, genre, length and play count, plus next_cursor.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/tracks/{id}": {
      "get": {
        "operationId": "get_track",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the track id, from a list or a search",
              "examples": [
                "t1"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "playlist_menu": {
                      "items": {
                        "description": "Upstream PlaylistMenuItem.",
                        "properties": {
                          "active": {
                            "type": "boolean"
                          },
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "label",
                          "value",
                          "active"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "track": {
                      "description": "Upstream types/track.ts Track, field for field. lastPlayedAt and createdAt are Date | null / Date upstream and cross the wire as epoch milliseconds; the adapter's toTrack revives them.",
                      "properties": {
                        "album": {
                          "type": "string"
                        },
                        "artist": {
                          "type": "string"
                        },
                        "cover_color": {
                          "description": "A Tailwind gradient pair such as from-blue-500 to-indigo-600.",
                          "type": "string"
                        },
                        "created_at": {
                          "description": "Epoch milliseconds.",
                          "type": "string"
                        },
                        "duration": {
                          "description": "Seconds.",
                          "type": "integer"
                        },
                        "genre": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "is_favorite": {
                          "type": "boolean"
                        },
                        "last_played_at": {
                          "description": "Epoch milliseconds, absent when this user has never played it. A u64 crosses the wire as a decimal string (alloy-gen widens it), so a 13-digit instant never rounds in a JavaScript number.",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "play_count": {
                          "type": "integer"
                        },
                        "title": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "title",
                        "artist",
                        "album",
                        "duration",
                        "genre",
                        "cover_color",
                        "play_count",
                        "is_favorite",
                        "created_at"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "track",
                    "playlist_menu"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Read one track by its id. Use it when you need to know whether the listener likes a track or which of their playlists hold it. Returns the track and the listener's playlists, each marked active when it contains the track.",
        "x-idempotent": true,
        "x-read-only": true
      }
    },
    "/api/tracks/{id}/favorite": {
      "post": {
        "operationId": "toggle_favorite",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "the track to like or unlike",
              "examples": [
                "t1"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retry-safe: a request repeating this key returns the first result instead of running again.",
            "in": "header",
            "name": "idempotency-key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "id": {
                    "description": "the track to like or unlike",
                    "examples": [
                      "t1"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "The { ok: true } every upstream action returns on success.",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "API-Version": {
                "$ref": "#/components/headers/API-Version"
              },
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Sunset": {
                "$ref": "#/components/headers/Sunset"
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Invalid request parameters or body (RFC 9457 problem details)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Resource not found (RFC 9457 problem details)"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Rate limit exceeded; wait Retry-After seconds before retrying",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Error (RFC 9457 problem details)"
          }
        },
        "summary": "Like a track, or remove the like when the listener already likes it. Use it when somebody says they enjoy a track; get_track shows the present state. Returns ok, or a 404 problem when no track has that id.",
        "x-idempotent": true,
        "x-read-only": false
      }
    }
  },
  "security": [
    {},
    {
      "oauth2": [
        "apps:discover",
        "apps:read",
        "apps:write"
      ]
    }
  ],
  "servers": [
    {
      "url": "https://beats.ferrite.run"
    }
  ],
  "x-agent-card": "https://beats.ferrite.run/.well-known/agent-card.json",
  "x-ard-catalog": "https://beats.ferrite.run/.well-known/ard.json",
  "x-llms-txt": "https://beats.ferrite.run/llms.txt",
  "x-mcp-endpoint": "https://beats.ferrite.run/mcp",
  "x-webmcp": "https://beats.ferrite.run/.well-known/webmcp.js"
}