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
of your new app to do public API calls.
This cURL example will do a GET request on
/tracks and pass the parameters client_id
and limit
.
If you have the cURL tool installed you
can replace the client_id
parameter with your own and run this example in
your terminal.
Lets examine the request:
https://api.soundcloud.com/tracks?client_id=#{client_id}&limit=10
The first parameter client_id=YOUR_CLIENT_ID
is passed to authenticate as
an app. The examples in the documentation will always use YOUR_CLIENT_ID
.
Please replace this with your own client id.
An exception for the client_id
requirement is when a valid OAuth access
token is passed. This means that you are doing API calls for a SoundCloud
user who delegated access to your app. This is described in the next section
Authentication.
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.