Tile API access and chart tokens

A chart in a DataPrism report can deliver its data to another system through an export endpoint. The chart's API access dialog gives you the export URL, ready-made request samples, and the chart tokens that let a partner system or a scheduled job pull that one chart. For a report's own exports to PowerPoint or PDF, and for chart file downloads, see Export reports and data.

Open the API access dialog

  1. Open the report and find the chart another system should read.
  2. On a chart tile, open Export and choose API access. On a table or matrix, the tile toolbar offers the same entry.
  3. The dialog shows the chart's Endpoint and, below it, its Chart tokens.

The entry appears only on tiles bound to data, and it needs Export DataPrism Report Data; without that permission it is not offered. The dialog builds its URL and samples from the chart as last saved, so save the report before you copy anything.

Authenticate the request

The Endpoint section shows the chart's export URL and the two ways to authenticate:

TokenWhat it is forWhere it comes from
Personal access token"Acts as you, with your row-level security."API tokens in your account menu, with the dataprism:export scope. See API tokens.
Chart token"Only this chart, for a partner system or a scheduled job. Its access is fixed when it is made - manage them below."The Chart tokens section of this dialog.

Send the token in an Authorization: Bearer header. On the plain download URL only, ?access_token= works as well; a filtered request must use the header.

Read the API guide

API guide opens ready-made requests for this chart, built from the chart as last saved.

  1. Pick a tab. Sync covers the plain download and filtered requests; Async covers exports that run off the request as a job.
  2. Pick a Language. Sync offers curl, Python, JavaScript, C#, Excel (Power Query) and Google Sheets. Async offers the script languages only: curl, Python, JavaScript and C#. If the language you picked is not offered on the tab you switch to, the guide returns to curl.

Both tabs have a Whole chart sample and a With filters sample. Every code block has a copy button, and each candidate list (the report's filters, the chart's columns, the chart's values) has a Copy entry button. The filter samples are shown for curl, Python, JavaScript and C# only, because filters need the token in the header.

The samples carry two notes:

Create a chart token

The Chart tokens section describes the token: "A chart token exports only this chart, for whoever holds it - a partner system, a scheduled job. Its access is fixed when it is made and lasts until it is revoked or expires."

  1. Under New chart token, set a Label (up to 200 characters, such as Partner ETL).
  2. Choose when the token stops under Expires after: 1 day, 7 days, 30 days, 60 days, 90 days or Never. The default is 30 days.
  3. Pick the rows it may read under Rows the token returns, then click Create chart token.
  4. In the Chart token created notice, click Copy token and store the token safely. This is the only time it is shown.

Rows the token returns appears when the model has row-level security. Pick one RLS group (RLS group: {name}) or All data (no row-level security); the picker reads Pick an RLS group until you choose, and Create chart token stays off until a scope is picked.

Warning

"An All data token returns every row of this chart to whoever holds it, regardless of row-level security." Make one only for a system that may see every row.

The scope is checked when the token is made and never again: a token keeps working as it was created, even if its creator later loses access to the chart, until someone revokes it or it expires. Creating a token needs Manage DataPrism API Tokens and Export DataPrism Report Data, and the report's administer level: you own the report, can edit it in its role workspace, or are an administrator. See Who can do what in DataPrism. If tokens are not available on the chart, the dialog says why in place of the form.

Manage chart tokens

The Chart tokens section lists the tokens of this chart. Each row shows the token's label (Untitled token when it has none), the rows it returns, who created it, and its use count as {n} use or {n} uses. The scope in each row reads All data, RLS group with the group's name, RLS group (removed) when that group is gone, or No row-level security.

What the export API does

Limits and status codes

LimitDirect downloadAsync export
Rowsup to 1,000,000for results over 1,000,000 rows or slow queries
Query timeup to 600 secondsup to 3,600 seconds
Outputstreamed as the query runsup to 5 GB
At a time2 downloads per caller5 jobs queued or running per caller
The filedownloads as it streamskept for 24 hours after the job finishes

The API guide lists these responses on its tabs:

CodeWhereWhat it means
200Download"The file, streamed as the query runs."
200Job"The job status (polling) or the file (download)."
202Job"Queued. The job is in the body and its URL in the Location header."
204Download"Row-level security returns no rows for this token. No body."
206Job"Part of the file, for a Range request."
400Both"An unknown format, an invalid filter, or a body field the API export refuses."
401Both"The token is missing, unknown, revoked or expired."
403Both"The token is valid but not allowed to export this chart."
404Both"No such chart, or a chart token made for another chart."
409Job"The file was asked for before the job succeeded."
410Job"The file expired, 24 hours after the job finished."
413Download"More than 1,000,000 rows. Nothing is sent - use Async."
416Job"The Range cannot be satisfied."
429Download"This caller already runs 2 direct downloads. Retry after the Retry-After seconds."
429Job"This caller already has 5 jobs queued or running."
503Download"The export service is busy. Retry after the Retry-After seconds."
503Job"Asynchronous exports are not configured on this deployment."

Questions, answered

Where do I find API access for a chart?

On a chart tile, open Export and choose API access; on a table or matrix, the tile toolbar offers the same entry. It appears only on tiles bound to data and needs Export DataPrism Report Data. The dialog holds the chart's Endpoint and its Chart tokens.

Why does the API guide show an older version of my chart?

The guide builds its URL and samples from the chart as last saved, not from edits you have not saved yet. Save the report, then reopen the guide. See Save a report, resolve conflicts and restore versions.

Which languages does the API guide offer?

Sync offers curl, Python, JavaScript, C#, Excel (Power Query) and Google Sheets. Async offers the script languages only: curl, Python, JavaScript and C#. If the language you picked is not offered on the tab you switch to, the guide returns to curl.

Can I put the token in the URL?

Only on the plain download URL: there ?access_token= works. Everywhere else, and for any filtered request, send Authorization: Bearer. The guide notes that access_token is not read on POST.

Why does my filtered request answer 400?

The body holds something the export refuses. Check that every value in angle brackets is replaced, that format is csv, json or parquet, and that no refused field is present: viewAsEmail, viewAsUserId, inlineFilters, compareScopes, sort. A filter that names a column the chart does not use, or a value filter that names something outside the saved chart, is refused too.

Why did my request answer 204?

It is not a failure. 204 means "Row-level security returns no rows for this token. No body." The token's group matches no rows, so there is nothing to send. Check which group the token is limited to; see Row-level security and View as.

Why was my token refused?

Three answers cover most cases. 401: "The token is missing, unknown, revoked or expired." Send the token in the Authorization header, or make a new one. 403: "The token is valid but not allowed to export this chart." Use a token that may export this chart. 404: "No such chart, or a chart token made for another chart." Use a chart token on the chart it was made for. More token messages are on Troubleshooting.

Can I see a chart token again after I close the notice?

No. Copy token appears in the Chart token created notice at creation only. If the token was not stored, revoke it and create a new one.

What does "RLS group (removed)" mean in the token list?

The RLS group the token was limited to is gone from the model. The token still works as it was made, because its scope was checked when it was created; revoke it if the access should stop.

Who can see and revoke a chart's tokens?

Listing and revoking need the report's administer level: you own the report, can edit it in its role workspace, or are an administrator. Anyone at that level sees every token in the list and can revoke one. Creating tokens needs Manage DataPrism API Tokens and Export DataPrism Report Data on top. See Who can do what in DataPrism.