---
updatedAt: 2026-10-12T07:36:13.000Z
agentTools:
  projectIndex: https://developers.dailymotion.com/v0/llms.txt
---

# Create & download a report

In this guide, we’ll show you the steps to authenticate using a private API key to create and download reports via the Reporting API .

***

# 1. Generate a private API key

<Callout icon="🚧" theme="warn">
  ### Owner-level access required

  "Manage reports" section is only visible to Owners.
</Callout>

Follow the dedicated guide to easily <Anchor target="_blank" href="https://developers.dailymotion.com/v0/docs/authenticate#/get-started-with-authentication">create a private API Key</Anchor> from your Dailymotion Studio.

While creating your private API key, make sure to toggle on any permissions you may need in the “Manage reports” section:

![](https://files.readme.io/3387076be965e8ef36a25d638061783bfb9a9aae3c9ad58824b25691c181c676-image.png)

<br />

Once created, you’ll retrieve an **API key** and **API secret**. For security reasons, the API secret is only displayed once: make sure to store it safely before closing the window.

Move on to step 2 once this is done.

<br />

# 2. Authenticate

Once you have your private API key, use it to generate an access token and authenticate.

Make a `POST` request to the access token server `https://partner.api.dailymotion.com/oauth/v1/token` with the following parameters:

* `grant_type`: Set to `client_credentials` to specify the grant type flow
* `client_id`: The API key from step 1
* `client_secret`: The API secret from step 1
* `scope`: Define the specific <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/api-scopes#/">scopes</Anchor> needed. Relevant ones for the Reporting API are `create_reports` `read_reports` `access_ads`  `access_revenue` `delete_reports`

<br />

```python
#!/usr/bin/env python
import requests
 
#Declaring authentication url
auth_url = "https://partner.api.dailymotion.com/oauth/v1/token"
 
#You can use your client_id and your client_secret generated to retrieve an access token
def get_access_token(client_id, client_secret):
    '''
    Authenticate on the API in order to get an access token
    '''
    response = requests.post(auth_url,
                             data={
                                 'client_id': client_id,
                                 'client_secret': client_secret,
                                 'grant_type': 'client_credentials',
                                 'scope': 'access_ads access_revenue create_reports read_reports'
                             },
                             headers={
                                 'Content-Type': 'application/json'
                             })
 
    if response.status_code != 200 or not 'access_token' in response.json():
        raise Exception('Invalid authentication response')
 
    return response.json()['access_token']
 
 
#Calling the get_access_token function to retrieve an access token
access_token = get_access_token(<your_client_id>, <your_client_secret>)
 
 
#Creating an authorization header to use it in the report generation call request
authorization_header = {'Authorization': 'Bearer ' + access_token}
```

Use the Python script above, or try it out directly from our API reference explorer:

<Cards columns="1">
  <Card title="Authenticate: Try it out!" href="https://developers.dailymotion.com/v0/reference/client-credentials-request-access-token" icon="fa-angle-double-down">

  </Card>
</Cards>

You have now retrieved an **access token** and have been authorized to access your reporting data via the API. Move on to step 3 to see how to generate a report.

<br />

# 3. Generate a report

Now that you have your access token, you are ready to generate a report! Include the following elements in your API request:

* **Endpoint:** Make a `POST` call to `https://partner.api.dailymotion.com/graphql` for all subsequent API calls.
* **Access token:** Passed in the request header via the `authorization_header` variable.
* **Query:** Pass in the <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reporting-reference#reporting-dimensions">dimensions</Anchor>, <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reporting-reference#reporting-metrics">metrics</Anchor>, <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reporting-reference#reporting-filters">filters</Anchor>, <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reporting-reference#reporting-products">product</Anchor> and date range needed in the `create_report` function.

<br />

<Callout icon="📘" theme="info">
  ### Note

  - **Parameters are case sensitive:** Make sure to use them as they are indicated in the <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reporting-reference">Reporting API Reference</Anchor>.
  - **Metrics and dimensions aren’t all compatible with each other:** Refer to the <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/reports-compatibility-matrix">**Compatibility matrix**</Anchor> for guidance.
  - **CSV reports are generated in UTC timezone**.
</Callout>

<br />

<Cards columns="1">
  <Card title="Create a report: Try it out!" href="https://developers.dailymotion.com/v0/reference/partner-api-create-report" icon="fa-angle-double-down">

  </Card>
</Cards>

<br />

**Request example**:

```python
# Report generation endpoint
generate_report_url = 'https://partner.api.dailymotion.com/graphql'
 
# Passing report parameters to the request. You can find the full list of parameters here: https://developers.dailymotion.com/reference/reporting-reference
# And their compatibility matrix here: https://developers.dailymotion.com/v0/reference/reports-compatibility-matrix
def create_report(metrics, dimensions, start_date, end_date, product, filters):
    '''
    Creating a report request
    '''
    reportRequest = """
    mutation ($input: AskPartnerReportFileInput!) {
        askPartnerReportFile(input: $input) {
            reportFile {
                reportToken
            }
        }
    }
    """
    response = requests.post(
        generate_report_url,
        json={
            'query': reportRequest,
            'variables': {
                'input': {
                    'metrics': metrics,
                    'dimensions': dimensions,
                    'filters': filters,
                    'startDate': start_date,
                    'endDate': end_date,
                    'product': product,
                }
            }
        },
        headers=authorization_header
    )
 
    if response.status_code != 200 or not 'data' in response.json():
        raise Exception('Invalid response')
 
    return response.json()['data']['askPartnerReportFile']['reportFile']['reportToken']
 
 
# Calling the report generation function to generate a report. To see the full list of metrics, dimensions and filters, please visit this page: https://developers.dailymotion.com/reference/reporting-reference
report_token = create_report(
    ["VIEWS"],
    ["DAY", "VIDEO_TITLE"],
    "2025-07-01",
    "2025-07-04",
    "CONTENT",
    {
        "videoOwnerChannelSlug": "<your_channel_slug>"
    }
)
```

<br />

In this example, we are generating a report gathering the `VIEWS` per `DAY` and `VIDEO_TITLE` for the Dailymotion channel defined in the filter `videoOwnerChannelSlug`. This report will only show data from the channel’s uploaded `CONTENT` for the time frame `2025-07-01` to `2025-07-04`.

This request will generate a `reportToken` that will be used to access the report once ready.

<br />

# 4. Download the report

Your report is generated and available once it displays the status `FINISHED`. Note that it can take up to two hours for a report to be generated.

All you have to do now is to get the report link and download your report.

<Cards columns="1">
  <Card title="Download a report: Try it out!" href="https://developers.dailymotion.com/v0/reference/partner-api-download-report" icon="fa-angle-double-down">

  </Card>
</Cards>

You can use the above "Try it out!" feature, or the Python script below:

```python
#The report status endpoint is the same used for report creation in step 3. For simplicity the authentication step was omitted in this example
report_status_url = 'https://partner.api.dailymotion.com/graphql'
 
 
def check_report_status(report_token):
    '''
    Checking the status of the reporting request
    '''
    report_request_status_check = """
    query PartnerGetReportFile ($reportToken: String!) {
        partner {
            reportFile(reportToken: $reportToken) {
                status
                downloadLinks {
                    edges {
                        node {
                            link
                        }
                    }
                }
            }
        }
    }
    """
    response = requests.post(
         report_status_url,
        json={
            'query': report_request_status_check,
            'variables': {
                'reportToken': report_token
            }
        },
        headers= authorization_header
    )
 
    if response.status_code != 200 or not 'data' in response.json():
        raise Exception('Invalid response')
 
    status = response.json()['data']['partner']['reportFile']['status'];
 
    if (status == 'FINISHED'):
        download_links = []
        for url in map(lambda edge: edge['node']['link'], response.json()['data']['partner']['reportFile']['downloadLinks']['edges']):
            download_links.append(url)
        return download_links
    else:
        return None
 
#Getting the download url of the report when the status is equals to 'FINISHED'

report_download_url = check_report_status(report_token)
```