Overview
A provider is a program that holds music and implements the provider protocol over HTTP. Let’s DJ ships with none, so somebody has to run one.
You run it, in any programming language you like. Your files never pass through our servers.
The parts
The service holds a mirror of your catalog, the queue, and who is in the room. The Stage is the screen everybody watches: a web page at app.lets.dj, open on a television or a laptop. It is the only thing that plays anything. Phones search and queue.
Your catalog goes to the service, because a guest’s phone may be on cellular and should never need to reach your server. Your media goes straight to the Stage and is never proxied.
A phone talks only to the service, with one exception: if you offer previews, the phone fetches those bytes from you directly.
How a song reaches the screen
Steps 1 to 4 are ours. You are only in steps 5 and 6 — and in whatever you did earlier to put the song in the mirrored catalog.
The Stage builds that address itself, from the baseUrl and mediaToken of your last sync plus the track’s externalId. You never construct it. It resolves the address when the song is about to play, and keeps it for the length of that song.
So the whole of a provider is two requests:
POST https://api.lets.dj/providers/sync you tell us what you have
GET <baseUrl>/media/<externalId>?t=<token> the Stage asks you for one of them
Push or pull
Which way your catalog moves depends on whether we can reach you.
| Who starts it | Example | |
|---|---|---|
| Push | You, whenever your library changes | Anything on a home network |
| Pull | Us, on a schedule | An S3-compatible bucket |
Push is what the bridge does and what these pages describe. Pull exists for one provider kind so far — see Cloud storage.
What you build
- Get a sync token. Display a code, and the owner approves it in the app. See Connecting a provider.
- Serve HTTPS with a certificate browsers already trust. On a home network, request a name and certificate from us. See A name and a certificate.
- Serve media on one route, supporting range requests. See Serving media.
- Push your catalog and declare your capabilities. See Sending a catalog and Capabilities.
Then sync again whenever your library changes, and renew the certificate before it expires.
Everything else is optional, and nothing else assumes it:
- Artwork — cover images, by URL or uploaded as bytes.
- Looping covers — a short silent video in place of the artwork on an audio-only track.
- Media kinds — say whether a track is a song, a video or karaoke.
- Answering on demand — search a source larger than your catalog, and fetch what somebody picks.
- Audio analysis — let the Stage draw what is playing. Requires CORS headers on your media responses.
Conventions
Bodies are JSON in UTF-8. Media is bytes; artwork is an image. Unrecognized fields are ignored, empty strings are treated as absent, and numbers must be finite.
Authenticate with Authorization: Bearer <sync token> on every /providers/… request. Two exceptions: starting a pairing takes no credential, and polling one uses the poll secret. See Connecting a provider.
Errors return a non-2xx status and { "error": "<words>" }. Pairing, address and certificate routes also return "code": "<machine-readable>". Act on the status and on code; never on the words, which change.
| Status | Meaning |
|---|---|
400 |
Malformed request. error names the part. |
401 |
No bearer token. |
403 |
Token not recognized. For a sync token this is permanent — the library was deleted. Discard the token and stop retrying. |
404 |
Unknown track or job. |
429, 502, 503 |
Ours. Retry, waiting as long as Retry-After says when it is present. |
Every field added to this protocol has been optional, and absent means whatever it meant before the field existed.
Sync when your library changes. These routes are not rate limited today. Poll for jobs about once a second, and only if you opted in.
Glossary
- The service — the Let’s DJ backend, at
https://api.lets.dj. Every/providers/…path is relative to it, over HTTPS. - Library — a connected provider, as the app calls it. Its owner is the person who connected it. Each library has its own sync token.
- Party — one session. Its Stage is the screen everybody watches. Guests queue from their phones.
- Track — one song or video. Catalog — the list of them. Media — the audio or video itself.
- Sync token — identifies your library to the service. We issue it.
- Media token — protects your media. You generate it.
- The bridge — the provider we publish, for sharing a folder of files. It has no privileges this protocol withholds from yours.