---
title: "Generate transformed data preview"
method: POST
path: "/_api/transformations/preview"
tags: ["Connections"]
---

# Generate transformed data preview

`POST /_api/transformations/preview`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_api/transformations/preview/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate a preview of the data after the transformation. The preview is generated based on a sample data set from the data source.
You can use [get connector sample API](#/Connections/retrieveSample) to retrieve a sample dataset from the data source.

## Request body

- object
  - `query` string: Transformation query.
  - `inputSchema` ConnectorSchema: Model to encapsulate properties of a schema from a connector.
    - `name` string: Name of the schema.
    - `attributes` SchemaAttribute[]: Attributes of the schema.
      - `name` string: Name of the attribute.
      - `type` string: Type of the attribute.
  - `outputSchema` ConnectorSchema: Model to encapsulate properties of a schema from a connector.
    - `name` string: Name of the schema.
    - `attributes` SchemaAttribute[]: Attributes of the schema.
      - `name` string: Name of the attribute.
      - `type` string: Type of the attribute.
  - `data` object[]: Sample dataset from the data source.

## Response `200`

Successfully generated the transformation preview.

- object
  - `error` boolean, required
  - `code` integer
  - `result` ConnectorSample: Model to encapsulate properties of a sample from a connector.
    - `schema` ConnectorSchema: Model to encapsulate properties of a schema from a connector.
      - `name` string: Name of the schema.
      - `attributes` SchemaAttribute[]: Attributes of the schema.
        - `name` string: Name of the attribute.
        - `type` string: Type of the attribute.
    - `data` object[]: Sample records for the connector.

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `401`: Failed to authenticate the request.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
