Issue with Query Parameters in Metabase Python API

Hello Metabase team,

I've been trying to run a query on a card(metabase native question) using the Metabase Python API with specific parameters. Below is the Python script I am using:

pythonCopy code

import requests
import json

# my credentials and session id request
response ='http://localhost:3000/api/session',
                         json={'username': 'xxxxxx',
                               'password': 'xxxxxxx'})
session_id = response.json()['id']
headers = {
     "Content-Type": "application/json",
     "X-Metabase-Session": session_id

# Note that the parameters are passed as a list of dictionaries
params = [{
  "type": "category",
  "value": "",
  "target": [

body = {'parameters': params}

response ='http://localhost:3000/api/card/1/query', headers=headers, data=json.dumps(body))


However, I am encountering an error related to the missing 'email' parameter. This is despite the fact that the 'email' parameter is clearly defined and used in the query. The error I'm getting is as follows:


b'{"database_id":1,"started_at":"2023-07-26T19:22:46.823765Z","error_type":"missing-required-parameter","json_query":{"constraints":{"max-results":10000,"max-results-bare-rows":2000},"type":"native","middleware":{"js-int-to-string?":true,"ignore-cached-results?":false,"process-viz-settings?":false},"native":{"query":"select email, name,city from people \nwhere (\n true\n and email in (\n '', ''\n )\n and email = {{email}}\n)","template-tags":{"email":{"id":"daba13a1-47ed-69c8-dc70-4cfb5840081f","name":"email","display-name":"Email","type":"text"}}},"database":1,"parameters":null,"async?":true,"cache-ttl":null},"status":"failed","class":"class clojure.lang.ExceptionInfo","stacktrace":["--> driver.sql.parameters.substitute$substitute.invokeStatic(su

I'm not sure why this is happening. Is there anything I'm missing or doing wrong?

To troubleshoot this issue, I have referred to various resources and forums, and even sought assistance from OpenAI's ChatGPT. Despite this, I haven't been able to identify where the problem lies.

Any insights would be highly appreciated. Thank you in advance for your help!