---
title: "Updates a segment details"
method: PATCH
path: "/shipments/v4/{shipmentId}/{segmentId}"
tags: ["Shipments"]
---

# Updates a segment details

`PATCH /shipments/v4/{shipmentId}/{segmentId}`

Updates details of a segment identified by the `segmentId`.

This is a partial update, meaning that only the provided fields
will be updated.

Changing the status of a segment affects the statuses of other segments in the shipment. The
following status changes are allowed:
* `pending` → `ongoing`
  * changes previous `pending` segments to `cancelled`
  * changes previous `ongoing` segment to `completed` (only for the immediate predecessor of
    this segment)
  * changes previous `ongoing` segment to `cancelled` (for segments that are not immediate
    predecessors of this segment)
  * previous segments in `cancelled` or `completed` states are not affected
* `pending` || `ongoing` → `cancelled`
  * no changes for other segments
* `ongoing` → `completed`
  * next segment with status `pending` is changed to `ongoing`

***Note***:
`trackingId` can be updated through this API call only if the segment is in `pending` state.

## Request body

- object — A segment of a shipment.
  - `description` string — Description of the segment
  - `name` string — Name of the segment
  - `providedEta` string, date-time — ETA for the segment
  - `providedEtd` string, date-time — ETD for the segment
  - `status` 'pending' | 'ongoing' | 'completed' | 'cancelled' — Status of the segment
  - `trackingId` string — ID of the tracking device that produces data for the segment
  - `transportMode` 'car' | 'truck' | 'sea' | 'air' | 'undefined' — Transport mode of the segment

## Response `204`

Successful (no content)

The segment information was updated

## Other responses

- `400` — Bad request The request object is in an incorrect format or has values that are invalid or out of range. If available, further error details are provided in the response body.
- `401` — Unauthorized The request did not provide correct authentication details
- `403` — Forbidden The account does not have the correct privileges
- `404` — Not Found The specified resource was not found

---

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