Aller au contenu principal

Create Share

POST 

/v1/viz/:viz_id/shares

Create a named share: a link for a viewer WITHOUT an account that lasts until you revoke it.

The link is {app}/s/{linkId}. It carries an opaque 256-bit id and nothing else: no token, no filter, no slug. Opening it exchanges the id for a short-lived embed token (480s, renewed while the page is open) carrying exactly this share's filters, and the page renders as a protected link does. So the link outlives every token, and taking it back is one call: POST /v1/viz/\{viz_id\}/shares/\{share_id\}/revoke, which stops this link alone.

The URL is shown once, in this response. Only its hash is stored; a lost link is replaced by creating a new share and revoking the old one.

expiresInDays (1 to 365) sets an expiry; omit it for a link that works until revoked. filters is a row scope, the same shape as POST /v1/embed/token's, applied server-side to every query the page runs; scope.fullyScoped says whether every dataset of the viz is reached by it. A dataset the filters do not reach would be read WHOLE, so that is refused unless allowPartialScope is true; a share with no filters shares the whole dashboard and needs no flag. The scope agreed here is kept on the share: if the dashboard later moves outside it — a filtered dataset loses its filter column, a dataset is read whole that was not, a dataset under row rules is added — the link stops (404) until a new share is made.

What anyone holding the link can do is what the dashboard reads, within the scope, and more than the tiles show: the token the page holds works on POST /v1/embed/viz/query and /batch, which run any read-only SELECT over the dashboard's datasets, every column, inside the scope. They can read the dashboard's name, description and slug and the scope itself, and the token is a readable JWT naming the account id, the API key id, the viz id and the share id. viewerCanRead in the response says the same. Put nothing in the name or description you would not show them.

Preconditions are the mint's, checked now so a share that could never open is refused rather than stored: the viz is published and protected (share_viz(viz_id, audience='protected', mint_token=False) sets that), and the tokens bind to a usable API key: an API-key caller binds to the key it presents and no other; a session names apiKeyId, which must be a key the caller created unless they are an account admin. When a dataset of the viz is under row rules and the caller is restricted on it, the key's row group must lie within the caller's own access: a share never reads wider than the person who made it. A key whose allowedDomains exclude the app's host is refused, since the link could never open.

Revoking is final. Disabling the key, or making the viz private or unpublished, only pauses the link: undo either and it opens again. Removing a member deletes their API keys, so their shares stop for good.

Refusals:

  • 404 viz_not_found — no such viz, or you may not edit it;
  • 403 share_requires_console — an API key, and the account has not turned on apiKeysMayPublish: a durable outward link is the same kind of act as making a dashboard public;
  • 403 share_requires_a_person — the in-app assistant or an unattended principal;
  • 403 share_api_key_not_yours — the key is not one this caller may bind;
  • 403 share_wider_than_creator — the key's row group reaches further than the caller's own access;
  • 403 share_scope_partial — the filters leave a dataset read whole and allowPartialScope is not true, or a dataset's columns could not be read;
  • 403 share_key_domains_exclude_the_app — the key's allowedDomains exclude the app's host;
  • every refusal of POST /v1/embed/token (embed_mint_requires_api_key, embed_api_key_not_usable, embed_viz_not_published, embed_viz_not_protected, embed_mint_filter_invalid, …).

Request​

Responses​

Successful Response