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

# Cancel multiple Shipments by Shipment Id

POST https://api.shipbob.com/2025-07/shipment:batchCancel
Content-Type: application/json

Reference: https://developer.shipbob.com/2025-07/api/orders/cancel-multiple-shipments-by-shipment-id

## Authentication

- `Authorization` header (bearer token, required) — Authentication using Personal Access Token (PAT) token
- `Authorization` header (bearer token, required) — OAuth2 authentication using JWT tokens

## Servers

- `https://api.shipbob.com` (https://api.shipbob.com, default)
- `https://sandbox-api.shipbob.com` (https://sandbox-api.shipbob.com)

## Request

### Headers

- `shipbob_channel_id` (string, required) — Channel ID for Operation

### Body (application/json)

- `shipment_ids` (list of integer, optional, nullable) — Shipment IDs to cancel

## Response

### 200

Success

- `results` (list of object, optional, nullable) — The results of all cancellation actions
  - `action` (enum, optional)
    - Allowed values: `CleanSweep`, `Reassign`, `ReleaseOrderHold`, `MoveToOnHoldAndKeepInventory`, `MoveToOnHoldAndReleaseInventory`, `Cancel`, `AddLineItem`, `RemoveLineItem`, `UpdateShipOption`
  - `is_success` (boolean, optional) — If the cancel action was successful
  - `reason` (string, optional, nullable) — The reason the cancellation result
  - `shipment_id` (long, optional) — The ID of the shipment

## Examples

**Request**

```json
{
  "shipment_ids": [
    0
  ]
}
```

**Response**

```json
{
  "results": [
    {
      "action": "Cancel",
      "is_success": true,
      "reason": "string",
      "shipment_id": 0
    }
  ]
}
```

**SDK Code**

```python Orders_cancelMultipleShipmentsByShipmentId_example
import requests

url = "https://api.shipbob.com/2025-07/shipment:batchCancel"

payload = { "shipment_ids": [0] }
headers = {
    "shipbob_channel_id": "shipbob_channel_id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Orders_cancelMultipleShipmentsByShipmentId_example
const url = 'https://api.shipbob.com/2025-07/shipment:batchCancel';
const options = {
  method: 'POST',
  headers: {
    shipbob_channel_id: 'shipbob_channel_id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"shipment_ids":[0]}'
};

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

```go Orders_cancelMultipleShipmentsByShipmentId_example
package main

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

func main() {

	url := "https://api.shipbob.com/2025-07/shipment:batchCancel"

	payload := strings.NewReader("{\n  \"shipment_ids\": [\n    0\n  ]\n}")

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

	req.Header.Add("shipbob_channel_id", "shipbob_channel_id")
	req.Header.Add("Authorization", "Bearer <token>")
	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 Orders_cancelMultipleShipmentsByShipmentId_example
require 'uri'
require 'net/http'

url = URI("https://api.shipbob.com/2025-07/shipment:batchCancel")

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

request = Net::HTTP::Post.new(url)
request["shipbob_channel_id"] = 'shipbob_channel_id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"shipment_ids\": [\n    0\n  ]\n}"

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

```java Orders_cancelMultipleShipmentsByShipmentId_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.shipbob.com/2025-07/shipment:batchCancel")
  .header("shipbob_channel_id", "shipbob_channel_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"shipment_ids\": [\n    0\n  ]\n}")
  .asString();
```

```php Orders_cancelMultipleShipmentsByShipmentId_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.shipbob.com/2025-07/shipment:batchCancel', [
  'body' => '{
  "shipment_ids": [
    0
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'shipbob_channel_id' => 'shipbob_channel_id',
  ],
]);

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

```csharp Orders_cancelMultipleShipmentsByShipmentId_example
using RestSharp;

var client = new RestClient("https://api.shipbob.com/2025-07/shipment:batchCancel");
var request = new RestRequest(Method.POST);
request.AddHeader("shipbob_channel_id", "shipbob_channel_id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"shipment_ids\": [\n    0\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Orders_cancelMultipleShipmentsByShipmentId_example
import Foundation

let headers = [
  "shipbob_channel_id": "shipbob_channel_id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["shipment_ids": [0]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.shipbob.com/2025-07/shipment:batchCancel")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```