DiscogsKit is a Swift package for calling the Discogs API. It provides a Discogs client, a DiscogsEndpoint protocol, and strongly-typed endpoint enums for Database, Releases, Artists, Labels, Masters, Marketplace, and Users.
All the provided endpoints are documented word-for-word like in the official documentation.
- Swift 6.0+
- Platforms:
- iOS 17.0+
- macOS 14.0+
- tvOS 17.0+
- watchOS 10.0+
- visionOS 1.0+
Add DiscogsKit as a Swift Package dependency in your project, or include this repository directly.
- Initialize a client
// Non-authenticated
let discogs: Discogs = Discogs(name: "DiscogsKit", version: "1.0.0", consumerKey: "abcdefgh123", consumerSecret: "foobar123")
// Authenticated using personal token
let discogs: Discogs = Discogs(name: "DiscogsKit", version: "1.0.0", personalToken: "abcdefgh1234foobar5678")- Call endpoints
// Does not require authentication
let release: ReleaseResponse = try await discogs.get(for: Releases.get(id: 30490723))
// Requires authentication
let search: SearchResponse = try await discogs.get(for: Database.search(query: "Radiohead"))Note
In this example here, ReleaseResponse and SearchResponse aren't from DiscogsKit.
The Discogs client manages authentication headers, builds requests, and performs calls against https://api.discogs.com/.
get,post,put,deletemethods support typedDecodableresponses and fire-and-forget variants.send(for:using:queries:body:)andsend(for:using:)return(Data, HTTPURLResponse).makeRequest(...)buildsURLRequestwithUser-AgentandAuthorization.authorize(using:callbackURLScheme:)supports OAuth flow using Authentication Services.
- Use
consumerKey+consumerSecretfor key/secret authentication. - Use
personalTokenfor token authentication. - The client sends the
Authorization: Discogs token=...header when a token is present, orAuthorization: Discogs key=..., secret=...header otherwise.
Tests live in Tests/DiscogsKitTests.
A Secret_TEMPLATE.plist is provided at Tests/DiscogsKitTests/Data/Secret_TEMPLATE.plist for consumerKey, consumerSecret, and personalToken used in DiscogsKitTests.swift.
The Secret_TEMPLATE.plist file needs to be filled with actual tokens and keys, and renamed to Secret.plist.
© Amber Team 2026