API
How-to Guide for Using the Monte Carlo API
Where the Monte Carlo UI provides vast options for interacting with the platform, the Monte Carlo API provides users with the ability to interact with their data programmatically. Many of the options outlined in this guide are also available in the UI, but the API does allow for even more flexibility and customization in user workspaces.
The following page explains how to get started with the API and the various resources at your disposal. Please see subsections for specific examples and use cases.
Looking for our API reference?
See here for all GraphQL queries, mutations, and types with examples of requests and responses.
Getting Started
Customers can use the Monte Carlo API Explorer or any REST client to execute API calls that mirror the data visible in the Monte Carlo UI. This makes it easy to retrieve, analyze, or integrate Monte Carlo’s data without needing to interact directly with the UI.
General Use Cases
Common use cases that leverage Monte Carlo's API include:
- Presenting data health metrics and incident analytics on dashboards (e.g. on DataDog)
- Enabling automatic custom monitoring configurations when adding new tables in your ETL code
- Handling notifications that Monte Carlo produces programmatically using webhooks
- Augmenting the lineage that Monte Carlo automatically detects with additional resources and dependencies (e.g. external data sources, streaming sources, ML models, custom BI reports and other upstream/downstream dependencies)
- Performing custom analysis on your data ecosystem to better understand how assets are being used, typically for capacity planning, performance optimization, data debt reduction, etc
- Feeding additional tags and metadata into Monte Carlo’s catalog for a complete view and easier discovery
API Endpoint
You will be making calls to the following endpoint:
https://api.getmontecarlo.com/graphql
Authenticating API Calls
An API key is required to authenticate API calls
See Getting Started to obtain a key
To authenticate API calls, you will need to include the following headers in your request:
Key | Value |
---|---|
x-mcd-id | Key ID provided when creating the key |
x-mcd-token | Secret provided when creating the key |
For example, try running the following command in your terminal to test the API using your API key:
curl --location --request POST 'https://api.getmontecarlo.com/graphql' --header 'x-mcd-id: <ID>' --header 'x-mcd-token: <TOKEN>' --header 'Content-Type: application/json' --data-raw '{"query":"query getUser { getUser { email firstName lastName }}","variables":{}}'
Determining Which Calls Are Best for Your Use Case
Monte Carlo's UI is designed to be fully accessible through API calls. Every piece of information presented in the UI can be retrieved programmatically, empowering customers to leverage Monte Carlo’s data for custom integrations, automations, and analysis directly within their own environments.
By inspecting any MC page you can examine the queries used to populate the page, along with the variables they require. See this Knowledge Based Article for more suggestions on how to find which queries you need.
Query Examples
The subsections are divided into four groups:
- General: Queries related to users, insights, assets and more
- Integrations: Queries related to tables, warehouses, and BI tools
- Lineage: Queries related to lineage and nodes
- Monitors: Queries related to custom SQL rules, Field Health, Dimension Tracking, and JSON Schema monitors
Please note that the sample queries only show a subset of the fields available for brevity. You can use our API reference guide or introspection to see all available fields.
Questions? Feedback?
Feel free to contact your Monte Carlo representative to discuss how you could use the available APIs to solve your use cases!
Updated 9 days ago