> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.leanmile.com/llms.txt.
> For full documentation content, see https://api.leanmile.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.leanmile.com/_mcp/server.

# Truncate all shipment parcels

PUT https://v1/shipment/{documentNumber}/truncate

• Truncate Shipment endpoint can be used to remove all parcels from shipment for any reason  
• Shipment can be truncated until it has arrived to terminal  
• If shipment is truncated after „Finish“, then after adding parcels, shipment needs to be finished again (see below „Flow for truncating shipment after finishing shipment“)

Reference: https://api.leanmile.com/otp-cc-flow/1-shipments/truncate-all-shipment-parcels

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OTP CC Flow
  version: 1.0.0
paths:
  /v1/shipment/{documentNumber}/truncate:
    put:
      operationId: truncate-all-shipment-parcels
      summary: Truncate all shipment parcels
      description: >-
        • Truncate Shipment endpoint can be used to remove all parcels from
        shipment for any reason  

        • Shipment can be truncated until it has arrived to terminal  

        • If shipment is truncated after „Finish“, then after adding parcels,
        shipment needs to be finished again (see below „Flow for truncating
        shipment after finishing shipment“)
      tags:
        - subpackage_1Shipments
      parameters:
        - name: documentNumber
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/1. Shipments_Truncate all shipment
                  parcels_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PutV1ShipmentDocumentnumberTruncateRequestBadRequestError
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PutV1ShipmentDocumentnumberTruncateRequestUnauthorizedError
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PutV1ShipmentDocumentnumberTruncateRequestForbiddenError
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PutV1ShipmentDocumentnumberTruncateRequestNotFoundError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PutV1ShipmentDocumentnumberTruncateRequestInternalServerError
servers:
  - url: https:/
    description: https://{baseurl}
components:
  schemas:
    V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        nullable:
          type: boolean
        readOnly:
          type: boolean
      required:
        - nullable
        - readOnly
      title: >-
        V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
    1. Shipments_Truncate all shipment parcels_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: 1. Shipments_Truncate all shipment parcels_Response_200
    PutV1ShipmentDocumentnumberTruncateRequestBadRequestError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: PutV1ShipmentDocumentnumberTruncateRequestBadRequestError
    PutV1ShipmentDocumentnumberTruncateRequestUnauthorizedError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: PutV1ShipmentDocumentnumberTruncateRequestUnauthorizedError
    PutV1ShipmentDocumentnumberTruncateRequestForbiddenError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: PutV1ShipmentDocumentnumberTruncateRequestForbiddenError
    PutV1ShipmentDocumentnumberTruncateRequestNotFoundError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: PutV1ShipmentDocumentnumberTruncateRequestNotFoundError
    PutV1ShipmentDocumentnumberTruncateRequestInternalServerError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberTruncatePutResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: PutV1ShipmentDocumentnumberTruncateRequestInternalServerError
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "nullable": true,
    "readOnly": true
  },
  "status": "success",
  "message": "Shipment parcels have been successfully truncated.",
  "statusCode": "200",
  "internalReference": "SHIP-TRUNC-20240612-987654"
}
```

**SDK Code**

```python 1. Shipments_Truncate all shipment parcels_example
import requests

url = "https://https/v1/shipment/%3Cstring%3E/truncate"

payload = {}
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript 1. Shipments_Truncate all shipment parcels_example
const url = 'https://https/v1/shipment/%3Cstring%3E/truncate';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'PUT',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 1. Shipments_Truncate all shipment parcels_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/v1/shipment/%3Cstring%3E/truncate"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 1. Shipments_Truncate all shipment parcels_example
require 'uri'
require 'net/http'

url = URI("https://https/v1/shipment/%3Cstring%3E/truncate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java 1. Shipments_Truncate all shipment parcels_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://https/v1/shipment/%3Cstring%3E/truncate")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php 1. Shipments_Truncate all shipment parcels_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://https/v1/shipment/%3Cstring%3E/truncate', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp 1. Shipments_Truncate all shipment parcels_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://https/v1/shipment/%3Cstring%3E/truncate");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 1. Shipments_Truncate all shipment parcels_example
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/v1/shipment/%3Cstring%3E/truncate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```