No logo available for Morningstar Direct Web Services to DuckDB connector icon

Load Morningstar Direct Web Services data to DuckDB

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

SourceMorningstar Direct Web ServicesMorningstar Direct Web Services API DocumentationDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

Morningstar Direct Web Services provides access to investment data, research, and reports via a set of RESTful APIs. Everything needed to build a working Morningstar Direct Web Services → 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 Morningstar Direct Web Services 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 Morningstar Direct Web Services 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 Morningstar Direct Web Services 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.


Morningstar Direct Web Services API at a glance

Base URLhttps://www.us-api.morningstar.com
Example endpointGET direct-web-services/v1/investments
Authenticationall requests require a Bearer token generated via OAuth 2.0 authentication — sent in the Authorization header, prefixed Bearer
PaginationCursor-based via paginationTokenNext, page size via pageSize. The API uses token-based pagination. For GET requests, the token is passed as a query parameter. For POST requests (like the screener API), it is passed within a 'pagination' object in the request body. The maximum value for pageSize is 50.
Incremental fieldpaginationTokenNext
Record idperformanceId
API referencehttps://developer.morningstar.com/direct-web-services/documentation/api-utilities/authentication-api/overview

These values come from the Morningstar Direct Web Services API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Morningstar Direct Web Services API?

Authentication requires sending a POST request to the /token/oauth endpoint with a Basic authorization header containing the Base64-encoded 'username:password' string. Subsequent API requests must include the received JWT in the Authorization header as a Bearer token.

1. Get your credentials

To obtain API credentials for Morningstar Direct Web Services, you must work with your organization's Morningstar Account Manager during the onboarding process. You provide an email address to be used as your username, and Morningstar sends an activation email with instructions to create a password and activate the account. Note that separate credentials are required for the User Acceptance Testing (UAT) and production environments. Credentials should be securely stored and are not managed via a self-service dashboard.

2. Add them to .dlt/secrets.toml

[sources.morningstar_direct_web_services_source] morningstar_username = "your_email_address_here" morningstar_password = "your_password_here"

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 Morningstar Direct Web Services data can I load into DuckDB?

These are the Morningstar Direct Web Services endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
investments/direct-web-services/v1/investmentsGETRetrieves a list of investments using token-based pagination.
investment_details/direct-web-services/v1/investment-details/{ids}GETRetrieves detailed information for specific investment IDs.
screener_equities/direct-web-services/v1/screener/equitiesPOSTRetrieves screened equities based on filter criteria with pagination.
corporate_actions/direct-web-services/time-series/v1/corporate-actions/dividend-amount-history/{ids}GETRetrieves dividend amount history time series.
entitled_universe/direct-web-services/v1/entitled-universeGETRetrieves the list of exchanges the account is entitled for.

How do I load only new Morningstar Direct Web Services records?

Morningstar Direct Web Services exposes paginationTokenNext on direct-web-services/v1/investments, 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": "investments", "endpoint": { "path": "direct-web-services/v1/investments", "incremental": {"cursor_path": "paginationTokenNext", "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 Morningstar Direct Web Services pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading /token/oauth and /direct-web-services/v1/... from the Morningstar Direct Web Services API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def morningstar_direct_web_services_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://www.us-api.morningstar.com", "auth": {"type": "bearer", "token": access_token}, }, "resources": [ {"name": "investments", "endpoint": {"path": "direct-web-services/v1/investments"}}, {"name": "screener_equities", "endpoint": {"path": "direct-web-services/v1/screener/equities"}} ], } yield from rest_api_resources(config) def load_morningstar_direct_web_services_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="morningstar_direct_web_services_pipeline", destination="duckdb", dataset_name="morningstar_direct_web_services_data", ) load_info = pipeline.run(morningstar_direct_web_services_source()) print(load_info) if __name__ == "__main__": load_morningstar_direct_web_services_to_duckdb()

Run it with python morningstar_direct_web_services_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 Morningstar Direct Web Services 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("morningstar_direct_web_services_pipeline").dataset() df = data.investments.df() print(df.head())

SQL:

SELECT * FROM morningstar_direct_web_services_data.investments LIMIT 10;

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


How do I deploy the Morningstar Direct Web Services 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 Morningstar Direct Web Services 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 Morningstar Direct Web Services 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 Morningstar Direct Web Services to DuckDB?

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