Skip to main content

Sharing Integration Guide

This guide covers the 3 sharing flows available in the API:

  1. Public link (no external authentication).
  2. Email sharing (one-time code authentication).
  3. Embed (stateless token for iframe).

Endpoint Overview

FlowMain endpoints
Public linkGET /api/v1/public/shares/:token/resolve, POST /api/v1/public/shares/:token/execute
Email (share portal)POST /api/v1/share-auth/request, POST /api/v1/share-auth/verify, GET /api/v1/share-portal/...
EmbedPOST /api/v1/embed/dashboards/:id, GET/POST /api/embed/d/:token/...
Dynamic filter optionsGET .../filters/:filter_slug/options (public, portal, and embed)

Use this when anyone with the link can access it.

1) Create a share without share_context_id

curl -X POST "$API_BASE_URL/api/v1/dashboards/DASHBOARD_ID/shares" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Public link - sales",
"share_type": "link"
}'

2) Resolve token

curl "$API_BASE_URL/api/v1/public/shares/SHARE_TOKEN/resolve"

3) Execute shared dashboard

curl -X POST "$API_BASE_URL/api/v1/public/shares/SHARE_TOKEN/execute" \
-H "Content-Type: application/json" \
-d '{
"parameters": {
"period_start": "2025-01-01",
"period_end": "2025-12-31"
}
}'

Flow 2: Email Sharing

Use this when only approved emails can access the dashboard.

1) Create a share context

curl -X POST "$API_BASE_URL/api/v1/share-contexts" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "External customers",
"description": "External customer access"
}'

2) Add an external email member

curl -X POST "$API_BASE_URL/api/v1/share-contexts/CONTEXT_ID/members" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"member_type": "external_email",
"email": "customer@company.com"
}'

3) Create a share bound to this context

curl -X POST "$API_BASE_URL/api/v1/dashboards/DASHBOARD_ID/shares" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer portal",
"share_type": "link",
"share_context_id": "CONTEXT_ID",
"share_filter_policies": [
{
"filter_slug": "status",
"filter_kind": "multi_select",
"mode": "selectable",
"allowed_values": ["Active", "Pending"]
}
]
}'

4) External user authenticates with code

Request code:

curl -X POST "$API_BASE_URL/api/v1/share-auth/request" \
-H "Content-Type: application/json" \
-d '{
"company_slug": "acme",
"email": "customer@company.com"
}'

Verify code and get tokens:

curl -X POST "$API_BASE_URL/api/v1/share-auth/verify" \
-H "Content-Type: application/json" \
-d '{
"company_slug": "acme",
"email": "customer@company.com",
"code": "1234-5678"
}'

5) Use share portal with share_access

List dashboards for company/contexts:

curl "$API_BASE_URL/api/v1/share-portal/acme/dashboards" \
-H "Authorization: Bearer SHARE_ACCESS_TOKEN"

Execute dashboard:

curl -X POST "$API_BASE_URL/api/v1/share-portal/acme/dashboards/DASHBOARD_SLUG/execute" \
-H "Authorization: Bearer SHARE_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"context_id": "CONTEXT_ID",
"parameters": {
"status": ["Active"]
}
}'

Flow 3: Embed

Use this when the dashboard will be rendered in an iframe.

1) Generate token/embed URL

curl -X POST "$API_BASE_URL/api/v1/embed/dashboards/DASHBOARD_ID" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"allowed_params": ["period_start", "period_end"],
"required_params": ["period_start", "period_end"],
"expires_in": 3600
}'

2) Consume public embed endpoints

  • GET /api/embed/d/:token/info
  • POST /api/embed/d/:token/execute
  • GET /api/embed/d/:token/filters/:filter_slug/options

Dynamic Filters (select / multi_select)

When a filter is dynamic (SQL-backed), the frontend must call the options endpoint for the current mode:

  • Public link: GET /api/v1/public/shares/:token/filters/:filter_slug/options
  • Email portal: GET /api/v1/share-portal/.../filters/:filter_slug/options?context_id=...
  • Embed: GET /api/embed/d/:token/filters/:filter_slug/options

Supported optional query parameter:

  • search: value used by the dynamic filter SQL.

Standard response:

{
"filter_slug": "status",
"options": [
{ "label": "Active", "value": "Active" },
{ "label": "Pending", "value": "Pending" }
],
"source": "dynamic"
}

source can be:

  • static: static filter options.
  • dynamic: options loaded from filter SQL.
  • policy: options restricted by share_filter_policies.

Common Errors

HTTPerror_codeTypical cause
401AUTH_REQUIREDShare requires external authentication
401TOKEN_INVALIDInvalid/expired token
400INVALID_CONTEXT_IDInvalid context_id in portal mode
403FILTER_DISABLED_BY_POLICYFilter blocked by share policy
400DB_QUERY_ERRORDynamic filter SQL execution failed
400SHARE_FILTER_POLICY_VIOLATIONParameters violate share rules

Next Steps