BridgeBeats provides a RESTful API for music link conversion and lookup. This guide covers authentication, endpoints, and rate limiting.
Most API endpoints require authentication using an API key. To get an API key, you need to create a user account.
POST /account/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePassword123"
}Response:
{
"userId": "...",
"apiKey": "YOUR_API_KEY_HERE",
"message": "Registration successful. Save your API key - it will not be shown again."
}Include your API key in the X-API-Key header for all protected endpoints:
X-API-Key: YOUR_API_KEY_HEREIf you need to retrieve your API key again, you can log in:
POST /account/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePassword123"
}POST /account/regenerate-api-key
X-API-Key: YOUR_CURRENT_API_KEYTo ensure fair usage, the API implements rate limiting on protected endpoints.
- Rate: 20 requests per hour per authenticated user
- Applies to: All protected endpoints (ISRC, UPC, title, urlList)
- Exempt: Public
/music/lookup/urlendpoint (streaming)
When you exceed the rate limit, you'll receive an HTTP 429 response:
HTTP/1.1 429 Too Many Requests
Retry-After: 2700
Content-Type: application/json
{
"error": "Rate limit exceeded",
"message": "Maximum 20 requests per hour allowed. Please try again in 45 minutes.",
"retryAfter": 2700
}The Retry-After header and retryAfter field indicate how many seconds until your limit resets.
Convert a music link without authentication. Returns results as a stream.
POST /music/lookup/url
Content-Type: application/json
{
"uri": "https://music.apple.com/us/album/..."
}Response: Server-Sent Events stream with matching results
Features:
- ✅ No authentication required
- ✅ No rate limiting
- ✅ Streaming response for real-time results
Convert a music link and get all results as a single response.
POST /music/lookup/urlList
Content-Type: application/json
X-API-Key: YOUR_API_KEY
{
"uri": "https://music.apple.com/us/album/..."
}Response:
{
"results": {
"spotify": {
"artist": "Artist Name",
"title": "Track Title",
"externalId": "USRC12345678",
"url": "https://open.spotify.com/track/...",
"artUrl": "https://i.scdn.co/image/...",
"marketRegion": "us",
"isAlbum": false
},
"appleMusic": {
"artist": "Artist Name",
"title": "Track Title",
"externalId": "USRC12345678",
"url": "https://music.apple.com/us/album/...",
"artUrl": "https://is1-ssl.mzstatic.com/image/...",
"marketRegion": "us",
"isAlbum": false
}
}
}Look up a track using its ISRC (International Standard Recording Code).
POST /music/lookup/isrc
Content-Type: application/json
X-API-Key: YOUR_API_KEY
{
"isrc": "USVI20000123"
}ISRC Format:
- 12 characters (hyphens optional)
- Example:
USVI20000123orUS-VI2-00-00123 - Case-insensitive
Look up an album using its UPC (Universal Product Code).
POST /music/lookup/upc
Content-Type: application/json
X-API-Key: YOUR_API_KEY
{
"upc": "123456789012"
}UPC Format:
- 12-13 digits
- Leading zeros should be preserved
- Example:
012345678901
Search for a track or album by title and artist name.
POST /music/lookup/title
Content-Type: application/json
X-API-Key: YOUR_API_KEY
{
"title": "Song Name",
"artist": "Artist Name"
}Tips for best results:
- Use the primary/main artist name
- Avoid extra descriptors in the title (like "- Radio Edit")
- Try both the album title and track title if searching for albums
All lookup endpoints return a MediaLinkResult object with the following structure:
{
// Dictionary of results keyed by provider name
results: {
[provider: string]: {
artist: string, // Primary artist name
title: string, // Track or album title
externalId?: string, // ISRC (tracks) or UPC (albums)
url: string, // Platform link
artUrl?: string, // Artwork image URL
marketRegion: string,// ISO 3166-1 alpha-2 country code
isAlbum?: boolean // true for albums, false for tracks
}
},
// Optional user messages (warnings, info)
messages?: string[]
}spotify- SpotifyappleMusic- Apple Musictidal- Tidal
Invalid request format or parameters.
{
"error": "Invalid request",
"message": "ISRC must be 12 characters"
}Missing or invalid API key.
{
"error": "Unauthorized",
"message": "Valid API key required"
}Content not found on any configured platform.
{
"results": {},
"messages": ["No matches found"]
}Rate limit exceeded.
{
"error": "Rate limit exceeded",
"message": "Maximum 20 requests per hour allowed. Please try again in 30 minutes.",
"retryAfter": 1800
}Server-side error.
{
"error": "Internal server error",
"message": "An unexpected error occurred"
}BridgeBeats generates shareable OpenGraph cards for music links.
GET /card/{id}Returns an HTML page with OpenGraph metadata and a responsive UI displaying:
- Track/album title and artist
- Cover artwork
- Links to all available streaming platforms
- Mobile-friendly responsive design
Cards automatically expire after 24 hours.
Cards include standard OpenGraph tags:
og:type:music.songormusic.albumog:title: Track or album titleog:description: Artist and available platformsog:image: Album/track artworkmusic:musician: Artist name
This ensures proper rendering on platforms like Discord, Slack, Twitter, and Facebook.
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://bridgebeats.example.com"
# Lookup by URL
response = requests.post(
f"{BASE_URL}/music/lookup/urlList",
headers={"X-API-Key": API_KEY},
json={"uri": "https://open.spotify.com/track/..."}
)
if response.status_code == 200:
data = response.json()
for provider, result in data["results"].items():
print(f"{provider}: {result['url']}")const axios = require('axios');
const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://bridgebeats.example.com';
async function lookup(uri) {
try {
const response = await axios.post(
`${BASE_URL}/music/lookup/urlList`,
{ uri },
{ headers: { 'X-API-Key': API_KEY } }
);
return response.data.results;
} catch (error) {
if (error.response?.status === 429) {
console.log(`Rate limited. Retry after ${error.response.headers['retry-after']} seconds`);
}
throw error;
}
}curl -X POST https://bridgebeats.example.com/music/lookup/urlList \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{"uri": "https://open.spotify.com/track/..."}'- Cache results - Store lookup results locally to avoid redundant API calls
- Handle rate limits gracefully - Respect the
Retry-Afterheader - Use ISRC/UPC when available - More reliable than title/artist searches
- Validate user input - Check URL formats before sending requests
- Handle errors - Implement proper error handling for all response codes
When running BridgeBeats, interactive API documentation is available at:
http://localhost:10000/swagger
The Swagger UI allows you to:
- Browse all available endpoints
- Test API calls directly from your browser
- View request/response schemas
- Download the OpenAPI specification