---
title: "Create Parametric Table"
method: POST
path: "/data/projects/{projectId}/catalogs/{catalogId}/parametricTables"
tags: ["Data -- Parametric Tables"]
---

# Create Parametric Table

`POST /data/projects/{projectId}/catalogs/{catalogId}/parametricTables`

## Request

- Base URL: `https://partner.peaka.studio/api/v1`
- URL: `https://partner.peaka.studio/api/v1/data/projects/{projectId}/catalogs/{catalogId}/parametricTables`
- Auth: HTTP bearer

Creates a new Parametric Table under the specified catalog. A Parametric Table binds specific query parameter values to a source table from a REST catalog, producing a new named table (e.g., `xyz_customers`) that can be queried directly without supplying those parameters at query time. For example, if the source table `customers` requires a `_q_account` parameter, you can create a Parametric Table that fixes this value and exposes the result as a standalone table.

Date and timestamp parameters also accept **relative-date macros**, re-evaluated on every query, so a table saved as "this week's sales" always returns the current week. Grammar: `@<anchor>[(+|-)<n><unit>]`

- Anchors: `@today`, `@yesterday`, `@now` (current instant), `@sow` / `@eow` (week, Monday start), `@som` / `@eom` (month), `@soq` / `@eoq` (quarter), `@soy` / `@eoy` (year)
- Units: `d` day, `w` week, `M` month, `q` quarter, `y` year, `h` hour, `m` minute (lowercase `m` is minute, uppercase `M` is month)
- Offsets can be chained: `@today-7d`, `@som-1M`, `@now-24h`
- Whitelisted Trino date expressions (e.g. `date_trunc('month', current_date)`) are accepted as well

## Path parameters

- `projectId` string, required
- `catalogId` string, required

## Request body

- ParametricTable
  - `fromSchema` string: Schema of the base table
  - `fromTable` string: Name of the base table
  - `toSchema` string: Schema of the target table
  - `toTable` string: Name of the target table
  - `paramValues` ParametricTableColumn[]: List of parametric columns
    - `key` string: Column name
    - `value` object: Column value

## Response `200`

Parametric table created successfully

- ParametricTable
  - `fromSchema` string: Schema of the base table
  - `fromTable` string: Name of the base table
  - `toSchema` string: Schema of the target table
  - `toTable` string: Name of the target table
  - `paramValues` ParametricTableColumn[]: List of parametric columns
    - `key` string: Column name
    - `value` object: Column value

## Other responses

- `400`: Target table already exists

---

[API](https://skmtc.dev/peaka/apis/peaka-gateway-api.md) · [All operations](https://skmtc.dev/peaka/apis/peaka-gateway-api/llms.txt) · [OpenAPI document](https://skmtc.dev/peaka/apis/peaka-gateway-api/revisions/e68b033a22d5?raw)
