API Keys

Tens of thousands of legally cleared tracks, AI-powered search, and smart clip trimming — all via a single API key

Trackyard MCP

New

Use your API key with any MCP-compatible AI agent — Claude, Cursor, and more — to agentically search and download music. Automatically trims tracks to fit your exact use case (e.g. a 22-second clip for a 22-second video).

npx @lnrz-xyz/trackyard-mcp
View on npm

Trackyard OpenClaw Skill

New

Install the Trackyard skill for OpenClaw to search and download music directly from your bot workflows.

npx clawhub@latest install trackyard
View on Clawhub

No API keys yet

Create an API key to start integrating the music library into your apps and workflows

What you can build

The Trackyard API is built for developers integrating music into automated pipelines — anywhere you'd otherwise spend time licensing tracks manually.

Massive cleared catalog

Tens of thousands of hand-curated tracks, 100% legally cleared for social media, YouTube, podcasts, and online content.

AI-powered search

Describe what you need in plain English — "moody lo-fi for a coffee shop vlog" — and the API infers genre, mood, BPM, and instrumentation automatically.

Smart clip downloader

Trim any track to an exact duration. The algorithm finds the best-sounding segment and can align the biggest musical moment to a specific time offset.

Common use cases

Social media content farms
Social media ads
AI video generation
YouTube & podcasts
Product demos
Real estate walkthroughs
Corporate & training
App & game trailers

API Reference

Base URL: https://api.trackyard.com/api/external/v1 · Auth header: Authorization: Bearer YOUR_API_KEY

POST/search1 credit

Natural-language music search. Returns up to 100 tracks with metadata and preview URLs. Paid plans also get smart intent extraction — genres, moods, BPM, and instruments are auto-inferred from your query.

Key request fields

query required — natural language description

limit — max results (default 20, max 100)

offset — pagination offset

filters.genres / moods / min_bpm / max_bpm / has_vocals / energy_level / instruments — all optional

Response includes

tracks[].id — use with download endpoint

credits_remaining — updated balance

curl -X POST https://api.trackyard.com/api/external/v1/search \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "upbeat electronic for tech startup video",
    "limit": 5,
    "filters": { "has_vocals": false }
  }'
POST/download-track1 credit

Download a track as a streamed MP3. Pass duration_seconds to get a smart-trimmed clip — the backend analyses the waveform to find the best-sounding segment. Optionally align a musical hit to a specific offset with hit_point_seconds.

track_id required

duration_seconds — clip length in seconds; omit for full track

hit_point_seconds — offset where the dominant energy peak should land (requires duration_seconds)

Full track

curl -X POST https://api.trackyard.com/api/external/v1/download-track \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"track_id": "TRACK_ID"}' \
  --output track.mp3

30-second clip (best segment auto-selected)

curl -X POST https://api.trackyard.com/api/external/v1/download-track \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"track_id": "TRACK_ID", "duration_seconds": 30}' \
  --output clip.mp3

22-second clip — big hit lands at 12 seconds

curl -X POST https://api.trackyard.com/api/external/v1/download-track \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"track_id": "TRACK_ID", "duration_seconds": 22, "hit_point_seconds": 12}' \
  --output clip.mp3

Response: Content-Type: audio/mpeg with Content-Disposition: attachment; filename="..."

GET/mefree

Returns API key metadata: tier, credits remaining, monthly allowance, and rate limits.

curl https://api.trackyard.com/api/external/v1/me \
  -H "Authorization: Bearer $API_KEY"
GET/usagefree

Paginated usage history. Supports limit and offset query params. Each record includes endpoint, status code, credits consumed, and response time.

curl "https://api.trackyard.com/api/external/v1/usage?limit=50&offset=0" \
  -H "Authorization: Bearer $API_KEY"

Rate Limit Headers

Every response includes these headers so you can track usage programmatically.

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 8
X-RateLimit-Limit-Daily: 1000
X-RateLimit-Remaining-Daily: 987
X-Credits-Remaining: 487

Error Codes

401Invalid or missing API key
402Out of credits — top up or upgrade your plan
429Rate limit exceeded — response includes retry_after seconds
500Server error

Code Examples

JavaScript

const API_KEY = process.env.TRACKYARD_API_KEY
const BASE = "https://api.trackyard.com/api/external/v1"

// 1. Search
const searchRes = await fetch(`${BASE}/search`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "upbeat music for tech startup promo video",
    limit: 5,
    filters: { has_vocals: false },
  }),
})
const { tracks, credits_remaining } = await searchRes.json()

// 2. Download the top result as a 30-second clip
const dlRes = await fetch(`${BASE}/download-track`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ track_id: tracks[0].id, duration_seconds: 30 }),
})
const mp3Buffer = await dlRes.arrayBuffer()

Python

import requests, os

API_KEY = os.environ["TRACKYARD_API_KEY"]
BASE = "https://api.trackyard.com/api/external/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

# Search
tracks = requests.post(
    f"{BASE}/search",
    headers=HEADERS,
    json={"query": "chill lo-fi background music", "limit": 3},
).json()["tracks"]

# Download first result as full track
with open("track.mp3", "wb") as f:
    f.write(requests.post(
        f"{BASE}/download-track",
        headers=HEADERS,
        json={"track_id": tracks[0]["id"]},
    ).content)