---
title: "Post ML Model"
method: POST
path: "/ml"
tags: ["ML Models"]
---

# Post ML Model

`POST /ml`

## Request

- Base URL: `https://api.lytics.io/v2`
- URL: `https://api.lytics.io/v2/ml`
- Auth: API key in header `Authorization`

Create an ML Model

## Query parameters

- `account_id` string

## Request body `*/*`

- ModelsMLModel
  - `additional_data` object
  - `aid` integer
  - `author_id` string: Creator of the model
  - `config` ModelsModelConfig
    - `additional` string[]: Additional features to include in the model
    - `auto_tune` boolean: Automatically search through all data fields in Lytics and build the optimized model of the best fields
    - `blocked` string[]: Features to exclude from the model
    - `build_only` boolean: Train the model only, do not deploy
    - `collect` integer: Number of samples to collect for training
    - `internal` boolean: Internal Lytics model; not visible to users
    - `re_run` boolean: Re-train the model every week
    - `use_content` boolean: Use content affinities as features
    - `use_scores` boolean: Use behavioral scores as features
  - `created` string: Created timestamp
  - `description` string: Description for the model
  - `error` string: Error from model training; set to nil if no error or "building" if model is still training
  - `hidden` boolean: Model is hidden from the UI
  - `id` string: ID of the model
  - `is_active` boolean: Has model been promoted and deployed to users
  - `is_healthy` boolean: Model health
  - `label` string: Label for the model
  - `name` string: Name of the model
  - `source` string: Source segment ID of the model
  - `state` string: State of the model, "complete", "building", or "invalid"
  - `target` string: Target segment ID of the model
  - `type` string: Model algorithm chosen from automatic tuning; random forest (rf), logistic regression (lr), or gradient boosting machine (gbm)
  - `updated` string: Updated timestamp for re-training
  - `work_ids` string[]: Work IDs of the model; presence of multiple usually indicates an eval-only work, thus the model has been deployed at one point

## Response `201`

ML Model Response

- object
  - `_meta` object: Response Metadata
  - `data` object: Response Payload
    - `additional_data` object
    - `aid` integer
    - `author_id` string: Creator of the model
    - `config` ModelsModelConfig
      - `additional` string[]: Additional features to include in the model
      - `auto_tune` boolean: Automatically search through all data fields in Lytics and build the optimized model of the best fields
      - `blocked` string[]: Features to exclude from the model
      - `build_only` boolean: Train the model only, do not deploy
      - `collect` integer: Number of samples to collect for training
      - `internal` boolean: Internal Lytics model; not visible to users
      - `re_run` boolean: Re-train the model every week
      - `use_content` boolean: Use content affinities as features
      - `use_scores` boolean: Use behavioral scores as features
    - `created` string: Created timestamp
    - `description` string: Description for the model
    - `error` string: Error from model training; set to nil if no error or "building" if model is still training
    - `hidden` boolean: Model is hidden from the UI
    - `id` string: ID of the model
    - `is_active` boolean: Has model been promoted and deployed to users
    - `is_healthy` boolean: Model health
    - `label` string: Label for the model
    - `name` string: Name of the model
    - `source` string: Source segment ID of the model
    - `state` string: State of the model, "complete", "building", or "invalid"
    - `target` string: Target segment ID of the model
    - `type` string: Model algorithm chosen from automatic tuning; random forest (rf), logistic regression (lr), or gradient boosting machine (gbm)
    - `updated` string: Updated timestamp for re-training
    - `work_ids` string[]: Work IDs of the model; presence of multiple usually indicates an eval-only work, thus the model has been deployed at one point
  - `request_id` string
  - `status` integer: HTTP Status Code

## Other responses

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

## Changes

- **2026-11-03** `d8e975057aec`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/lytics/apis/lytics-api/changes/ml/post.md)

---

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