🤔Getting Started

Needed information on how to get started.

Making requests and the limitations of the API

Sadly, TuneIn has a same-origin policy, that forbids you to access the API via JavaScript. However, you are still able to make requests using cURL, Postman, or other such software. This means that you can use PHP and its command execution functions to have a fully web-based radio streaming experience (although server-sided) or a custom software client/app.

All requests are made to the Base-URI defined in the Introdcution section, with the endpoints respective path appended and HTTP method specified before the path.

Authentication & Security

Although TuneIn implemented a same-origin policy, they did not implement any authentication which means you can get started right away.

You need to specify the protocol that you want to use (HTTP/ HTTPS) since there is no automatic redirection to https even if you/the client can fully support an https connection.

Keep in mind that all URLs given as a response by the API will start with http:// no matter which protocol you requested. So you will need to replace http:// with https:// on your end to use HTTPS.

http://opml.radiotime.com | not secure by default.
https://opml.radiotime.com | secure and encrypted.

An example request using curl could look like the following:

# Docs: GET /endpoint.ashx
curl -s -X GET "https://opml.radiotime.com/endpoint.ashx"

API Responses

The API always responds with an XML Document which usually looks something like this if you made a valid request.

Response (valid request)
<opml version="1">
    <head>
        <title>Some Title</title>
        <status>200</status>
    </head>
    <body>
        <outline type="audio" text="OctoStation" URL="http://opml.radiotime.com/Tune.ashx?id=a12345" bitrate="128" reliability="99" guide_id="s45087" subtext="OctoStation" genre_id="g61" formats="mp3" item="station" image="http://cdn-profiles.tunein.com/a12345/images/logoq.png" now_playing_id="a12345" preset_id="a12345"/>
    </body>
</opml>
Response (invalid request)
<opml version="1">
    <head>
        <title>Invalid method</title>
        <status>404</status>
        <fault>Invalid method</fault>
        <fault_code>api.methodNotFound</fault_code>
    </head>
    <body> </body>
</opml>

Alternative responses

Alternatively, you can add &render=json to the end of the request and render it in the json format. By default you will get an XML document. Other types of rendering have not yet been found. Feel free to add those into the documentation.

# Docs: GET /endpoint.ashx | with &render=json added
curl -s -X GET "https://opml.radiotime.com/endpoint.ashx&render=json"
Response (valid request)
{
  "head": { "title": "Some title", "status": "200" },
  "body": [
    {
      "element": "outline",
      "type": "audio",
      "text": "OctoStation",
      "URL": "http://opml.radiotime.com/Tune.ashx?id=a12345",
      "bitrate": "128",
      "reliability": "99",
      "guide_id": "a12345",
      "subtext": "OctoStation",
      "genre_id": "g61",
      "formats": "mp3",
      "item": "station",
      "image": "http://cdn-profiles.tunein.com/a12345/images/logoq.png",
      "now_playing_id": "a12345",
      "preset_id": "a12345"
    }
  ]
}
Response (invalid request)
{
  "head": {
    "title": "Invalid method",
    "status": "404",
    "fault": "Invalid method",
    "fault_code": "api.methodNotFound"
  },
  "body": []
}

Last updated