---
title: "SegmentML Create"
method: POST
path: "/api/segmentml"
tags: ["SegmentML"]
---

# SegmentML Create

`POST /api/segmentml`

## Request

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

Create a new SegmentML model.

Model configuration can be specified either through sending the options
as a flat JSON object POST body or through URL parameters on the request.

```sh
# Curl example of creating a SegmentML model
curl -s -J -XPOST "https://api.lytics.io/api/segmentml" -H "Authorization: $LIOKEY" -d '
{
    "source": "all",
    "target": "smt_power",
    "use_scores": true
}
'
```

## Query parameters

- `account_id` string
- `source` string, required
- `target` string
- `use_scores` boolean
- `target_field` string
- `use_content` boolean
- `aspect_collections` string
- `additional_fields` string
- `model_only` boolean
- `eval_only` boolean
- `auto_tune` boolean
- `tune_model` boolean
- `tags` string
- `re_run` boolean
- `save_segments` boolean
- `as_is` boolean
- `num_to_train` number
- `cor_threshold` number

## Response `201`

Created

- SegmentMLModel
  - `name` string
  - `state` string
  - `reason` string
  - `created` string
  - `conf` object
    - `source` object
      - `aid` number
      - `account_id` string
      - `id` string
      - `name` string
      - `is_public` boolean
      - `slug_name` string
      - `description` string
      - `author_id` string
      - `updated` string
      - `created` string
      - `invalid` boolean
      - `invalid_reason` string
      - `deleted` boolean
      - `datemath_calc` boolean
      - `forward_datemath` boolean
      - `save_hist` boolean
      - `schedule_exit` boolean
      - `tags` unknown
    - `target` object
      - `aid` number
      - `account_id` string
      - `id` string
      - `name` string
      - `is_public` boolean
      - `slug_name` string
      - `description` string
      - `author_id` string
      - `updated` string
      - `created` string
      - `invalid` boolean
      - `invalid_reason` string
      - `deleted` boolean
      - `datemath_calc` boolean
      - `forward_datemath` boolean
      - `save_hist` boolean
      - `schedule_exit` boolean
      - `tags` unknown
    - `target_field` unknown
    - `model_name` string
    - `additional` unknown
    - `collections` unknown
    - `collect` number
    - `use_scores` boolean
    - `use_content` boolean
    - `build_only` boolean
    - `auto_tune` boolean

---

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