Examples
End-to-end walkthroughs combining several commands. For per-command details see the command reference.
Authentication workflow
# Interactive browser-based login using OAuth 2.0 + PKCE
carto auth login
# This will:
# 1. Display an authorization URL
# 2. Open your browser (you may need to copy/paste the URL)
# 3. Wait for you to complete the login process
# 4. Capture your access token and user information
# 5. Store credentials in ~/.carto_credentials.json
# 6. Configure the API URL based on your tenant
# Check authentication status
carto auth status
# Show current user information
carto auth whoami
# Returns: user_id, name, email, account info, roles
# Switch between profiles
carto auth use production
carto auth use stagingManaging application credentials
Browsing and managing resources
Creating a Builder map from JSON
carto maps create accepts a round-trippable bundle from a positional JSON string, a filesystem path, or stdin. Pre-flight validation runs before any write, so broken bundles reject without creating an orphan map.
For the full schema and authoring patterns, see carto maps schema and the carto-create-builder-maps skill.
Round-trip: edit an existing map
Screenshot a map
Creating a Workflow from a bundle
carto workflows create --file <bundle.json> takes a Workflows bundle and provisions the nodes, edges, and metadata in a single call.
Browse the component catalog
Workflows are composed from components — native.where, native.customsql, native.joinv2, and many more. Browse the catalog for a connection (so extensions and stored procedures show up too):
Run + publish as an MCP tool
Copying maps and workflows between organizations
A common pattern is promoting maps and workflows between environments — staging to production, customer A to customer B, or one region to another. The CLI handles connection mapping automatically and validates source accessibility before copying.
Prerequisites: authenticate to both organizations using named profiles.
You'll need the ID of the map or workflow to copy. Get it from the CARTO Workspace (three-dot menu on the card, or from the URL), or search by name with carto maps list --search "<name>" / carto workflows list --search "<name>".
By default, CARTO will try to map each connection used by the source resource to a connection with the same name in the destination organization. If a Snowflake connection is called production in both orgs, the copy works without further configuration.
When connection names differ, supply an explicit mapping:
Smart connection mapping
The CLI handles connection mapping with three strategies, in priority order:
Auto-mapping by name (default) — match connections by name between source and destination.
Manual mapping — explicit pairs via
--connection-mapping.Legacy single connection — use one connection for all datasets via
--connection.
How copy works:
Fetches the source map configuration and all datasets.
Identifies all unique connections used by the map.
Resolves each connection in priority order: manual mapping → auto-map by name → legacy single connection.
Validates that all destination connections exist (fails fast if any are missing).
Validates that dataset sources are accessible in the destination using SQL dry-run queries (
WHERE 1=0). Tests permissions and existence without transferring data. Fails if any source is inaccessible (unless--skip-source-validation).Creates the new map and datasets with resolved connections.
Updates the map configuration with the new dataset IDs.
Preserves privacy settings if
--keep-privacyis set.
Connection resolution scenarios:
Scenario 1 — Perfect match (auto-mapping):
Scenario 2 — Renamed connections (manual mapping):
Scenario 3 — Mixed (manual + auto):
Scenario 4 — Missing connection:
Scenario 5 — Source validation failure:
Scenario 6 — Skip source validation (intentional broken map):
Troubleshooting
Error: "Connection 'X' not found in destination organization"
Run
carto connections list --profile <dest-profile>to see available connections.Create the missing connection in the destination organization.
Use
--connection-mappingto map to a different name.
Error: "Source validation failed - datasets cannot access their data sources"
The destination connection lacks permission to access the source tables/queries.
Grant the necessary permissions in your data warehouse (BigQuery, Snowflake, …).
Verify table names/paths are correct and exist in the destination.
Use
--skip-source-validationif you want to create the map anyway and fix access later.
Map created but visualizations don't load
This shouldn't happen with validation enabled (the default).
If you used
--skip-source-validation, check dataset connections and permissions.
Organization statistics
The displayed information depends on your permissions:
Regular users — see resource counts and basic stats.
Admin users — see full organization statistics including quotas.
Access denied for some stats — partial data is shown with notes.
User management
Activity data analysis
Query activity data with DuckDB SQL — no data warehouse needed. The first query with a given date range downloads data (~10s); subsequent queries are instant from the local cache.
See activity command reference for the full schema and DuckDB syntax tips.
Chatting with a map's AI agent
Useful for testing agent instructions during development, debugging which workflows the agent invokes, and integrating agent validation into CI pipelines.
Last updated
Was this helpful?
