To enjoy all our Developer Portal features, please switch to Microsoft Edge, Google Chrome or Mozilla Firefox browsers.

How to embed a private video via Dailymotion's API?

Posted on by Julie Lambert and Nicolas Ferron

To embed a private video, you have to use a "kid" instead of a "xid". Once you've retrieved it, there are 3 ways to embed your video via our API: using the "private_id" field, the "embed_html" field or the "embed_url" field. Here's how.

Get your video "kid"

Here is an API call example which can be done when you're logged in and owner of the video: https://api.dailymotion.com/video/x123abc?fields=private_id,embed_html,embed_url

This will provide your video "kid", essential step in embedding a private video.

{
 "private_id": "k1A2b3c4d5C6d7E8f9g",
 "embed_html": "<iframe frameborder=\"0\" width=\"480\" height=\"270\" src=\"
https://www.dailymotion.com/embed/video/k1A2b3c4d5C6d7E8f9g\" allowfullscreen allow=\"autoplay\"></iframe>",
 "embed_url": "https://www.dailymotion.com/embed/video/k1A2b3c4d5C6d7E8f9g"
}


The "private_id" field


The first way to embed a private video is by using the "private_id" field (you have to be the owner of the video to use this field). Note that successive calls will generate different ids. 

  • Sample value:k1A2b3c4d5C6d7E8f9g 

If you disclose your video "kid", it won't be private anymore. 


The "embed_html" field


Another way to embed a private video is to use the "embed_html" field. It will send you the html code that you'll use to embed the video and it should adapt properly to the correct id (whether it's an "xid" or a "kid").


The "embed_url" field


Finally, you can embed your private video by using the "embed_url" field. It will provide you the URL to embed the video via our API.

Posted in Data API, Player API and Player Embed
Tagged