---
title: "Edit TM Segment"
method: PATCH
path: "/tms/{tmId}/segments/{segmentId}"
tags: ["Translation Memory"]
---

# Edit TM Segment

`PATCH /tms/{tmId}/segments/{segmentId}`

## Request

- Base URL: `https://api.crowdin.com/api/v2`
- URL: `https://api.crowdin.com/api/v2/tms/{tmId}/segments/{segmentId}`
- Auth: none declared
- TypeScript: <https://skmtc.dev/crowdin/apis/crowdin-api-v2/docs/tms/:tmId/segments/:segmentId/patch.ts> (a function with typed inputs; its response is checked against the schema)

**Required scopes:** `tm` (Read and Write).

Edit segment of translation unit

## Path parameters

- `tmId` integer, required
- `segmentId` integer, required

## Request body

- TmSegmentOperation[]: A JSON Patch document as defined by <a href="https://tools.ietf.org/html/rfc6902#section-3" target="_blank">RFC 6902</a>
  - `op` 'add' | 'replace' | 'remove', required: Patch operation to perform
  - `path` '/records/-' | '/records/{recordId}/text' | '/records/{recordId}', json-pointer, required: A JSON Pointer as defined by <a href="https://tools.ietf.org/html/rfc6901" target="_blank">RFC 6901</a>

## Response `200`

TM segment record was successfully updated

- TmSegmentResource: Base schema of resource container. Container is a wrapper object that contains payload in required `data` property and provides space for adding any other metadata.
  - `data` TmSegment, required
    - `id` integer: Segment Identifier
    - `records` object[]
      - `id` integer: Record Identifier
      - `languageId` string: Language Identifier
      - `text` string: Record text
      - `usageCount` integer: Count usage of segment record
      - `createdBy` integer: Creator User Identifier
      - `updatedBy` integer: Redactor User Identifier
      - `createdAt` string, date-time, nullable: Date in UTC, ISO 8601
      - `updatedAt` string, date-time, nullable: Date in UTC, ISO 8601

## Other responses

- `204`: TM segment was successfully deleted
- `400`: Invalid Request Parameters
- `401`: Unauthorized
- `403`: Forbidden
- `404`: TM or segment with specified id was not found
- `405`: Method Not Allowed

---

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