To run a query, send a [`queries.run`](https://developers.google.com/bid-manager/reference/rest/current/queries/run) request with the
[`queryId`](https://developers.google.com/bid-manager/reference/rest/current/queries#Query.FIELDS.query_id) and execution details. This request returns a
running [`Report`](https://developers.google.com/bid-manager/reference/rest/current/queries.reports#Report) resource.

> [!TIP]
> **Tip:** Schedule [`Query`](https://developers.google.com/bid-manager/reference/rest/current/queries#Query) resources to run automatically using the [`schedule`](https://developers.google.com/bid-manager/reference/rest/current/queries#Query.FIELDS.schedule) field during creation. Retrieve reports generated by scheduled queries using [`queries.reports.list`](https://developers.google.com/bid-manager/reference/rest/current/queries/list).

Here's how to run a query and retrieve the resulting report resource ID:

### Java

```java
// ID of query to run.
Long queryId = query-id;

// Run the query.
Report report = service.queries().run(queryId, null).execute();

// Print the running report ID.
System.out.printf(
    "Report %s generated and running.%n",
    report.getKey().getReportId());
```

### Python

```python
# The ID of the existing query.
query_id = query-id

# Run the query.
running_report = (
  service.queries().run(queryId=query_id).execute()
)

# Print running report ID.
print(f'Report {running_report["key"]["reportId"]} generated and running.')
```

### PHP

```php
// ID of the query to run.
$queryId = query-id;

// Run the query.
$report = $this->service->queries->run(
    $queryId,
    new Google_Service_DoubleClickBidManager_RunQueryRequest(),
    array());

// Print the running report ID
printf(
    'Report %s generated and running.<br>',
    $report->getKey()->getReportId());
```