---
title: "POST /api/dataset/pivot"
method: POST
path: "/api/dataset/pivot"
tags: ["/api/dataset"]
---

# POST /api/dataset/pivot

`POST /api/dataset/pivot`

Generate a pivoted dataset for an ad-hoc query

## Request body

- object
  - `database` integer, required — value must be an integer greater than zero.

## Response `2XX`

Successful response

- MetabaseQueryProcessorSchemaQueryResult — Schema for query execution results returned by the Query Processor.
  - `average_execution_time` integer, nullable
  - `cached` string, nullable
  - `context` unknown
  - `data` MetabaseQueryProcessorSchemaQueryResultData — Schema for the :data key of query results.
    - `cols` MetabaseQueryProcessorSchemaResultMetadataColumn[], required — unresolved $ref
    - `download_perms` string
    - `format-rows?` boolean
    - `insights` object[]
    - `is_sandboxed` boolean
    - `native_form` object
    - `results_metadata` object
      - `columns` MetabaseQueryProcessorSchemaResultMetadataColumn[], required — unresolved $ref
    - `results_timezone` string
    - `rows` array[], required
      - unknown[]
        - unknown
  - `database_id` integer — Valid Database ID
  - `error` string
  - `error_type` string
  - `json_query` object
  - `row_count` integer, required
  - `running_time` integer
  - `started_at` string
  - `status` 'completed' | 'failed', required

## Other responses

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

## Changes

- **2026-03-09** `78297d193ca4` — 2 info
  - api operation id `post-api-dataset-pivot` was added
  - added the media type `application/json` for the response with the status `2XX`

[Change history](https://skmtc.dev/metabase/apis/metabase-api/changes/api/dataset/pivot/post.md)

---

[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)
