Skip to Content

Data Retrieval

Download a dashboard as PDF

Render an embedded dashboard for one customer as a PDF file.

POST
/api/v2/data-app/getDashboardPdf
curl --request POST https://api.usedatabrain.com/api/v2/data-app/getDashboardPdf \  --header "Authorization: Bearer $DATABRAIN_API_TOKEN" \  --header "Content-Type: application/json" \  --data '{    "dataAppId": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f",    "embedId": "sales-overview",    "dashboardId": "sales-overview",    "clientId": "acme",    "pageSetup": { "orientation": "landscape" }  }' \  --output sales-overview.pdf

Auth

A data app API token, or a service token. With a service token, dataAppId picks the data app. See Authentication.

Authorization

ApiToken
headerAuthorizationBearer <token>

A service token or a data app API token.

Body

dataAppIdstring

The data app id. Required when you use a service token. With a data app API token you can leave it out, and Databrain uses the token's data app. If you send it, it must be that token's data app.

embedIdstringrequired

The embed id. You must send it, but Databrain does not use it to find the dashboard. dashboardId does that.

dashboardIdstringrequired

The embed's dashboard id. This picks the dashboard.

clientIdstringrequired

The tenant whose data is shown.

Multi-datasource workspaces: the datasource. Databrain checks that the name exists and reads the tenancy from it. Each metric still runs on its own datasource.

Multi-datamart workspaces: the datamart. Databrain checks that the name exists and reads the tenancy from it. Each metric still runs on its own datasource.

pageSetupobject

Page size and table limits of the PDF.

5 fields in pageSetup

One of landscape, portrait. Page orientation.

densitystring

One of auto, one-up, two-up. Charts per row.

tableModestring

One of paginate, all. Split long tables over pages, or show all rows.

Rows per table. An integer, 0 or more.

Range: 0 to

Most rows in the whole file. An integer, 1 or more.

Range: 1 to

Response

The PDF file, with Content-Type: application/pdf, as an attachment.

The call waits until the file is ready. There is no job id and nothing to poll. A large dashboard can take some time, so set a long client timeout.

Errors

Statuserror.codeWhy
400INVALID_REQUEST_BODYA field is missing or wrong
400INVALID_DASHBOARD_IDNo embed of the data app has this dashboard
400DATASOURCE_NAME_ERROR or DATAMART_NAME_ERRORThe name is unknown
403DATA_APP_ID_ERRORdataAppId is not the data app of your API token
403INVALID_REQUEST_BODYDatabrain refused to render the dashboard for this tenant, for example the dashboard or the workspace is out of scope, or no client can be found. The message tells you why. Do not retry without a change
404DATA_APP_NOT_FOUNDNo data app in your organization has this id
500INTERNAL_SERVER_ERRORThe PDF could not be made, for example dataAppId is not a UUID

For errors that every endpoint returns, see Authentication.

Example Request
curl -X POST 'https://api.usedatabrain.com/api/v2/data-app/getDashboardPdf' \  -H 'Content-Type: application/json' \  -d '{  "dataAppId": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f",  "embedId": "sales-overview",  "dashboardId": "sales-overview",  "clientId": "acme",  "pageSetup": {    "orientation": "landscape"  }}'
Example Response
"<binary PDF>"