---
title: "Create a Segment"
method: POST
path: "/v2/segments"
tags: ["Segments"]
---

# Create a Segment

`POST /v2/segments`

Create a Segment and add it to a Memory or a Document. A Segment is a source/target
pair that is used to train the machine translation system and populate
the translation memory.

The maximum source length is 5,000 characters.

## Request body

- object
  - `memory_id` integer — A unique Memory identifier.
  - `document_id` integer — A unique Document identifier.
  - `source` string, required — The source string.
  - `target` string — The target string.
  - `shouldApplySegmentation` boolean — A flag for whether this segment should be broken down into smaller segments. If this is true then the response is an array of segments.
  - `srcLang` string — A two letter language code for the source language. Required if `shouldApplySegmentation` is enabled.

## Response `200`

A Segment object.

- Segment — A Segment is a source string and, optionally, its translation. A Segment can be associated with both a Memory and a Document. The Segment object contains additional metadata about the source and target strings.
  - `id` integer — A unique number identifying the Segment.
  - `created_at` integer — Time at which the object was created. Measured in seconds since the Unix epoch.
  - `updated_at` integer — Time at which the object was created. Measured in seconds since the Unix epoch.
  - `document_id` integer — A unique Document identifier.
  - `memory_id` integer — The Memory with which this Segment is associated.
  - `source` string — The source string.
  - `srclang` string — An ISO 639-1 language code.
  - `target` string — The target string.
  - `trglang` string — An ISO 639-1 language code.
  - `is_confirmed` boolean — The confirmation status.
  - `is_reviewed` boolean — The review status.

## Other responses

- `default` — Unexpected error

---

[API](https://skmtc.net/lilt/apis/lilt-api.md) · [All operations](https://skmtc.net/lilt/apis/lilt-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lilt/lilt-api/revisions/444772351ac3/schema)
