
FreeSound
MusicWith the Freesound API you can browse, search, and retrieve information about Freesound users, packs, and the sounds themselves of course. You can find similar sounds to a given target (based on content analysis) and retrieve automatically extracted features from audio files.
π Documentation & Examples
Everything you need to integrate with FreeSound
π Quick Start Examples
// FreeSound API Example
const response = await fetch('https://freesound.org/docs/api/index.html', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);An Introduction to the FreeSound API
If you're interested in accessing a massive database of sounds and audio clips, the FreeSound API is worth checking out. This public API provides a wealth of data and information about a variety of different sounds, ranging from natural noises to musical recordings and more.
How to Get a Freesound API Key
- Create a free account at freesound.org (or log in).
- Go to freesound.org/apiv2/apply and fill in the short form (application name and description) to request API credentials.
- Your API key (token) appears immediately in the credentials table on that page β there's no approval wait.
For most read-only requests (searching and fetching sounds), simple token authentication is enough: pass the key as a token query parameter, or in an Authorization: Token YOUR_KEY header.
curl "https://freesound.org/apiv2/search/text/?query=piano&token=YOUR_API_KEY"
If you need to act on behalf of a user β downloading original files, uploading, or bookmarking β Freesound also supports OAuth2 (authorization-code flow); those access tokens last 24 hours and can be refreshed. Both mechanisms use the same credentials you created on the apply page.
Making API Requests in JavaScript
To help you get started with the FreeSound API, here are some example code snippets in JavaScript that show you how to make various types of requests:
Searching for Sounds
To search for sounds in the FreeSound API, you can use the following code:
const apiKey = 'YOUR_API_KEY_GOES_HERE';
const query = 'piano';
const url = `https://freesound.org/apiv2/search/text/?query=${query}&token=${apiKey}`;
fetch(url)
.then(response => response.json())
.then(data => console.log(data));
This code uses the fetch function to make a request to the API with a search query for "piano". The response data is returned as a JSON object that can be accessed in the then callback.
Accessing Sound Details
To access details about a specific sound in the FreeSound API, you can use the following code:
const apiKey = 'YOUR_API_KEY_GOES_HERE';
const soundId = 1234;
const url = `https://freesound.org/apiv2/sounds/${soundId}/?token=${apiKey}`;
fetch(url)
.then(response => response.json())
.then(data => console.log(data));
This code makes a request to the API for the sound with the ID of 1234. Again, the response data is returned as a JSON object that can be accessed in the then callback.
Accessing Sound Analyses
Finally, you can also access detailed analyses of sounds in the FreeSound API using the following code:
const apiKey = 'YOUR_API_KEY_GOES_HERE';
const soundId = 1234;
const url = `https://freesound.org/apiv2/sounds/${soundId}/analysis/?token=${apiKey}`;
fetch(url)
.then(response => response.json())
.then(data => console.log(data));
This code requests the detailed analysis of the sound with the ID of 1234. Again, the response data is returned as a JSON object that can be accessed in the then callback.
Conclusion
The FreeSound API is a powerful and versatile tool for accessing a wide range of sounds and audio data. With these code examples in JavaScript, you should be able to get started with making your own requests and exploring the many features of this impressive API.









