Skip to main content
The reports system allows users to save filter configurations as presets, create reusable templates, and generate public share links for reports.

Report presets

Presets store named filter and state snapshots for a specific report. They are scoped to the tenant and associated with the user who created them.

List presets

GET /api/reports/presets
string
Returns all presets for the authenticated user’s active tenant, filtered by report key.

Query parameters

reportKey
string
required
Identifier for the report type (e.g. obras, certificados).

Response

presets
ReportPreset[]
required
Array of preset objects ordered by updated_at descending.
curl 'https://<domain>/api/reports/presets?reportKey=obras' \
  --cookie 'sb-access-token=<session>'

Create a preset

POST /api/reports/presets
string
Creates a new saved preset for the authenticated user.

Request body

reportKey
string
required
Report type identifier.
name
string
required
Display name for the preset.
filters
object
Filter configuration to save. Defaults to {}.
reportState
object
Report UI state to save. Defaults to {}.

Response

preset
ReportPreset
required
The newly created preset.
curl -X POST 'https://<domain>/api/reports/presets' \
  --cookie 'sb-access-token=<session>' \
  --header 'Content-Type: application/json' \
  --data '{
    "reportKey": "obras",
    "name": "Obras en curso — MUNICIPIO",
    "filters": { "status": "in-process", "entidad": ["MUNICIPIO"] },
    "reportState": {}
  }'

Delete a preset

DELETE /api/reports/presets
string
Deletes a preset by ID. The preset must belong to the authenticated user’s active tenant.

Query parameters

id
string
required
UUID of the preset to delete.

Response

ok
boolean
required
Always true on success.

Report templates

Templates are reusable report configurations. Unlike presets (which are personal), templates belong to the tenant.

List templates

GET /api/reports/templates
string
Returns all templates for the authenticated user’s active tenant, filtered by report key.

Query parameters

reportKey
string
required
Report type identifier.

Response

templates
ReportTemplate[]
required
Array of template objects ordered by updated_at descending.

Create a template

POST /api/reports/templates
string
Creates a new report template for the tenant.

Request body

reportKey
string
required
Report type identifier.
name
string
required
Display name.
description
string
Optional description.
payload
object
Template configuration. Defaults to {}.
isSystem
boolean
Mark as a system template. Defaults to false.

Response

template
ReportTemplate
required
The newly created template.

Delete a template

DELETE /api/reports/templates
string
Deletes a template by ID.

Query parameters

id
string
required
UUID of the template to delete.

Response

ok
boolean
required
Always true on success.

Share links let authenticated users create token-based public URLs for a specific report state. The token can be used without authentication to retrieve the report payload.
POST /api/reports/share
string
Creates a share link for a report. Returns the share record and the relative URL path (/r/{token}).

Request body

reportKey
string
required
Report type identifier.
payload
object
required
The report state/data to embed in the share link.
presetId
string
Optional UUID of an associated preset.
expiresAt
string
Optional ISO 8601 expiry timestamp. If omitted the link never expires.

Response

share
object
required
The full share link record from the database.
url
string
required
Relative URL path for the share link, e.g. /r/abc123.
curl -X POST 'https://<domain>/api/reports/share' \
  --cookie 'sb-access-token=<session>' \
  --header 'Content-Type: application/json' \
  --data '{
    "reportKey": "obras",
    "payload": { "filters": { "status": "completed" } },
    "expiresAt": "2025-12-31T23:59:59Z"
  }'

GET /api/reports/share
string
Resolves a share link by token. This endpoint does not require authentication — it is intended for public consumers of shared reports.
If the share link has an expires_at in the past, the endpoint returns 410 Gone.

Query parameters

token
string
required
The share token (from the url returned when the link was created).

Response

share
object
required
The full share link record, including the embedded payload.
curl 'https://<domain>/api/reports/share?token=abc123def456'

Build docs developers (and LLMs) love