Orchdio API documentation
  • ๐Ÿ‘‹Welcome!
  • Quick Start
  • Reference
    • API Reference
      • ๐Ÿ”’ Authentication
        • Spotify
        • Deezer
        • Apple Music
      • โš›๏ธEntity
        • Track
        • Playlist
      • ๐Ÿ“‘Library management
        • Add playlist to library
      • ๐Ÿ‘ฅAccount management
        • Account information
        • Library playlists
        • Library artists
        • Library albums
        • Listening history
      • ๐ŸชWebhooks
  • โš—๏ธMiscellaneous
    • Target platform values
    • ๐Ÿ”ฎShowcases
    • FAQ (The frequent "whats" and "whys")
Powered by GitBook
On this page
  1. Reference
  2. API Reference
  3. Entity

Track

Retrieving a track's meta information.

PreviousEntityNextPlaylist

Last updated 1 year ago

Create a new track conversion

Track conversion is the simplest API available on Orchdio. To convert a track, you make a post request to the convert endpoint, with the url you're trying to convert as the value.

Some platforms (like Deezer web app) allow you copy short URL when sharing. We try to handle this on our end but for better user experience in your app, it is recommended you detect shortlink URLs and extract the real link.

There are various url preview libraries depending on the language or framework you are building with. You can use if you are using JavaScript and we have written for those using Rust.

An example on how to do this is show below, in JavaScript.

// check if the "link" being converted is a shorturl. Then preview
// and log the real link if its a short link.
// It is assumed that your function is an async function

// rest of your code here

let isShortLink = ["deezer.page.link", "link.tospotify.com"].some((shortLink) => link.includes(shortLink));
if (isShortLink) {
const preview = await getLinkPreview(url, {
  resolveDNSHost: async (url) => {
  const { hostname } = new URL(url);
  dns.lookup(hostname, (err, address) => {
  if (err) {
    console.log(err);
    } else {
        return address;
      }
    })
  },
    followRedirects: "follow"
    });
    
    const { url } = preview
    console.log("Real link to be converted is: %s", url)
  }

When converting to a track, you must specify the target_platform in the request body. You can pass all in order to return results from all platforms you've specified credentials for.

The result from track conversion looks like

{
   "data":{
      "payload":{
         "entity":"track",
         "platforms":{
            "deezer":{
               "url":"https://www.deezer.com/track/578715442",
               "artists":[
                  "Metro Boomin",
                  "Travis Scott"
               ],
               "duration":"2:46",
               "duration_milli":166000,
               "explicit":true,
               "title":"Overdue",
               "preview":"https://cdns-preview-f.dzcdn.net/stream/c-f2111147b90ec612bfe7a3b2ed18fdd7-7.mp3",
               "album":"NOT ALL HEROES WEAR CAPES",
               "id":"578715442",
               "cover":"https://api.deezer.com/album/77438442/image"
            },
            "tidal":{
               "url":"http://www.tidal.com/track/98114671",
               "artists":[
                  "Metro Boomin",
                  "Travis Scott"
               ],
               "release_date":"2018-11-06T00:00:00.000+0000",
               "duration":"2:46",
               "duration_milli":166000,
               "explicit":true,
               "title":"Overdue",
               "preview":"",
               "album":"NOT ALL HEROES WEAR CAPES (Deluxe)",
               "id":"98114671",
               "cover":"https://resources.tidal.com/images/1e18a9c9/909d/4978/974f/d15e4f984f1d/320x320.jpg"
            }
         },
         "short_url":"vhdZgfJap"
      }
   },
   "message":"Request Ok",
   "status":200
}
โš›๏ธ
link-preview-js
a little library
post
Header parameters
x-orchdio-public-keystring ยท uuidRequired

The public key of the Orchdio server

Example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
Body
urlstringOptional

The URL of the entity to convert

Example: https://open.spotify.com/track/3Qm86XLflmIXVm1wcwkgDK?si=6a6e6f6d6e6f6f6d
target_platformstringOptional

The platform to convert to

Example: tidal
Responses
200
Successful response
application/json
Responseany

The converted entity

401
Unauthorized
application/json
500
Internal server error
application/json
post
POST /v1/entity/convert HTTP/1.1
Host: api.orchdio.dev
x-orchdio-public-key: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
Content-Type: application/json
Accept: */*
Content-Length: 109

{
  "url": "https://open.spotify.com/track/3Qm86XLflmIXVm1wcwkgDK?si=6a6e6f6d6e6f6f6d",
  "target_platform": "tidal"
}

No content