# Mireo Open Source API v1 > Open, Agent-friendly HTTP contract for custom and self-hosted music sources in Mireo (iOS, iPadOS, macOS). > Build any compliant HTTP/HTTPS service, pass the zero-dependency contract validator, and import a `.mireosource` file directly into Mireo. ## Canonical Specification Files - OpenAPI 3.1.0 Spec: https://openapi.mmusic.vip/v1/openapi.yaml - Interactive API Docs: https://openapi.mmusic.vip/docs - AI Agent Build Guide: https://openapi.mmusic.vip/v1/AGENT_GUIDE.md - `.mireosource` JSON Schema: https://openapi.mmusic.vip/v1/mireosource.schema.json - Contract Validator CLI (Node 18+, zero deps): https://openapi.mmusic.vip/v1/mireo-source-check.mjs - Minimal Reference Server (Node 18+, zero deps): https://openapi.mmusic.vip/v1/examples/minimal-server/server.mjs ## Live Public Demo Source - Demo Base URL: https://openapi.mmusic.vip/demo - Demo Manifest: https://openapi.mmusic.vip/demo/v1/manifest - Ready-to-Import `.mireosource`: https://openapi.mmusic.vip/demo/demo.mireosource - One-Click Deep Link: mireo://source/add?v=1&name=Mireo%20Demo%20Source&baseURL=https%3A%2F%2Fopenapi.mmusic.vip%2Fdemo&authType=none ## Quick Instructions for AI Agents 1. Read https://openapi.mmusic.vip/v1/AGENT_GUIDE.md and https://openapi.mmusic.vip/v1/openapi.yaml. 2. Implement L1 required core first (3 endpoints): - `GET /v1/manifest` - `GET /v1/channels/{channelId}/tracks/search?q=...&page=1` - `GET /v1/channels/{channelId}/tracks/{trackId}/stream?quality=...` 3. Optionally implement L2 read endpoints (lyrics, chorus, albums, artists, playlists, discover, charts, radio, artwork) and L3 write endpoints (writePlaylists, syncFavorites, scrobble), declaring only what is implemented in `manifest.channels[].capabilities`. 4. Choose authentication in `manifest.auth.methods`: `none`, `bearer`, `apiKey`, `password` (`POST /v1/auth/login` + `/v1/auth/refresh`), or `oauth2` (OAuth 2.0 PKCE `S256` with `mireo://auth/callback`). 5. Critical client rules: - Never return HTTP 3xx redirects on API routes (Mireo disables redirects to protect credentials). - Audio stream URLs MUST support HTTP `Range` (`206 Partial Content`, `Accept-Ranges: bytes`, `Content-Range`). - Both `https://` and `http://` (including public IPs and LAN hosts) are supported; transport security is user-controlled. - Set `requiresAuth: true` ONLY on same-origin stream paths; never expect credentials on third-party CDNs. - Keep all IDs stable across restarts; never embed expiring URLs as IDs. 6. Validate before handing off to the user: ```bash curl -fsSL https://openapi.mmusic.vip/v1/mireo-source-check.mjs -o mireo-source-check.mjs node mireo-source-check.mjs --config ./my-source.mireosource --query "" ``` 7. Deliver the deployed service plus a `.mireosource` JSON file (matching https://openapi.mmusic.vip/v1/mireosource.schema.json) without plaintext passwords.