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

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

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

Download query results for a Card embedded in a Document.

  Returns query results in the requested format. The user must have read access to the document
  to download results. If the card's query fails, standard query error responses are returned.

  Route parameters:
  - document-id: ID of the document containing the card
  - card-id: ID of the card to download results from
  - export-format: Output format (csv, xlsx, json)

  Body parameters (snake_case):
  - parameters: Optional query parameters (array of maps or JSON string)
  - format_rows: Whether to apply formatting to results (boolean, default false)
  - pivot_results: Whether to pivot results (boolean, default false)

## Path parameters

- `document-id` integer, required
- `card-id` integer, required
- `export-format` string, required

## Request body

- object
  - `format_rows` boolean, required
  - `parameters` union
    - object[]
    - string — value must be a valid JSON string.
  - `pivot_results` boolean, required

## Response `2XX`

Successful response

## Other responses

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

---

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