Beatport API v4 plugin for beets
A drop-in replacement for the stock beets beatport plugin, updated for Beatport API v4.
As Beatport killed their API v3, the stock beatport plugin no longer works. It is also currently not possible to request API access the "normal" way (using your client credentials or an API token generated by Beatport), so this plugin uses a workaround: the public API client ID from the Beatport docs frontend.
For more info, see this issue. A pull request has also been opened in the official beets repository — if it gets merged, this plugin may be retired.
- Installation
- Authorization
- Album Art
- Singleton Album Metadata
- Configuration Reference
- Debug Logging & Sensitive Data
# if beets was installed with pip:
pip install beets-beatport4
# or, if beets was installed with pipx:
pipx inject beets beets-beatport4Then add beatport4 to the plugins list in your beets config file.
There are two ways to acquire a user access token for the Beatport v4 API.
This method is fully automatic and relies on storing your Beatport username and password in your beets config file. It authorizes via the authorization_code grant type using the client_id provided by Beatport for their swagger-ui frontend. By default, the client_id is scraped automatically from that URL. Alternatively, you can set it manually via plugin configuration.
Warning
This method stores your Beatport credentials unencrypted in the config file. If that is a concern, use Method 2 instead.
Steps:
- Add
beatport4to yourbeets/config.yamlplugins list. - Add the following configuration and fill in your credentials:
beatport4:
username: <YOUR_BEATPORT_USERNAME>
password: <YOUR_BEATPORT_PASSWORD>Use this method if you don't want to store credentials in the config file, or if something goes wrong during username/password authorization. This is also the fallback method when invalid credentials are provided.
Steps:
- Add
beatport4to yourbeets/config.yamlplugins list. - When the first import with the plugin enabled happens, you will be prompted to paste the access token JSON.
- Visit https://api.beatport.com/v4/docs/.
- Open the Network tab in your browser and start capturing traffic.
- Log in with your Beatport account.
- Search for the request to
https://api.beatport.com/v4/auth/o/token/. - Copy the response (the whole JSON structure).
- Paste it into the terminal (or save it to a
beatport_token.jsonfile next to yourbeets/config.yaml— check the path withbeet config --paths). - If the token expires, you will be prompted again to repeat the above steps.
This plugin has its own art fetching and embedding, independent of the fetchart and embedart plugins. It uses the beets.art module shipped with the core library. It handles both albums and singletons, but only works when the chosen candidate source is Beatport.
Under the hood, it uses the image URL for the track's release exposed by the Beatport API.
Enable this feature via configuration (disabled by default):
beatport4:
art: yesBy default, existing art will not be overwritten. To force overwriting:
beatport4:
art: yes
art_overwrite: yesOriginal Beatport images can be large, but thanks to Beatport's dynamic image URIs you can request a pre-resized image, saving bandwidth and local processing.
beatport4:
art: yes
art_width: 250 # omit or set to 0 to disable
art_height: 250 # omit or set to 0 to disableTip
- If you specify only one dimension, the other is set to the same value (1:1 aspect ratio).
- If you omit both dimensions, the original full-size art is downloaded.
- If you specify both dimensions, they are used in the dynamic URI, but Beatport typically returns images in 1:1 aspect ratio using the smaller dimension.
When importing singletons (individual tracks), the original Beatport plugin does not populate album-level fields such as year, album name, label, catalog number, album artist, or track number. This plugin can optionally fetch the full release data from Beatport and fill these fields.
Note
Enabling this triggers an additional API call per matched singleton track to retrieve release data. This may slow down singleton imports.
Enable the feature via configuration (disabled by default). Individual fields can be toggled off — all default to yes when the feature is enabled:
beatport4:
singletons_with_album_metadata:
enabled: yes
year: yes # release date (year, month, day)
album: yes # album name
label: yes # record label
catalognum: yes # catalog number
albumartist: yes # album artist
track_number: yes # track number within the release| Option | Type | Default | Description |
|---|---|---|---|
art |
bool | no |
Enable album art fetching and embedding |
art_overwrite |
bool | no |
Overwrite existing art if already present |
art_width |
int | (none) | Target image width in pixels (0 or omit to disable resizing) |
art_height |
int | (none) | Target image height in pixels (0 or omit to disable resizing) |
singletons_with_album_metadata.enabled |
bool | no |
Fetch release data for singleton imports |
singletons_with_album_metadata.year |
bool | yes |
Populate release date fields |
singletons_with_album_metadata.album |
bool | yes |
Populate album name |
singletons_with_album_metadata.label |
bool | yes |
Populate record label |
singletons_with_album_metadata.catalognum |
bool | yes |
Populate catalog number |
singletons_with_album_metadata.albumartist |
bool | yes |
Populate album artist |
singletons_with_album_metadata.track_number |
bool | yes |
Populate track number within the release |
username |
string | (none) | Your Beatport username (for auto-authorization) |
password |
string | (none) | Your Beatport password (for auto-authorization) |
client_id |
string | (auto) | Beatport API client ID (scraped automatically from docs) |
Full example with all defaults:
beatport4:
art: no
art_overwrite: no
art_width: 0
art_height: 0
singletons_with_album_metadata:
enabled: no
year: yes
album: yes
label: yes
catalognum: yes
albumartist: yes
track_number: yes
username:
password:
client_id: # optional, scraped automatically from Beatport docsWhen running beets with verbose logging (beet -vv), the plugin automatically redacts sensitive information — usernames, emails, authorization codes, and access tokens — replacing them with <REDACTED>. This makes it safe to paste -vv output into bug reports.
If you need the full unredacted output for local debugging, set the BEATPORT4_DEBUG_DISABLE_REDACTION environment variable:
Linux / macOS:
BEATPORT4_DEBUG_DISABLE_REDACTION=1 beet -vv import /path/to/musicWindows (PowerShell):
$env:BEATPORT4_DEBUG_DISABLE_REDACTION = "1"
beet -vv import C:\path\to\musicWindows (cmd):
set BEATPORT4_DEBUG_DISABLE_REDACTION=1
beet -vv import C:\path\to\musicApart from the above, the plugin works the same way as the stock one — refer to the official documentation for general usage.