Bulk create cards into a dashboard

Hi everyone!

Has anyone successfully create multiple cards in Metabase dashboards using the API?
I have tried the following methods but I couldn't achieve the desired output:

  • Using the POST /api/dashboard/:dashbaord-id/cards
  • Using the PUT /api/dashboard/:id

Would greatly appreciate if someone could share any insights about the above.


The below is the code snippet that I have try to use but to no avail

response = mb.get('/api/dashboard/1')
dashboard_id = 1
card_ids = [100]

updated_response = response.copy()

for card_id in card_ids:
# Get the card details using its ID.
card_response = mb.get(f"/api/card/{card_id}")
sql_query = card_response["dataset_query"]["native"]["query"]
new_card = {
"action_id": None,
"card": {
"id": card_id,
"name": card_response["name"],
"database_id": 1,
"dataset_query": {
"native": {
"query": sql_query
"type": "native"
'database_id': 1,
'dashboard_id': 1,
'card_id': card_id,
'parameter_mappings': ,
'series': ,
'col': 0,
'row': 0,
'size_x': 12,
'size_y': 5,
'visualization_settings': {}

mb.put(f"/api/dashboard/{dashboard_id}", json=updated_response)

I would suggest that you open the browser developer tools of your browser and see what the browser does whenever you add cards to a dashboard. Then replicate that with python