docs(apple): GET /api/apple/songs — batch ISRC lookup contract
Contract for a new Apple Music catalog lookup endpoint. Implements the docs step of recoupable/chat#1959.
Merge order: this PR, then the api implementation. Documentation-driven development — the response shape is settled here, in review, rather than discovered in a code diff.
What this documents
GET /api/apple/songs?isrc=A,B,C&storefront=us — up to 25 comma-separated ISRCs, one result row per requested ISRC.
The shape decision worth reviewing: results are keyed on what the caller asked for, not on what Apple returned. A recording Apple does not carry comes back as { "isrc": "...", "found": false, "songs": [] } rather than being silently omitted. That is what makes the endpoint answerable for catalog-availability diligence — the absence is the answer, so it has to be in the response.
Second shape decision: songs is an array, not a single object. One ISRC legitimately maps to several Apple song ids when the same recording appears on multiple releases (compilations, anniversary editions). Verified against the live API — a test ISRC returned 6.
Why this is not a mirror of the Spotify endpoints
Spotify reaches ISRCs only through a fuzzy search query (q=isrc:X), which is why lib/spotify/getIsrc.ts wraps getSearch. Apple's filter[isrc] is an exact identifier filter, and it echoes every requested identifier back — including the misses — in meta.filters.isrc.
Apple also returns release-level rights metadata Spotify does not expose: upc, record_label, and copyright (the ℗ line). Those are documented on AppleSongAlbum.
Deliberately not documented here: Apple twins of /spotify/artist, /artist/albums, /artist/topTracks, or /search. All four Apple counterparts respond 200 with our key, but Apple publishes no popularity or follower metric on any catalog object, so they would carry strictly less signal than the Spotify endpoints already shipped.
Accuracy notes
Every documented field and example value was taken from a live Apple Music API response captured 2026-08-17, not from Apple's documentation. The documented status codes are the four the endpoint will actually emit — no 403 or 404, since auth is account-level with no per-artist scoping (matching the precedent in validateGetSongsRequest.ts, whose comment records that ISRC-keyed song metadata is DSP-public) and a missing recording is a 200 with found: false, never a 404.
The 500 covers an unreachable Apple API. There is no 429: Apple surfaced no rate-limit headers across the probe run, and responses are Akamai-cached.
Changes
api-reference/openapi/social.json— the/api/apple/songspath plusAppleSongsResponse,AppleIsrcResult,AppleSong,AppleSongAlbum,AppleErrorResponse. Purely additive; the file does not round-trip throughjson.dumpsbyte-for-byte, so the blocks were inserted as anchored text edits and the result re-validated as parsing with all$refs resolving.api-reference/apple/songs.mdx— reference pagedocs.json— new "Apple Music" nav group under the Social Media tab, beside Spotify
🤖 Generated with Claude Code
Summary by cubic
Documents the contract for GET /api/apple/songs (batch ISRC lookup) and corrects the error-response schema to match actual output. This enables catalog-availability checks and rights metadata ahead of implementation.
- One result per requested ISRC (misses return
found: false);songsis an array for one-to-many ISRC→song mappings. - Endpoint and params:
GET /api/apple/songs?isrc=A,B,...&storefront=us(max 25 ISRCs;storefrontoptional, defaultus). - Album object includes rights fields Apple exposes:
upc,record_label,copyright. - Status codes: 200, 400, 401, 500. No 404/403/429.
- Error contract fixed:
AppleErrorResponseis{ status, error }only; separate examples for 400/401/500.
Docs changes and rollout
- Adds OpenAPI path and schemas
AppleSongsResponse,AppleIsrcResult,AppleSong,AppleSongAlbum,AppleErrorResponseinapi-reference/openapi/social.json; updates per-status examples. - Adds
api-reference/apple/songs.mdxand an “Apple Music” nav group indocs.json. - Merge this PR first; implement the API against this contract next. No runtime changes.