---
title: "Create datamodel"
method: POST
path: "/datamodel"
tags: ["DataModels"]
---

# Create datamodel

`POST /datamodel`

Create a datamodel

## Query parameters

- `account_id` string

## Response `201`

DataModel Response

- object
  - `_meta` object — Response Metadata
  - `data` object — Response Payload
    - `account_id` string
    - `activated_fields` string[]
    - `aid` integer
    - `anomaly_rule` ModelsAnomalyRuleResp
      - `aid` integer
      - `checks` ModelsRuleCheckConfigReq[]
        - `allowable_violations` integer
        - `interval` string
        - `lookback_count` integer
        - `max_threshold` integer
        - `metric_type` string
        - `min_threshold` integer
        - `type` string
        - `variance_pct` number
      - `created` string
      - `id` string
      - `subject_id` string
      - `subject_type` string
      - `updated` string
    - `author_id` string
    - `connection_id` string
    - `contextual_data` string[]
    - `create_profiles` boolean
    - `created` string
    - `deleted` boolean
    - `description` string
    - `health` ModelsDataModelHealth
      - `details` string
      - `status` string
    - `id` string
    - `is_draft` boolean
    - `joined_to` ModelsDataModelJoin
      - `foreign_key` string
      - `foreign_table` string
      - `primary_key` string
    - `name` string
    - `needs_backfill` boolean
    - `primary_keys` string[]
    - `schedule` ModelsSyncSchedule
      - `next_sync_time` string
      - `prev_sync_time` string
      - `sync_period` integer
    - `size` integer
    - `slug` string
    - `sql` string
    - `status` string
    - `sync_errors` ModelsSyncError[]
      - `error` string
      - `time` string
    - `table` string
    - `updated` string
  - `request_id` string
  - `status` integer — HTTP Status Code

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/lytics/apis/lytics-api.md) · [All operations](https://skmtc.net/lytics/apis/lytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lytics/lytics-api/versions/366eeabcb6de/schema)
