---
updatedAt: 2026-10-13T15:38:07.000Z
agentTools:
  projectIndex: https://developers.dailymotion.com/v0/llms.txt
---

# Launch an ad break during a live event

<Callout icon="🚀" theme="default">
  ### API v2 now available

  Visit the <Anchor target="_blank" href="https://developers.dailymotion.com/v2/reference/introduction">API v2 documentation</Anchor> or follow the <Anchor target="_blank" href="https://developers.dailymotion.com/v2/docs/migrating-from-legacy-api-to-api-v2">migration guide</Anchor> to upgrade.
</Callout>

<br />

<br />

***

<Callout icon="⭐" theme="default">
  ### Streaming live events is a plan feature

  Please reach out to your Dailymotion Account Manager or our <Anchor target="_blank" href="https://faq.dailymotion.com/hc/en-us/requests/new">Support Team</Anchor> to subscribe and set up the feature on your account.
</Callout>

<br />

# Overview

During a live event, **ad breaks can be launched with up to 24 commercials per hour.** When an ad break is triggered, all viewers will simultaneously receive mid-roll advertising in their Player, composed of one or several ads depending on the input number.

To launch an ad break, you need to <Anchor target="_blank" href="https://developers.dailymotion.com/v0/docs/authenticate">authenticate</Anchor> and request an access token with the `manage_videos` <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/api-scopes">scope</Anchor>. Then, issue a `POST` HTTP request with [`live_ad_break_launch=1`](https://developers.dailymotion.com/reference/video-fields#/live_ad_break_launch) set to the number of advertisements you want to display (only one at the time).

```curl Private key
curl --request POST \
   --header "Authorization: Bearer ${ACCESS_TOKEN}" \
   --data "live_ad_break_launch=1" \
   "https://partner.api.dailymotion.com/rest/video/<VIDEO_ID>"
```
```curl Public Key
curl --request POST \
   --header "Authorization: Bearer ${ACCESS_TOKEN}" \
   --data "live_ad_break_launch=1" \
   "https://api.dailymotion.com/video/<VIDEO_ID>"
```

<Cards columns="1">
  <Card title="Launch an ad break during a live event: Try it out!" href="https://developers.dailymotion.com/v0/reference/partner-api-edit-a-video" icon="fa-angle-double-down">

  </Card>
</Cards>

**You may also be interested in:**

* [`live_ad_break_end_time`](https://developers.dailymotion.com/reference/video-fields#/live_ad_break_end_time) – to know the estimated time of the end of the commercial break (45 sec between two commercials), and 
* [`live_ad_break_remaining`](https://developers.dailymotion.com/reference/video-fields#/live_ad_break_remaining) – to know how many ads you can send during the coming hour.

# Run recursive ad breaks using Python

<Callout icon="📘" theme="info">
  Make sure you have Python 2.7.9 or more recent version on your server.
</Callout>

Install requests:

```python
$ pip install requests
```

Install JSON:

```python
$ pip install json
```

Install crontab:

```python
$ pip install crontab
```

Add your credentials and the live video ID you want to trigger ad break on, then save the script as adbreak.py.

```python
import requests
import json
 
data = {
  'grant_type': 'client_credentials',
  'client_id': '<Your API Key>',
  'client_secret': '<Your API Secret>'
}
 
response = requests.post('https://partner.api.dailymotion.com/oauth/v1/token', data=data)
json_data = json.loads(response.text)
 
 
headers = {
    'Authorization': 'Bearer ' + json_data['access_token'],
}
 
data = {
  'live_ad_break_launch': '1'
}
 
response = requests.post('https://partner.api.dailymotion.com/rest/video/<VIDEO ID>', headers=headers, data=data)
#json_data1= json.loads(response.text)
```

Run the command line on your server to make it recursive (ie. for 15 minutes, you will need to use */15* \* \* \*):

```python
crontab */15 * * * *  /path/to/script
```