Using API to SQL code for questions

Hi, I was wondering if there was a way to get the SQL code behind questions in a dashboard through the API/Python in some manner. Thanks!

Hi @ahansahu
There's a way to view the SQL of questions:
And you can see the endpoint used to show that.

The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.

Hi @flamber, thanks for the quick reply.

I know how to view the SQL code on Metabase directly, however since I haven't used the API before and am new to it, I was wondering if there was a way to use the API/ a Python package to download json of the SQL behind the question or something similar? I'm sorry if I'm not being clear enough, and thanks again.

@ahansahu Open your browser developer Network-tab and see what going on, when you use Metabase. Then you can see the requests and copy as cURL commands in most browsers.
Everything you do in the Metabase interface are just API requests.

There's no official Python package, but have a look at

Hi @flamber, thanks for the quick reply again.

I understand what you are saying however it'd be great if you could give me instructions on accessing the browser developer network tab. Is that the same as the Network tab in Chrome Dev Tools?. Thanks!

@ahansahu Yes, in Chrome it's called DevTools: