No logo available for XDG Desktop Portal to DuckDB connector icon

Load XDG Desktop Portal data to DuckDB

Build a XDG Desktop Portal to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the XDG Desktop Portal API base URL, auth, endpoints, and incremental loading.

SourceXDG Desktop PortalXDG Desktop Portal API DocumentationDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

XDG Desktop Portal is a D-Bus service that allows applications to interact with the desktop environment securely and in a standardized way. Everything needed to build a working XDG Desktop Portal → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your XDG Desktop Portal to DuckDB pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from XDG Desktop Portal to DuckDB and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the XDG Desktop Portal API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


XDG Desktop Portal API at a glance

Base URLnot_applicable
Example endpointGET org.freedesktop.portal.Documents.List
Authenticationno authentication required
PaginationNot paginated
Incremental field"},data_selector:{citations:,confidence:
Record id"},name:{citations:,confidence:
API referencehttps://flatpak.github.io/xdg-desktop-portal/docs/api-reference.html

These values come from the XDG Desktop Portal API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the XDG Desktop Portal API?

XDG Desktop Portal interfaces are exposed over the session D-Bus. There is no HTTP authentication, headers, or tokens involved; access is governed by desktop environment permissions and sandboxing.

1. Get your credentials

XDG Desktop Portal does not use REST API credentials, API keys, or tokens. It is a D-Bus interface accessed via the session bus. To access it, you must run your application within a context (such as a Flatpak sandbox) that has been granted the necessary portal permissions in its manifest. Access control is enforced by the desktop environment and Flatpak sandboxing mechanism. No authentication headers or API keys are required for D-Bus calls.

2. Add them to .dlt/secrets.toml

[sources.xdg_desktop_portal_source] # No API keys or authentication credentials required. # Ensure your execution environment has the appropriate D-Bus access permissions.

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What XDG Desktop Portal data can I load into DuckDB?

These are the XDG Desktop Portal endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
documents_listorg.freedesktop.portal.Documents.ListD-Bus MethodLists documents in the document store; returns doc_id to path mapping.
documents_infoorg.freedesktop.portal.Documents.InfoD-Bus MethodGets path and app permissions for a doc_id.
flatpak_request_ref_tokensorg.freedesktop.Flatpak.Authenticator.RequestRefTokensD-Bus MethodStart token resolution request; returns handle and signals.
flatpak_update_monitororg.freedesktop.portal.Flatpak.UpdateMonitorD-Bus Signal/MethodMonitor Flatpak update events via portal signals.
permission_store_listorg.freedesktop.impl.portal.PermissionStore.ListD-Bus MethodList permission store entries.

How do I load only new XDG Desktop Portal records?

XDG Desktop Portal exposes "},data_selector:{citations:,confidence: on org.freedesktop.portal.Documents.List, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.

{"name": "documents_list", "endpoint": { "path": "org.freedesktop.portal.Documents.List", "incremental": {"cursor_path": "\"},data_selector:{citations:,confidence:", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated XDG Desktop Portal pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading org.freedesktop.portal.Desktop and org.freedesktop.portal.Secret from the XDG Desktop Portal API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def xdg_desktop_portal_source(not_applicable=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "not_applicable", "auth": {"type": "api_key", "api_key": not_applicable, "name": "not_applicable"}, }, "resources": [ {"name": "documents_list", "endpoint": {"path": "org.freedesktop.portal.Documents.List"}}, {"name": "permission_store_list", "endpoint": {"path": "org.freedesktop.impl.portal.PermissionStore.List"}} ], } yield from rest_api_resources(config) def load_xdg_desktop_portal_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="xdg_desktop_portal_pipeline", destination="duckdb", dataset_name="xdg_desktop_portal_data", ) load_info = pipeline.run(xdg_desktop_portal_source()) print(load_info) if __name__ == "__main__": load_xdg_desktop_portal_to_duckdb()

Run it with python xdg_desktop_portal_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query XDG Desktop Portal data in DuckDB?

dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("xdg_desktop_portal_pipeline").dataset() df = data.documents_list.df() print(df.head())

SQL:

SELECT * FROM xdg_desktop_portal_data.documents_list LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the XDG Desktop Portal to DuckDB pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw XDG Desktop Portal loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load XDG Desktop Portal data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for XDG Desktop Portal to DuckDB?

Request dlt skills, commands, AGENT.md files, and AI-native context.