Discogs API: Releases and Marketplace Data as JSON
The Discogs API on Perceptlayer is three endpoints that return Discogs data as JSON: search finds releases, masters, artists and labels, release looks up one release by id, and marketplace returns listings for a release_id. Search and marketplace cost 1 credit per successful call, and release costs 1–2 credits. This guide shows each request, the parameters, a recorded vinyl search, and what a daily record-price tracker costs per release.
Which Discogs endpoints are there?
There are three Discogs endpoints, all GET, all on the standard tier. Search is the entry point when you have an artist, title or barcode-style query; release gives you one release by its numeric id; marketplace gives you listings for one release. Search and marketplace cost 1 credit per successful call, and release costs 1–2 credits.
| Endpoint | What it's for | Credits | Required | Optional |
|---|---|---|---|---|
GET /v1/discogs/search |
Releases, masters, artists or labels | 1 | none | q, type, format, genre, style, year, country, page, per_page |
GET /v1/discogs/release |
One release | 1–2 | id |
currency, include_sales_stats |
GET /v1/discogs/marketplace |
Marketplace listings for a release | 1 | release_id |
condition, sleeve_condition, currency, ships_from, limit, cursor |
Each endpoint has its own page with the playground: search, release and marketplace. The Discogs API page lists all three together. This guide covers what Perceptlayer returns; if you're also weighing Discogs' own developer offering, compare its terms and limits yourself.
How do you search Discogs releases?
Send a GET request to https://api.perceptlayer.com/v1/discogs/search with your filters and your key in the X-API-Key header. The recorded request below searches for nirvana, limits results to type=release and format=vinyl, and asks for 5 results a page. It costs 1 credit.
curl "https://api.perceptlayer.com/v1/discogs/search?q=nirvana&type=release&format=vinyl&per_page=5" \
-H "X-API-Key: $API_KEY"
Keys start with sk_live_. Where you can't set a header, the key can go in the api_key query parameter; the authentication docs cover both. Every successful response carries X-Credits-Used and X-Credits-Remaining, so a job can log what each call cost and what's left.
Which search parameters can you use?
Every search parameter is optional, so a call can filter on text, on catalogue facets, or on both. The table lists each parameter with the constraint the API documents. Defaults and page sizes aren't documented, so set type and per_page explicitly in scheduled jobs.
| Parameter | Type | Documented constraint |
|---|---|---|
q |
string | Up to 200 characters |
type |
string | One of release, master, artist, label |
format |
string | Up to 100 characters |
genre |
string | Up to 100 characters |
style |
string | Up to 100 characters |
year |
integer | No further constraint documented |
country |
string | Up to 100 characters |
page |
integer | No further constraint documented |
per_page |
integer | No further constraint documented |
What does the search response contain?
The response holds the query context, a results array of releases, and a pagination block with page, per_page, pages and total. The recorded vinyl search for nirvana reports 3,587 matching releases across 718 pages. This is the recorded response, trimmed to two results:
{
"success": true,
"data": {
"query": "nirvana",
"type": "release",
"results": [
{
"id": 7445961,
"type": "release",
"title": "Nirvana - Nirvana",
"year": 2015,
"country": "Europe",
"url": "https://www.discogs.com/release/7445961-Nirvana-Nirvana",
"master_id": 42476,
"formats": ["Vinyl", "LP"],
"labels": ["DGC", "Sub Pop"],
"genres": ["Rock"],
"styles": ["Grunge", "Alternative Rock"],
"catalog_number": "0602547378781",
…
"community": {
"have": 22869,
"want": 1807
}
},
{
"id": 7802791,
…
"year": 2015,
"country": "US",
"master_id": 42476,
"labels": ["Geffen Records", "Sub Pop"],
"catalog_number": "B0023396-01",
…
"community": {
"have": 10779,
"want": 755
}
}
],
"pagination": {
"page": 1,
"per_page": 5,
"pages": 718,
"total": 3587
}
},
"meta": {
"endpoint_family": "search",
"credits_charged": 1,
…
}
}
| Field | What it tells you |
|---|---|
id |
The release's numeric identifier |
master_id |
Groups pressings of the same record: both results share 42476 |
year, country |
Which pressing this is (here, a 2015 Europe and a 2015 US release) |
labels, catalog_number, barcodes |
How to tell pressings apart on the shelf |
community.have, community.want |
The community's have and want counts for the release |
pagination.pages, pagination.total |
How much more there is to page through |
Two details matter for collectors and price trackers. The two results are different pressings of one record: same master_id, different country, labels and catalog_number. A tracker should key on id, not on title. And community.want against community.have is a rough demand signal: 1,807 wants to 22,869 haves for the Europe pressing, 755 to 10,779 for the US one.
How do you look up a release and its listings?
Once you have a release id, call release for that one release and marketplace for its listings. The search result's id and the release endpoint's id parameter share a name, and marketplace takes an integer release_id; the names match, though we don't have a recording of the hand-off. Try the recorded 7445961 on both endpoint pages in the playground to see the fields before you build on them.
curl "https://api.perceptlayer.com/v1/discogs/release?id=7445961¤cy=EUR" \
-H "X-API-Key: $API_KEY"
curl "https://api.perceptlayer.com/v1/discogs/marketplace?release_id=7445961&condition=near_mint¤cy=EUR" \
-H "X-API-Key: $API_KEY"
We don't have a recorded response for either endpoint, so this guide doesn't show their fields. The parameters are documented:
| Endpoint | Parameter | Documented constraint |
|---|---|---|
release |
id |
Integer, required |
release |
currency |
One of USD, EUR, GBP, AUD, CAD, JPY, CHF, MXN, BRL, NZD, SEK, ZAR |
release |
include_sales_stats |
Boolean |
marketplace |
release_id |
Integer, required |
marketplace |
condition |
One of mint, near_mint, very_good_plus, very_good, good_plus, good, fair, poor |
marketplace |
sleeve_condition |
The same grades, plus generic, not_graded, no_cover |
marketplace |
currency |
Same list as release |
marketplace |
ships_from |
String, up to 60 characters |
marketplace |
limit |
Integer |
marketplace |
cursor |
String, up to 300 characters |
The release endpoint costs 1–2 credits per successful call. Read X-Credits-Used on each response rather than assuming either figure. When you store marketplace data, keep the listing fields you need and leave seller names out.
How do you build a record-price tracker?
A record-price tracker resolves each record to a release id once, then checks the release and its marketplace listings on a schedule. The resolving step uses search, whose fields are recorded, so the script below stores them in SQLite along with community.have and community.want, which you can chart as a demand signal over time.
import datetime
import os
import sqlite3
import time
import requests
API_KEY = os.environ["API_KEY"]
BASE = "https://api.perceptlayer.com/v1/discogs"
WATCH = ["nirvana nevermind", "radiohead ok computer"]
def get(path, params, attempts=3):
for _ in range(attempts):
r = requests.get(f"{BASE}/{path}", params=params,
headers={"X-API-Key": API_KEY}, timeout=60)
if r.status_code in (429, 503):
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
r.raise_for_status()
return r.json(), r.headers.get("X-Credits-Used")
raise RuntimeError(f"gave up on {path} {params}")
db = sqlite3.connect("records.db")
db.execute("""CREATE TABLE IF NOT EXISTS releases (
day TEXT, query TEXT, id INTEGER, master_id INTEGER, title TEXT,
year INTEGER, country TEXT, catalog_number TEXT,
have INTEGER, want INTEGER, PRIMARY KEY (day, id))""")
today = datetime.date.today().isoformat()
for q in WATCH:
body, credits = get("search", {"q": q, "type": "release",
"format": "vinyl", "per_page": 5})
for item in body["data"]["results"]:
community = item.get("community", {})
db.execute("INSERT OR REPLACE INTO releases VALUES (?,?,?,?,?,?,?,?,?,?)", (
today, q, item["id"], item.get("master_id"), item.get("title"),
item.get("year"), item.get("country"), item.get("catalog_number"),
community.get("have"), community.get("want")))
print(q, "credits used:", credits)
time.sleep(1)
db.commit()
From those rows, pick the pressings you care about and add their id values to a second job that calls release and marketplace once a day each. Look at one response of each in the playground first and add the price and condition columns you see there. The one-second pause keeps the script within the free tier's 1 request a second; a paying account runs at least 5 a second.
What should the job do with errors?
Every error comes back with an HTTP status and a JSON body with code, message and request_id. The script waits on rate_limited (429) and temporarily_unavailable (503) using Retry-After. Treat not_found (404) as a release id to check and invalid_parameters (422) as a bug in your parameters, such as a condition outside the documented grades. Requests have no idempotency key, so a client timeout may hide a call that succeeded and was billed. The errors docs list every code.
What does tracking record prices cost?
Tracking one release costs the release call plus the marketplace call for each check: 1–2 credits plus 1 credit, so 2 to 3 credits per release per day. The one-time search to resolve each record costs 1 credit per query. Only successful calls are billed, so a retry after a failure doesn't double the bill.
| Plan | Arithmetic | Credits |
|---|---|---|
Resolve 100 records with search |
100 × 1 credit, once | 100 |
100 releases, marketplace only, daily for 30 days |
100 × 30 × 1 credit | 3,000 |
100 releases, release and marketplace daily for 30 days |
100 × 30 × (1–2 + 1) credits | 6,000 to 9,000 |
500 releases, marketplace only, daily for 30 days |
500 × 30 × 1 credit | 15,000 |
The 100 free credits on signup cover resolving 100 records, or a week of daily release and marketplace checks on 4 releases (at most 4 × 7 × 3 = 84 credits). The 100-release plans fit the Starter pack's 10,000 credits, and 500 releases fit the Build pack's 50,000. Purchased credits last 12 months, with no subscription. See pricing for what credits cost and the credits docs for how debits work.
To try it, run search with a record you own in the playground on the Discogs API page, then call marketplace with its id and see what comes back. When the fields fit, get a free API key and schedule the script. More guides like this one are in the API guides category.
APIs in this post
Frequently asked questions
How much does a Discogs API call cost?
On Perceptlayer, search and marketplace cost 1 credit per successful call, and release costs 1–2 credits. Failed calls cost nothing and return X-Credits-Used: 0, and every successful response carries X-Credits-Used, so you can log the exact cost of each call. The pricing page lists what credit packs cost.
Can I search Discogs by barcode or catalogue number?
The search endpoint takes q as free text up to 200 characters, plus type, format, genre, style, year and country. Results carry catalog_number and barcodes, so you can check a match against what's on your sleeve. Whether a barcode in q finds the release is worth testing in the playground with a record you have.
How do I tell pressings of the same record apart?
Use master_id to group them and id to tell them apart. In the recorded vinyl search, two results share master_id 42476 but differ in country (Europe and US), labels and catalog_number. Key your tracker on the release id, since prices and demand differ between pressings.
Can I filter marketplace listings by condition and currency?
Yes. GET /v1/discogs/marketplace takes condition (from mint down to poor), sleeve_condition (the same grades plus generic, not_graded and no_cover), currency (12 currencies including USD, EUR and GBP), ships_from, limit and cursor. Each call costs 1 credit.
How fast can a Discogs tracking job run?
Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second (60 a minute). Paying accounts run at least 5 a second (300 a minute), so 100 releases with two calls each finish in about 40 seconds. A 429 carries Retry-After; the rate limits docs list the rate each pack includes.