Introducing a new way to review your PRs.

Read the announcement

getredash / redash

Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.

View on GitHub

20 documents · Updated Nov 11, 2026

docs / backend-http-api

Backend HTTP API and request handlers

The backend HTTP API is the request boundary between the browser, external clients, and Redash services. It resolves the organization and user for each request, checks access, changes or reads product data, and returns JSON, files, or the web application shell. The API supports query work, dashboards, data sources, administration, identity, embeds, audit events, and application delivery.

Request boundary

Application entry and route groups

The Flask application creates the web server and registers two route groups. A Flask blueprint serves direct web routes and a Flask-RESTful API maps resource classes to JSON endpoints. The application also applies security, authentication, rate limits, database access, and task support before it exposes these handlers. See Application runtime and service composition for the wider service lifecycle.

Most product API paths use the /api prefix. In multi-organization mode, organization-scoped paths also include an organization slug. The API registration is the central map from a public path to the handler that owns its behavior.

References: redash/app.py• L25-57 redash/…/__init__.py• L25-37 redash/…/api.py• L100-116

Organization and user context

Each request runs in an organization context called current_org. The context comes from the organization slug in the path when one is present, or from the default organization rules when it is not. Handlers use this context when they load records so that a request does not cross organization boundaries.

Most resource handlers require a logged-in user through the shared resource base. The same boundary supports normal browser sessions and API users. API users carry an object or query key and receive a narrower identity view than an interactive user. The shared resource boundary removes the organization path value before it calls a resource, so resource methods receive only their product arguments.

References: redash/…/base.py• L21-39 redash/…/base.py• L103-107 redash/…/org_resolving.py• L9-24 redash/…/authentication.py• L323-345

Access and response rules

Handlers combine broad permissions with object access. Broad permissions control actions such as listing users or creating queries. Object access controls a specific query, dashboard, or data source through ownership, groups, and view or modify levels. The result is that a user can be allowed to use a feature while still being denied access to a particular object.

Successful resource responses are normally JSON. List endpoints use a shared page shape with count, page, page_size, and results. Query result endpoints also return files or an asynchronous job description when the result is not ready. Handlers record user, API, object, and request details as events for actions that matter to administration and audit.

References: redash/permissions.py• L17-21 redash/permissions.py• L34-49 redash/…/base.py• L80-100 redash/…/base.py• L41-61

Query and data access

Query lifecycle

The query API lets users find, create, read, edit, archive, fork, refresh, and tag saved queries. A saved query links query text to a data source and can include parameters, a schedule, visualizations, and a public access key. Query search and list views return only records that the current user can see.

When a client creates or edits a saved query, the handler checks access to its data source and to any query-backed dropdown parameters. When a client refreshes a saved query, the handler also requires modify-level access and starts query work. The response describes the job rather than waiting for the data in the HTTP request. See Querying and data source integration for the full query lifecycle.

The query surface also provides SQL formatting for editor workflows. If SQL is too large or deeply nested for safe formatting, the endpoint returns a 400 client error instead of a server error.

Saved-query edits use a version value to detect concurrent changes. API users cannot use the normal saved-query refresh path, and query reads hide the query's long-lived API key from them. These rules keep query execution and key exposure aligned with the caller's trust level.

References: redash/…/api.py• L200-215 redash/…/queries.py• L55-72 redash/…/queries.py• L111-166 redash/…/queries.py• L186-249 redash/…/queries.py• L314-473

Query result delivery

The query result API accepts ad hoc or saved query requests. It can return a recent cached result or enqueue new work. A separate job endpoint lets the client inspect or cancel work that is still running.

Execution checks data source access, applies query parameters, and rejects missing or unsafe values. A saved query can run with view-only access only when its parameter form is safe for shared use. Otherwise the caller needs permission to execute queries with the data source. Once a result exists, clients can request it by query or result identifier.

The result boundary can return JSON, CSV, TSV, or Excel content. It also supports controlled cross-origin access for result consumers and uses API-key access rules for public or machine clients. A caller must be ready to handle both a result and a job response. Results built from the query-results data source also require access to each referenced source query and data source.

References: redash/…/query_results.py• L45-119 redash/…/query_results.py• L147-194 redash/…/query_results.py• L224-398 redash/…/query_results.py• L400-435

Data source administration

The data source API gives administrators a catalog of supported connector types and lets them create, inspect, edit, pause, resume, test, and remove data sources. Group access determines which users can use a source and whether they can only view it or also run changes against it. See Querying and data source integration for how these sources participate in query execution.

Schema requests use the same HTTP boundary but may start background work. A cached schema can be returned at once. A refresh request or a missing schema returns a job description instead. Databricks adds the same cached-or-job pattern for database, table, and column discovery. Its cache is tied to the data source configuration and is cleared when an administrator changes that configuration.

References: redash/…/api.py• L147-161 redash/…/data_sources.py• L31-98 redash/…/data_sources.py• L101-189 redash/…/data_sources.py• L192-251 redash/…/databricks.py• L20-54 redash/…/databricks.py• L66-106

Dashboard and presentation API

Dashboard resources

The dashboard API manages a saved presentation made from a layout and widgets. It supports listing and searching accessible dashboards, creating and editing them, archiving them, forking them, and managing tags and favorites. A dashboard response can include its widgets and the visualizations that those widgets show. See Dashboards and visualizations for the product model behind these surfaces.

Dashboard edits use ownership or object modify access. The dashboard version helps the client detect an edit made by another user instead of silently overwriting it. Forking also checks access to the data behind each visualization so the new dashboard does not bypass query access.

References: redash/…/api.py• L134-145 redash/…/api.py• L184-210 redash/…/dashboards.py• L38-107 redash/…/dashboards.py• L142-275 redash/…/dashboards.py• L408-422

Widget and visualization resources

Widgets connect dashboard layout to content. A widget can show a query visualization or text. Visualizations belong to queries and define how query data is shown. The API keeps these relationships separate so clients can edit a query visualization and place it on one or more dashboard surfaces.

The widget endpoints require dashboard edit permission and modify access to the target dashboard. When a new widget uses a visualization, they also check view access to the visualization's source query before adding it. Widget updates currently cover text-box content and options, while deletion records an event; visualization changes use their own resource endpoints.

References: redash/…/api.py• L270-278 redash/…/visualizations.py• L12-56 redash/…/widgets.py• L14-80

Public and embedded surfaces

The API supports two presentation paths. A public dashboard uses a dashboard key and returns a dashboard-focused data response. An embed route identifies a query visualization or public dashboard and serves the web application shell with browser security rules that allow the intended embedding flow.

The public path can be disabled by organization settings. Owners or administrators activate and deactivate a dashboard's public key through the API. Public and embedded views also create events so administrators can distinguish normal views from externally displayed content. See Dashboards and visualizations for the user-facing presentation model.

References: redash/…/dashboards.py• L278-353 redash/…/embed.py• L17-60 redash/…/static.py• L22-26

Administration and tenancy API

User and group management

The user API supports user search and paging, invitations, profile changes, password reset, API-key rotation, disable and enable actions, and removal of pending accounts. Administrators manage group membership through related group endpoints. Group membership is a main input to access checks for queries, dashboards, and data sources.

The group API creates and changes custom groups, lists members, and links groups to data sources with view-only or modify access. Built-in groups are protected from normal changes because they define default organization roles.

References: redash/…/api.py• L163-180 redash/…/api.py• L255-268 redash/…/users.py• L67-159 redash/…/users.py• L161-322 redash/…/groups.py• L9-115 redash/…/groups.py• L123-195

Organization settings and status

Organization administration exposes settings with their effective default values. An administrator can update organization-level behavior such as login options, search options, public URL policy, and display formats through this boundary. Authentication domain lists are also exposed as organization settings and are mapped to the organization's domain fields when saved. The organization status endpoint gives a compact count of users, alerts, data sources, queries, and dashboards.

The API also exposes a small set of system administration views for super administrators. These views report outdated queries and queue status so an operator can see whether query management services are current.

References: redash/…/settings.py• L9-70 redash/…/organization.py• L9-22 redash/…/admin.py• L13-54

Permissions and supporting resources

Object permission endpoints grant, revoke, list, and check access for queries and dashboards. They provide the explicit sharing layer that works with group and owner rules. Other resource endpoints support alerts, notification destinations, query snippets, and favorites.

Alert endpoints let users create and view alerts for accessible queries. Owners or administrators can change, evaluate, mute, unmute, and remove them. Alert subscriptions connect an alert to a user or notification destination. These resources extend the same organization, access, serialization, and event patterns as the main query and dashboard APIs. See Alerts and notification delivery for the alert and delivery model.

References: redash/…/permissions.py• L15-110 redash/…/alerts.py• L23-166 redash/…/destinations.py• L15-134 redash/…/query_snippets.py• L13-76 redash/…/favorites.py• L8-75

Identity and application delivery

Authentication and session endpoints

Authentication routes handle login, logout, invitations, password reset, email verification, and the verification-email request. They support the configured local and external login choices and redirect the browser back to the application after a successful account action.

The session endpoint gives the web client its current user, organization slug, messages, and client settings. API users receive a reduced identity view, while interactive users receive profile, group, and permission data. The configuration endpoint provides the client settings without the full session identity. These responses let the browser start with the same organization and feature view that the backend uses for the request.

See Identity, access, and tenancy for authentication providers and the broader access model.

References: redash/…/authentication.py• L109-226 redash/…/authentication.py• L282-362

Initial setup

The setup route creates the first organization and its initial administrator in a single-organization deployment. It then signs in that administrator and redirects to the application; optional newsletter and security subscriptions are sent as background work. The route is unavailable after an organization exists or when multi-organization mode is enabled.

References: redash/…/setup.py• L13-73

Static application delivery

The static route group delivers the browser application after the backend has resolved the request. The root and path routes return the application entry page so the client can handle its own page navigation. A dashboard path follows the same delivery model and applies the embedding security policy.

In a multi-organization deployment, the server renders an organization-aware shell. In a single-organization deployment, it serves the built index asset. These routes require an authenticated browser session, which keeps application navigation separate from public API data access while allowing both to share organization context.

References: redash/…/static.py• L12-33 redash/…/base.py• L103-107 redash/app.py• L7-18

Event intake and audit views

Handlers send important actions to the event system with organization, user or API key, object, request, and time data. The event API accepts client events and gives administrators a paged view of the resulting audit records. Event display adds browser and location information when the request data supports it.

This event path is not the main data path for queries or dashboards. It is a record of how users and API clients use those systems.

References: redash/…/base.py• L41-61 redash/…/events.py• L22-69

Request flow

The request path moves from route selection to context and access checks before it reaches product work. Query execution adds an asynchronous branch, while ordinary reads and edits return from the handler.

flowchart TD
    A[HTTP request] --> B[Route group]
    B --> C[Organization context]
    C --> D[User or API identity]
    D --> E[Permission and object access]
    E --> F[Read or change product data]
    F --> G[JSON or file response]
    F --> H[Background job]
    H --> I[Job status or later result]
    F --> J[Audit event]

The same shape applies to administration, query, dashboard, and data source calls. The resource-specific handler owns the product action, while shared context and access rules keep the action inside the caller's organization and authority.

Change checklist

When these files or sections are changed, remember to consider these:

  • Update both the API registration in redash/…/api.py and the resource or route definition when a path, endpoint name, or organization scope changes.
  • Keep organization lookup and record queries aligned when adding a route that can run in multi-organization mode.
  • Preserve the distinction between interactive users and API users when changing session data, public keys, query results, or event records.
  • Check the paired permission rule when changing a query, dashboard, data source, user, or group action. A broad feature permission and object access can fail independently.
  • Keep clients able to handle both immediate data and job responses for query execution and schema refresh.
  • Treat dashboard, widget, visualization, query, and public-key changes as one contract because the presentation and sharing endpoints expose their relationships together.
  • Keep widget creation aligned with both dashboard modify access and view access to the source query when a visualization is attached. Keep text-box updates and widget deletion aligned with the widget resource contract.
  • Keep static, embed, and public dashboard routes consistent with the organization settings that control the application shell and public access.
  • Keep the SQL formatting error response stable when changing parser limits or formatting behavior so clients can distinguish invalid or unsupported formatting input from a server fault.
  • Keep the settings response and its save path aligned when changing authentication domain settings. The public setting names map to organization fields rather than only to the general settings store.
  • Keep session identity and client configuration changes aligned with the different data exposed to API users and interactive users.
  • Clear or version Databricks schema caches when data source settings that affect catalog or table discovery change.
  • Keep first-run setup blocked in multi-organization mode and after an organization has been created.

Important failure modes

TriggerConsequenceGuard
A multi-organization route omits the organization scope or loads a record without the current organization filterA request can resolve the wrong tenant or expose a missing record as if it were localUse the shared organization-scoped route rule and organization-aware model lookup
A caller has a feature permission but lacks access to the target query, dashboard, or data sourceThe handler returns 403 even though the caller can reach the endpointApply both broad permission checks and object access checks
A widget is added without dashboard modify access or view access to its source queryThe widget can change a dashboard or expose a visualization that the caller cannot viewCheck dashboard modify access and source-query view access before creating the widget
A client treats a query refresh response as final result dataThe client misses the job state and never follows the result lifecycleHandle both serialized results and serialized jobs
A saved query contains an unsafe parameter and is used through a shared or view-only pathExecution is rejected to prevent a lower-trust caller from running itCheck parameter safety before allowing view-only or API-key execution
A dashboard or query update uses an old versionThe handler returns 409 rather than silently overwriting a newer editSend the version received from the last read and resolve the conflict
Public URLs are disabled for the organizationPublic dashboard access returns an error instead of the dashboardCheck the organization setting before creating or using a public presentation path
SQL sent to the formatting endpoint exceeds parser size or nesting limitsThe endpoint returns 400 and does not return formatted SQLTreat the response as a client input error and keep formatting limits bounded
An administrator changes authentication domain settings through a path that does not map the public names to organization fieldsThe settings response and authentication behavior can divergePreserve the explicit domain-field mapping in the settings handler
A client assumes an API user has the same session fields as an interactive userThe client relies on absent profile, group, or permission dataUse the reduced API-user session shape when handling machine clients
A data source changes while an old Databricks discovery job or cache remains validDatabase or table choices can describe the prior catalog or credentialsTie discovery caches to the current configuration and clear them after edits
A setup request runs after initialization or in multi-organization modeThe first organization flow is bypassed or has no valid single-organization targetRedirect setup requests when an organization exists or multi-organization mode is active

Key files

FileWhy to read it
redash/…/api.pyCentral map of JSON resources and public API paths
redash/…/base.pyShared login requirement, organization context, paging, and event recording
redash/permissions.pyRelationship between feature permissions, ownership, groups, and object access
redash/…/queries.pySaved-query discovery, editing, SQL formatting, sharing support, and refresh entry point
redash/…/query_results.pyResult retrieval, file delivery, caching, access checks, and asynchronous query jobs
redash/…/data_sources.pyData source administration, access visibility, schema jobs, and pause controls
redash/…/databricks.pyDatabricks discovery access, configuration-aware schema caching, and discovery jobs
redash/…/dashboards.pyDashboard discovery, editing, version checks, and public sharing
redash/…/widgets.pyWidget placement, text-box updates, dashboard access checks, and widget deletion
redash/…/authentication.pyLogin/session contract, authentication choices, and client bootstrap configuration
redash/…/setup.pyFirst-organization and administrator creation flow
redash/…/settings.pyOrganization settings read and save contract, including authentication domain fields
redash/…/static.pyAuthenticated browser application shell delivery and dashboard navigation
redash/…/users.py and redash/…/groups.pyOrganization membership and group-based access administration
redash/…/permissions.pyExplicit sharing for query and dashboard objects
redash/…/alerts.pyAlert ownership, evaluation, muting, and subscription endpoints
redash/…/embed.pyEmbedded visualization and public dashboard entry paths