{"id":11006,"date":"2026-07-30T08:11:12","date_gmt":"2026-07-30T02:41:12","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=10578"},"modified":"2026-08-30T16:29:10","modified_gmt":"2026-08-30T10:59:10","slug":"how-to-list-configured-databases-in-metabase-using-cli-api","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-list-configured-databases-in-metabase-using-cli-api\/","title":{"rendered":"How to List Configured Databases in Metabase Using CLI\/API?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Metabase is a popular open-source business intelligence and data visualization platform that connects to multiple databases and allows users to create dashboards and reports. As a Metabase administrator, you may need to view all configured database connections for auditing, troubleshooting, or migration purposes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This article explains how to list all databases configured in Metabase using the API from the command line.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding, ensure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access to the Metabase server.<\/li>\n\n\n\n<li>Metabase administrator credentials.<\/li>\n\n\n\n<li><code>curl<\/code> installed on the server.<\/li>\n\n\n\n<li><code>jq<\/code> installed (optional, for formatted output).<\/li>\n\n\n\n<li>Network access to the Metabase application URL.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that Metabase is accessible:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>$ curl -I http:\/\/localhost:3000<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">HTTP\/1.1 200 OK<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Generate a Metabase Session Token<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Authenticate with Metabase and obtain a session token.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>$ curl -X POST http:\/\/localhost:3000\/api\/session \\<br>-H &#8220;Content-Type: application\/json&#8221; \\<br>-d &#8216;{<br>&#8220;username&#8221;:&#8221;admin@example.com&#8221;,<br>&#8220;password&#8221;:&#8221;your_password&#8221;<br>}&#8217;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>{<br>&#8220;id&#8221;:&#8221;SESSION_TOKEN&#8221;<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the session token value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: List All Configured Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>curl -X GET http:\/\/localhost:3000\/api\/database \\<br>-H &#8220;X-Metabase-Session: SESSION_TOKEN&#8221;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>{<br>&#8220;data&#8221;:[<br>{<br>&#8220;id&#8221;:1,<br>&#8220;name&#8221;:&#8221;Production MySQL&#8221;,<br>&#8220;engine&#8221;:&#8221;mysql&#8221;<br>},<br>{<br>&#8220;id&#8221;:2,<br>&#8220;name&#8221;:&#8221;Analytics PostgreSQL&#8221;,<br>&#8220;engine&#8221;:&#8221;postgres&#8221;<br>}<br>]<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Display Only Database Names<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For a cleaner output, use:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>$ curl -s http:\/\/localhost:3000\/api\/database \\<br>-H &#8220;X-Metabase-Session: SESSION_TOKEN&#8221; | jq -r &#8216;.data[].name&#8217;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Production MySQL<br>Analytics PostgreSQL<br>Reporting Database<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Display Database Names and Types<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>curl -s http:\/\/localhost:3000\/api\/database \\<br>-H &#8220;X-Metabase-Session: SESSION_TOKEN&#8221; | jq -r &#8216;.data[] | &#8220;(.name) &#8211; (.engine)&#8221;&#8216;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Production MySQL &#8211; mysql<br>Analytics PostgreSQL &#8211; postgres<br>Reporting Database &#8211; sqlserver<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Verification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The API request returns a list of configured databases.<\/li>\n\n\n\n<li>Database names are displayed correctly.<\/li>\n\n\n\n<li>Database engines (MySQL, PostgreSQL, SQL Server, etc.) are shown as expected.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If the API returns an authentication error, generate a new session token and try again.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using the Metabase API, administrators can quickly list all configured database connections from the command line. This method is useful for auditing, migration planning, troubleshooting, and validating database connectivity without logging in to the Metabase web interface. Regularly reviewing configured databases helps maintain an organized and secure Metabase environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Metabase is a popular open-source business intelligence and data visualization platform that connects to multiple databases and allows users [&hellip;]<\/p>\n","protected":false},"author":496,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019,1042,1040,1022],"tags":[180,993],"class_list":["post-11006","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","category-databases","category-linux","category-web-architecture","tag-database","tag-metabase","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2Rw","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/11006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/496"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=11006"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/11006\/revisions"}],"predecessor-version":[{"id":11161,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/11006\/revisions\/11161"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=11006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=11006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=11006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}