Record video calls automatically with the Daily.co API

How to configure your Daily.co calls to start recording as soon as you login

#Overview
There should be a word for that feeling when, halfway through leading a meeting that you meant to record, you realize you forgot to click the little red button. This can be especially frustrating in lots of situations:

* Webinars: customers looking forward to a recording miss out on new ways to use a product.
* Team meetings: OOO colleagues might’ve needed the context later.
* Employee training: employees onboarding to new roles lose the chance to learn from customer interactions (e.g. [video calls via Intercom](https://help.daily.co/en/articles/1908252-intercom-messenger-app)).
* Classrooms: students don’t get to hear the smart questions their peers ask during lecture.

At Daily.co, we want to make every part of a video call easier: before, during, and after. That’s why we baked an auto recording option into our API. All you have to do is [create a meeting token](https://docs.daily.co/reference#meeting-tokens) and set its `start_cloud_recording` property to `true`.

##Create the meeting token
Before you can auto record, you’ll need to sign up for our [Scale Plan](https://www.daily.co/pricing). You should be able to sign up right from your Daily.co dashboard, but if you need help or have questions please [reach out](https://www.daily.co/contact-us).

You’ll need a Daily.co room link handy. There are lots of ways to create one (you can read more about configuring rooms in our [docs](https://docs.daily.co/reference#rooms) or in [other blog posts](https://www.daily.co/blog/video-call-api-tutorial-the-rooms-family-of-endpoints.)).

I’ll run this curl command to create a private test room for our use case:

    -- CODE language-bash --
    curl --request POST \
    --url https://api.daily.co/v1/rooms \
    --header 'authorization: Bearer INSERT_YOUR_TOKEN_HERE' \
    --header 'content-type: application/json' \
    --data '{"name":"test-room","privacy":"private"}'

We’ll use the `/meeting-tokens` endpoint to set up auto recording. If you’ve ever [set up private access to a Daily.co room](https://www.daily.co/blog/intro-to-room-access-control), this might sound familiar. The Daily [meeting token object](https://docs.daily.co/reference#meeting-tokens) not only helps us manage who can access a room, but also lets us configure _how_ that person experiences the meeting once they get there. Will they join with mics on or off? Are they allowed to screen share? You can explore all the possible configuration properties [in our docs](https://docs.daily.co/reference#token-configuration).

For now, we’re most interested in the `start_cloud_recording` property. When we set this to `true`, cloud recording will automatically start when a participant joins the room.

Run the below `curl` command to create a meeting token with those two properties set to true:

    -- CODE language-bash --
    curl --request POST \
    --url https://api.daily.co/v1/meeting-tokens \
    --header 'authorization: Bearer INSERT_YOUR_TOKEN_HERE' \ 
    --header 'content-type: application/json' \
    --data '{"properties":{"start_cloud_recording":true}}'

You should see a response like this if all went as planned:

    -- CODE language-json --    
    {"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvIjp0cnVlLCJ1IjoiQWRtaW5pc3RyYXRvciIsImQiOiI4Y2I3MzhlMS02YTk1LTQ3ZjEtYTUxNy0wYTE5Y2YzMjhhNzkiLCJpYXQiOjE1ODkzMjU2MzZ9.SNC-UGVRlItIGpw-ufKgGsYRxA0d9MSuUqezNiiY9oQ"}

To quickly test that auto recording works, add the `t=INSERT_TOKEN` query parameter to your meeting link.

The link should look something like:

`https://kimberlee-daily.daily.co/test-room?t=INSERT_TOKEN_HERE`

When you paste that url into your browser, you should see a message that this meeting is set to auto record:

screenshot of ‘Click to start recording’ notification when joining Daily.co call
You should see a prompt to start recording the call as soon as you join.

After you click it, you should see a recording bar at the bottom of the call:

person points down on video call screen at recording bar
You should see "Recording in progress" noted at the bottom of your screen. Roughly where I'm pointing!

Once you’re done with the recording and the call, you can find the recording in your dashboard at `dashboard.daily.co/recordings`.


##What’s next?
Pasting tokens into your browser link is great for testing, but you’ll probably need to embed auto recording directly within your own video application. To do that, you can pass the [token as a property](https://docs.daily.co/reference#properties) to any of the Daily.co [factory methods](https://docs.daily.co/reference#factory-methods), or to the `.join()` method. If you’re using [`createFrame()`](https://docs.daily.co/reference#%EF%B8%8F-createframe) for example, this might look something like:

    -- CODE language-js --
    callFrame = window.DailyIframe.createFrame({
      url: 'YOUR_URL_HERE' 
      token: 'YOUR_TOKEN_HERE'
    });

To learn about generating your own tokens and meeting rooms dynamically on the server, [see this blog post](https://www.daily.co/blog/deploy-a-daily-co-backend-node-js-server-instantly).

And there you have it! Now you won’t have to worry about forgetting to record meetings you’ll need to share later.

To dive deeper into our `/meeting-tokens` endpoint, have a look at Phil’s blog post on [introducing room access control](https://www.daily.co/blog/intro-to-room-access-control). Or, to try out other Scale Plan features, [experiment with live streaming](https://www.daily.co/blog/an-introduction-to-live-streaming-with-daily-co). And, as always, please [let us know of any feedback or feature requests](https://www.daily.co/contact-us).

Recent posts