Create card with parameter/filters dynamically via metabase api api/card

hello,
i'm trying to be able to create cards/question dynamically via metabase api, i'm running metabase opensource using docker, i'm struggling to create a card with parameter/filter that users then can filter the data using them.
I've been trying for multiple days and this the best i have so far :

{
    "name": "My Custom Question20",
    "dataset_query": {
        "database": 3,
        "type": "query",
        "query": {
            "source-table": 28,
            "fields": [
                [
                    "field",
                    471,
                    null
                ],
                [
                    "field",
                    469,
                    null
                ]
            ]
        }
    },
    "display": "table",
    "description": null,
    "visualization_settings": {
        "table.pivot_column": "MIN_DATA_SOURCE",
        "table.cell_column": "SAL_VALUE"
    },
    "collection_id": null,
    "collection_position": null,
    "result_metadata": [
        {
            "description": null,
            "semantic_type": null,
            "coercion_strategy": null,
            "name": "SAL_VALUE",
            "settings": null,
            "field_ref": [
                "field",
                471,
                null
            ],
            "effective_type": "type/Decimal",
            "id": 471,
            "visibility_type": "normal",
            "display_name": "Sal Value",
            "fingerprint": {
                "global": {
                    "distinct-count": 1150,
                    "nil%": 0.2172
                },
                "type": {
                    "type/Number": {
                        "min": 0,
                        "q1": 143.58369900838002,
                        "q3": 1404.1902162004717,
                        "max": 423650,
                        "sd": 18932.171316243497,
                        "avg": 2741.3533469596323
                    }
                }
            },
            "base_type": "type/Decimal"
        },
        {
            "description": null,
            "semantic_type": "type/Source",
            "coercion_strategy": null,
            "name": "MIN_DATA_SOURCE",
            "settings": null,
            "field_ref": [
                "field",
                469,
                null
            ],
            "effective_type": "type/Text",
            "id": 469,
            "visibility_type": "normal",
            "display_name": "Min Data Source",
            "fingerprint": {
                "global": {
                    "distinct-count": 2,
                    "nil%": 0
                },
                "type": {
                    "type/Text": {
                        "percent-json": 0,
                        "percent-url": 0,
                        "percent-email": 0,
                        "percent-state": 0,
                        "average-length": 19.0116
                    }
                }
            },
            "base_type": "type/Text"
        }
    ],
     "parameters": [
    {
      "id": "aa1",
      "type" :"number/>=",
       "target": [
        "dimension",
        [
          "field",
          471,
          null
        ]
      ]
    }
  ]
}```

I got the card created and working and the filter apears on the top but when ever i set the value to the filter/parameter the question crashes and when i check the logs i get this :


ERROR metabase.server.middleware.log POST /api/card/191/query 500 11.0 ms (7 DB calls) 
{:via
 [{:type clojure.lang.ExceptionInfo,
   :message "Invalid parameter: Card 191 does not have a template tag named nil.",
   :data
   {:type :invalid-parameter,
    :invalid-parameter {:id "aa1", :type :number/>=, :value [20], :target [:dimension [:field 471 nil]]},
    :allowed-parameters nil},
   :at [metabase.query_processor.card$fn__102806$validate_card_parameters__102811$fn__102812 invoke "card.clj" 168]}],
 :trace
 [[metabase.query_processor.card$fn__102806$validate_card_parameters__102811$fn__102812 invoke "card.clj" 168]
  [metabase.query_processor.card$fn__102806$validate_card_parameters__102811 invoke "card.clj" 159]
  [metabase.query_processor.card$run_query_for_card_async invokeStatic "card.clj" 215]
  [metabase.query_processor.card$run_query_for_card_async doInvoke "card.clj" 177]
  [clojure.lang.RestFn invoke "RestFn.java" 1124]
  [metabase.api.card$fn__103759 invokeStatic "card.clj" 949]
  [metabase.api.card$fn__103759 invoke "card.clj" 937]
  [compojure.core$wrap_response$fn__44464 invoke "core.clj" 160]
  [compojure.core$wrap_route_middleware$fn__44448 invoke "core.clj" 132]
  [compojure.core$wrap_route_info$fn__44453 invoke "core.clj" 139]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 151]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 152]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476 invoke "core.clj" 200]
  [metabase.server.middleware.auth$enforce_authentication$fn__100276 invoke "auth.clj" 17]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476 invoke "core.clj" 200]
  [compojure.core$make_context$handler__44504 invoke "core.clj" 290]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 300]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 301]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 301]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 301]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 301]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [metabase.api.routes$fn__112139$fn__112142 invoke "routes.clj" 66]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476 invoke "core.clj" 200]
  [clojure.lang.AFn applyToHelper "AFn.java" 160]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.core$apply invoke "core.clj" 662]
  [metabase.server.routes$fn__112304$fn__112305 doInvoke "routes.clj" 70]
  [clojure.lang.RestFn invoke "RestFn.java" 436]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476 invoke "core.clj" 200]
  [compojure.core$make_context$handler__44504 invoke "core.clj" 290]
  [compojure.core$make_context$fn__44508 invoke "core.clj" 300]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__44457 invoke "core.clj" 153]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476$f__44477$respond_SINGLEQUOTE___44478 invoke "core.clj" 197]
  [metabase.server.routes$fn__112289$fn__112291 invoke "routes.clj" 47]
  [compojure.core$routes$fn__44476$f__44477 invoke "core.clj" 198]
  [compojure.core$routes$fn__44476 invoke "core.clj" 200]
  [metabase.server.middleware.exceptions$catch_uncaught_exceptions$fn__108705 invoke "exceptions.clj" 107]
  [metabase.server.middleware.exceptions$catch_api_exceptions$fn__108702 invoke "exceptions.clj" 95]
  [metabase.server.middleware.log$log_api_call$fn__112576$fn__112577$fn__112578 invoke "log.clj" 216]
  [metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info invokeStatic "diagnostic.clj" 18]
  [metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info invoke "diagnostic.clj" 12]
  [metabase.server.middleware.log$log_api_call$fn__112576$fn__112577 invoke "log.clj" 208]
  [toucan2.execute$do_with_call_counts invokeStatic "execute.clj" 112]
  [toucan2.execute$do_with_call_counts invoke "execute.clj" 103]
  [metabase.server.middleware.log$log_api_call$fn__112576 invoke "log.clj" 207]
  [metabase.server.middleware.browser_cookie$ensure_browser_id_cookie$fn__114691 invoke "browser_cookie.clj" 42]
  [metabase.server.middleware.security$add_security_headers$fn__90795 invoke "security.clj" 153]
  [metabase.server.middleware.json$wrap_json_body$fn__113258 invoke "json.clj" 67]
  [metabase.server.middleware.offset_paging$handle_paging$fn__90819 invoke "offset_paging.clj" 45]
  [metabase.server.middleware.json$wrap_streamed_json_response$fn__113276 invoke "json.clj" 103]
  [ring.middleware.keyword_params$wrap_keyword_params$fn__114958 invoke "keyword_params.clj" 55]
  [ring.middleware.params$wrap_params$fn__114977 invoke "params.clj" 77]
  [metabase.server.middleware.misc$maybe_set_site_url$fn__57226 invoke "misc.clj" 61]
  [metabase.server.middleware.session$reset_session_timeout$fn__71789 invoke "session.clj" 441]
  [metabase.server.middleware.session$bind_current_user$fn__71756$fn__71757 invoke "session.clj" 336]
  [metabase.server.middleware.session$do_with_current_user invokeStatic "session.clj" 315]
  [metabase.server.middleware.session$do_with_current_user invoke "session.clj" 304]
  [metabase.server.middleware.session$bind_current_user$fn__71756 invoke "session.clj" 335]
  [metabase.server.middleware.session$wrap_current_user_info$fn__71737 invoke "session.clj" 285]
  [metabase.server.middleware.session$wrap_session_id$fn__71720 invoke "session.clj" 217]
  [metabase.server.middleware.auth$wrap_api_key$fn__100284 invoke "auth.clj" 30]
  [ring.middleware.cookies$wrap_cookies$fn__114878 invoke "cookies.clj" 216]
  [metabase.server.middleware.misc$add_content_type$fn__57208 invoke "misc.clj" 29]
  [metabase.server.middleware.misc$disable_streaming_buffering$fn__57234 invoke "misc.clj" 78]
  [ring.middleware.gzip$wrap_gzip$fn__114920 invoke "gzip.clj" 86]
  [metabase.server.middleware.misc$bind_request$fn__57237 invoke "misc.clj" 95]
  [metabase.server.middleware.ssl$redirect_to_https_middleware$fn__114707 invoke "ssl.clj" 41]
  [metabase.server$async_proxy_handler$fn__79504 invoke "server.clj" 77]
  [metabase.server.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a handle nil -1]
  [org.eclipse.jetty.server.handler.StatisticsHandler handle "StatisticsHandler.java" 173]
  [org.eclipse.jetty.server.handler.HandlerWrapper handle "HandlerWrapper.java" 122]
  [org.eclipse.jetty.server.Server handle "Server.java" 563]
  [org.eclipse.jetty.server.HttpChannel lambda$handle$0 "HttpChannel.java" 505]
  [org.eclipse.jetty.server.HttpChannel dispatch "HttpChannel.java" 762]
  [org.eclipse.jetty.server.HttpChannel handle "HttpChannel.java" 497]
  [org.eclipse.jetty.server.HttpConnection onFillable "HttpConnection.java" 282]
  [org.eclipse.jetty.io.AbstractConnection$ReadCallback succeeded "AbstractConnection.java" 314]
  [org.eclipse.jetty.io.FillInterest fillable "FillInterest.java" 100]
  [org.eclipse.jetty.io.SelectableChannelEndPoint$1 run "SelectableChannelEndPoint.java" 53]
  [org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy runTask "AdaptiveExecutionStrategy.java" 416]
  [org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy consumeTask "AdaptiveExecutionStrategy.java" 385]
  [org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy tryProduce "AdaptiveExecutionStrategy.java" 272]
  [org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy lambda$new$0 "AdaptiveExecutionStrategy.java" 140]
  [org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread run "ReservedThreadExecutor.java" 411]
  [org.eclipse.jetty.util.thread.QueuedThreadPool runJob "QueuedThreadPool.java" 936]
  [org.eclipse.jetty.util.thread.QueuedThreadPool$Runner run "QueuedThreadPool.java" 1080]
  [java.lang.Thread run nil -1]],
 :cause "Invalid parameter: Card 191 does not have a template tag named nil.",
 :data
 {:type :invalid-parameter,
  :invalid-parameter {:id "aa1", :type :number/>=, :value [20], :target [:dimension [:field 471 nil]]},
  :allowed-parameters nil},
 :message "Invalid parameter: Card 191 does not have a template tag named nil.",
 :invalid-parameter {:id "aa1", :type :number/>=, :value [20], :target [:dimension [:field 471 nil]]},
 :allowed-parameters nil}```

Note that when i create the crard no errors are on the logs :
[ec692189-9250-4233-804d-5859797ba551] 2023-09-18T10:33:29+03:00 DEBUG metabase.server.middleware.log POST /api/card 200 25.4 ms (17 DB calls) App DB connections: 1/15 Jetty threads: 6/50 (1 idle, 0 queued) (127 total active threads) Queries in flight: 0 (0 queued)

can someone help me with this ?
thanks in advanced .

Hello,
Were you able to resolve this?

I was facing a similar issue when trying to create Filter parameters from the API. In my case I was getting an error when setting the filter value and trying to save. I believe my issue is because I did not set the Filter 'id' in the json.