> 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.

# Delete parcels from specified shipment

DELETE https://v1/shipment/{documentNumber}/parcels
Content-Type: application/json

• DELETE Parcels endpoint is used to delete parcels explixitly from shipment  
• Parcels can be deleted only until shipment is finished (confirmed). After shipment is finished, it is not allowed to delete parcels.

Reference: https://api.leanmile.com/otp-cc-flow/1-shipments/delete-parcels-from-specified-shipment

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OTP CC Flow
  version: 1.0.0
paths:
  /v1/shipment/{documentNumber}/parcels:
    delete:
      operationId: delete-parcels-from-specified-shipment
      summary: Delete parcels from specified shipment
      description: >-
        • DELETE Parcels endpoint is used to delete parcels explixitly from
        shipment  

        • Parcels can be deleted only until shipment is finished (confirmed).
        After shipment is finished, it is not allowed to delete parcels.
      tags:
        - subpackage_1Shipments
      parameters:
        - name: documentNumber
          in: path
          required: true
          schema:
            type: string
        - name: reqId
          in: query
          required: false
          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_Delete parcels from
                  specified shipment_Response_200
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DeleteV1ShipmentDocumentnumberParcelsRequestUnauthorizedError
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
servers:
  - url: https:/
    description: https://{baseurl}
components:
  schemas:
    V1ShipmentDocumentNumberParcelsDeleteResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        nullable:
          type: boolean
        readOnly:
          type: boolean
      required:
        - nullable
        - readOnly
      title: >-
        V1ShipmentDocumentNumberParcelsDeleteResponsesContentApplicationJsonSchemaData
    1. Shipments_Delete parcels from specified shipment_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberParcelsDeleteResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: integer
      required:
        - data
        - status
        - message
        - statusCode
      title: 1. Shipments_Delete parcels from specified shipment_Response_200
    DeleteV1ShipmentDocumentnumberParcelsRequestUnauthorizedError:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/V1ShipmentDocumentNumberParcelsDeleteResponsesContentApplicationJsonSchemaData
        status:
          type: string
        message:
          type: string
        statusCode:
          type: string
        internalReference:
          type: string
      required:
        - data
        - status
        - message
        - statusCode
        - internalReference
      title: DeleteV1ShipmentDocumentnumberParcelsRequestUnauthorizedError
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

```

## Examples



**Request**

```json
[
  "1",
  "2"
]
```

**Response**

```json
{
  "data": {
    "parcelsDeleted": 2,
    "parcelsRequested": 2,
    "invalidParcelsDeleted": 0
  },
  "status": "OK",
  "message": "OK",
  "statusCode": 200
}
```

**SDK Code**

```python 1. Shipments_Delete parcels from specified shipment_example
import requests

url = "https://https/v1/shipment/123-00000000/parcels"

querystring = {"reqId":"{{$guid}}"}

payload = ["1", "2"]
headers = {
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 1. Shipments_Delete parcels from specified shipment_example
const url = 'https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'DELETE',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '["1","2"]'
};

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

```go 1. Shipments_Delete parcels from specified shipment_example
package main

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

func main() {

	url := "https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D"

	payload := strings.NewReader("[\n  \"1\",\n  \"2\"\n]")

	req, _ := http.NewRequest("DELETE", 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_Delete parcels from specified shipment_example
require 'uri'
require 'net/http'

url = URI("https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D")

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

request = Net::HTTP::Delete.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "[\n  \"1\",\n  \"2\"\n]"

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

```java 1. Shipments_Delete parcels from specified shipment_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("[\n  \"1\",\n  \"2\"\n]")
  .asString();
```

```php 1. Shipments_Delete parcels from specified shipment_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D', [
  'body' => '[
  "1",
  "2"
]',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp 1. Shipments_Delete parcels from specified shipment_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.DELETE);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  \"1\",\n  \"2\"\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 1. Shipments_Delete parcels from specified shipment_example
import Foundation

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

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://https/v1/shipment/123-00000000/parcels?reqId=%7B%7B%24guid%7D%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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()
```