Live stream recording API: choose which broadcasts are recorded and download the files
How your code sets the recording choice when it creates a broadcast card through the DCAST API, and how a ready recording is offered as an MP4 file.

On this page
If you build your own site on top of DCAST, you may want your code to decide which live broadcasts are kept as files, instead of someone ticking a box in a dashboard. When your code creates a broadcast through the DCAST API, it chooses whether the broadcast is recorded, and a ready recording file downloads as an MP4 named after your broadcast. This article keeps the two halves apart on purpose: first the recording choice on the call that creates a broadcast, then the download of a ready recording for restreams, rooms and bridges. You will see what happens when you omit the choice, how the file is named and how to keep your records in order.
Upload, stream and sell your videos. Start on the free plan — no card needed.
Get Started FreeDecide which broadcasts need a recording
Not every event deserves a file. A weekly town hall, a workshop or a product launch is something you may want to replay, share with people who missed it or keep for your records. A rehearsal, a camera test or a casual check-in is usually not worth keeping. Before you write any code, list the kinds of events your site creates and mark each kind as recorded or not recorded.
Then let your code apply that rule automatically. The recording choice is a field of the request that creates a broadcast card through the streams call of the partner API, so there is no later moment where someone forgets to switch it on or off. When you create a broadcast card with recording switched off, it is stored with recording off, so the decision you made in code is the decision that is kept.
Send the recording choice as a real true or false
On the streams create call the recording choice is strict. It accepts only a true or false value. If your request carries a word such as no, or a number such as zero, the request is refused and no broadcast is created. That strictness protects you from a quiet mistake: a form field that arrives as text could otherwise be misread and give you the opposite of what you meant.
The practical rule is to send a real boolean from your code, not text copied from a form. If your site collects the choice from an organiser through a checkbox or a dropdown, convert it to a true or false value on your server before you build the request to DCAST.
A refused request is also a useful failure check. If a broadcast you expected is missing, look at the answer to your create call first. A refusal about the recording choice means nothing was created, so there is no half-made broadcast for you to clean up. Fix the value, send the request again and confirm that the answer now describes a new broadcast.
What happens when you leave the choice out
If you omit the recording choice when you create a broadcast card through the streams call, the card keeps its default setting, and that default is recording on. A null value counts as not sending the choice at all, so it also leaves the default in place. Only a real boolean is applied; anything else keeps the default or, as shown above, is refused.
This matters for your design. If most of your events should be recorded, you can rely on the default, but relying on it silently makes your intent hard to read for the next developer. If some events must never be kept, for example a private consultation, set the choice to false explicitly every time. A good habit is to send the choice on every streams create call, even when you want recording on, so your code documents itself.
Find and download the ready recording
Once a recording is ready, you fetch it through the same API. For a restream, a room or a bridge, the recording is offered as one file in a single quality, the original source of the broadcast. Your code can first ask for the recording qualities of the item, with the qualities call for restreams, rooms or bridges, and then ask for the recording download of the same item with the matching download call.
The qualities answer lists exactly one entry. That quality is marked as ready, and it shows the size of the file in bytes whenever the size is known. Read that size before you download, because it tells you how much space your server needs and lets you show a progress indicator to your team. When the size is not known, expect an empty value there instead of a number.
For a bridge, the same calls apply, but your API key must also carry the permission to read bridges. If a bridge call is refused while the same key works for a room, check the key's permissions before you suspect the recording.
Keep the two halves of this article separate in your own design. The recording choice described earlier belongs to the streams create call, while the single original file described here is what a ready recording of a restream, a room or a bridge looks like. This article does not describe how the download for a broadcast card created through the streams call is put together, so test the qualities and download answers on one of your own cards before you build a workflow around them. Treat a missing file as a state your code handles, not as a crash, and pause between attempts instead of repeating the call in a tight loop.
A ready recording is located in the recording storage, and a local disk path on a server is not accepted as its location. For you this means the download comes from DCAST's storage, so do not plan around reading files from a server disk.
How the downloaded file is named
The name of the downloaded file comes from the title of the broadcast and ends with the MP4 extension. Path separators and quotation marks in the title are left out of the file name, so a title with a slash in it still produces a clean name that your operating system accepts.
When the broadcast has no title, the file name is made of the word recording and the identifier of its source. That is a good reason to give every broadcast a clear title when your code creates it: a descriptive title gives you a file you can recognise, while an untitled one gives you a name that only makes sense with a lookup table.
Keep your records tidy after the event
Downloading the file is only half of the job. Store the file name you receive next to your own record of the event, so your team finds the right recording later. A simple table in your database with the event, its date, the broadcast title, the recording choice you sent and the downloaded file name is enough.
When someone asks whether a webinar was recorded, you can answer from your own data instead of searching folders. If a recording is missing, compare the recording choice you stored with the event: a false value explains the gap immediately, while a true value tells you to look at the download side instead.
Protect your API key
Everything above runs with your API key. Keep your API key on your server and never place it in a page that your visitors load. If your site lets organisers pick the recording choice, let the browser send only that choice to your own server, and let your server call DCAST. That also gives you one place to validate the value, convert it to a real boolean and write the event record described above.
A short checklist before you go live helps. Check that the streams create call sends a boolean, that the title is filled in, that the qualities answer is read before any download of a restream, room or bridge recording, and that the file name is saved with the event. If all four hold, your team can tell what you chose to record and find each file you downloaded.
Free tools for this topic
API documentation for this topic
dcast Team
Professional video streaming experts helping creators succeed.
Related Articles
Start Your Video Business Today
Upload, stream and sell your videos. Start on the free plan — no card needed.
Get Started Free



