---
title: "POST /api/card/{card-id}/query/{export-format}"
method: POST
path: "/api/card/{card-id}/query/{export-format}"
tags: ["/api/card"]
---

# POST /api/card/{card-id}/query/{export-format}

`POST /api/card/{card-id}/query/{export-format}`

Run the query associated with a Card, and return its results as a file in the specified format.

  `parameters`, `pivot-results?` and `format-rows?` should be passed as application/x-www-form-urlencoded form content
  or json in the body. This is because this endpoint is normally used to power 'Download Results' buttons that use
  HTML `form` actions).

## Path parameters

- `card-id` integer, required
- `export-format` 'csv' | 'api' | 'xlsx' | 'json', required — Schema for valid export formats for downloading query results.

## Request body

- object
  - `format_rows` boolean, required
  - `parameters` object[], nullable
  - `pivot_results` boolean, required

## Response `2XX`

Successful response

## Other responses

- `4XX` — Client error response
- `5XX` — Server error response

---

[API](https://skmtc.net/metabase/apis/metabase-api.md) · [All operations](https://skmtc.net/metabase/apis/metabase-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/metabase/metabase-api/revisions/08b5a2bafb4f/schema)
