---
title: "Creates a new data table."
method: POST
path: "/datatables"
tags: ["DataTables"]
---

# Creates a new data table.

`POST /datatables`

## Request

- Base URL: `https://api.reveldigital.com`
- URL: `https://api.reveldigital.com/datatables`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://id.reveldigital.com/connect/authorize`
    - Token URL: `https://id.reveldigital.com/connect/token` scopes: `webapi`
  - API key in header `X-RevelDigital-ApiKey`
  - API key in query parameter `api_key`
- TypeScript: <https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/docs/datatables/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- CreateDataTableRequest
  - `name` string, required
  - `description` string, nullable
  - `groupId` string, nullable
  - `columns` DataTableColumnModel[], required
    - `id` string, nullable
    - `name` string, required
    - `key` string, required
    - `type` 'string' | 'number' | 'boolean' | 'date' | 'select' | 'media' | 'url' | 'richtext' | 'time' | 'hidden', required
    - `required` boolean
    - `sortable` boolean
    - `locked` boolean
    - `options` string[], nullable
    - `default` unknown
  - `cacheTtlSeconds` integer, nullable

## Response `201`

Created

- DataTableDetail
  - `id` string, nullable
  - `name` string, nullable
  - `description` string, nullable
  - `columns` DataTableColumnModel[], nullable
    - `id` string, nullable
    - `name` string, required
    - `key` string, required
    - `type` 'string' | 'number' | 'boolean' | 'date' | 'select' | 'media' | 'url' | 'richtext' | 'time' | 'hidden', required
    - `required` boolean
    - `sortable` boolean
    - `locked` boolean
    - `options` string[], nullable
    - `default` unknown
  - `groupId` string, nullable
  - `rowCount` integer
  - `cacheTtlSeconds` integer, nullable
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

## Other responses

- `400`: Bad Request

---

[API](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api.md) - [All operations](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/revisions/39d5c8302822?raw)
