[role="xpack"]
[[automating-report-generation]]
== Automatically generate reports

To automatically generate PDF and CSV reports, generate a POST URL, then submit the HTTP `POST` request using {watcher} or a script.

[float]
[[create-a-post-url]]
=== Create a POST URL

Create the POST URL that triggers a report to generate PDF and CSV reports.

To create the POST URL for PDF reports:

. Open the main menu, then click *Dashboard*, *Visualize Library*, or *Canvas*.

. Open the dashboard, visualization, or **Canvas** workpad you want to view as a report.

. From the toolbar, click *Share > PDF Reports*, then choose an option:

* If you are using *Dashboard* or *Visulize Library*, click *Copy POST URL*.

* If you are using *Canvas*, click *Advanced options > Copy POST URL*.

To create the POST URL for CSV reports:

. Open the main menu, then click *Discover*.

. Open the saved search you want to share.

. In the toolbar, click *Share > CSV Reports > Copy POST URL*.

[float]
[[use-watcher]]
=== Use Watcher

include::watch-example.asciidoc[]

[float]
[[use-a-script]]
=== Use a script

include::script-example.asciidoc[]

[float]
[[reporting-response-codes]]
=== HTTP response codes

include::response-codes.asciidoc[]

[float]
[[deprecated-report-urls]]
=== Deprecated report URLs

If you experience issues with the deprecated report URLs after you upgrade {kib}, regenerate the POST URL for your reports.

* *Dashboard* reports:  `/api/reporting/generate/dashboard/<dashboard-id>`
* *Visualize Library* reports:  `/api/reporting/generate/visualization/<visualization-id>`
* *Discover* saved search reports: `/api/reporting/generate/search/<saved-search-id>`

IMPORTANT:
In earlier {kib} versions, you could use the `&sync` parameter to append to report URLs that held the request open until the document was fully generated. The `&sync` parameter is now unsupported. If you use the `&sync` parameter in Watcher, you must update the parameter.
