Introduction
The SoundCloud API is built with the design principles of REST in mind, exposing SoundCloud resources like tracks, sets and users which can be accessed and manipulated using the HTTP methods GET, POST, PUT and DELETE. We aim to provide all features which are available on SoundCloud.com itself through the API as well.
All SoundCloud resources are accessed and manipulated in a similar way.
A list of the latest resources is usually available through /[resource name], a single specific resource through
/[resource name]/[id] and related subresources like a tracks comments through
/[resource name]/[id]/[subresource name].
To start using the API, you’ll first need to register an app. Once created you
can use the client_id and client_secret of your new app to acquire an OAuth token.
All requests to the API require a proper OAuth authentication token, either one acquired via client_id/client_secret or a proper user one. All tokens need to be refreshed regularly.
This cURL example will do a GET request on
/tracks and pass an Authorization header with a valid OAuth token.
If you have the cURL tool installed you
can replace A_VALID_TOKEN with your own and run this example in
your terminal.
Lets examine the request:
curl -H "Authorization: OAuth A_VALID_TOKEN" "https://api.soundcloud.com/tracks?limit=10"
The Authorization header is passed to authenticate. The examples in the documentation will always use A_VALID_TOKEN.
Please replace this with your own token.
For more information on how to acquire a token, please see the Authentication section.
The next parameter is limit=10. It will limit the
returned collection to 10 tracks instead of the default of 50 tracks. Read more about pagination and collections here.
The response itself is a JSON array of track objects. Each object holds a bunch of attributes like title, duration and permalink_url for example. The track attributes and subresources are described in detail in the /tracks section.
Have a look at Creating a comment and Updating a user to see how resources are manipulated.
This was a first introduction to the SoundCloud API. Continue and have a closer look at the available resources like /users and /tracks or find out how the /authentication works. Also check out the SDKs that could help you building your app. If you haven't found the answer to your question checkout the Q&As and comments at the end of each section or get in touch with us.