For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://developer.shipbob.com/api/orders/llms.txt. For full documentation content, see https://developer.shipbob.com/api/orders/llms-full.txt.

# Batch Cancel Shipments

POST https://api.shipbob.com/2026-01/shipment:batchCancel
Content-Type: application/json

Cancels multiple shipments in a single request. Shipments can only be cancelled if they are in a cancellable state (i.e. not picked, packed, or shipped yet).

Reference: https://developer.shipbob.com/api/orders/batch-cancel-shipments

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: api-2026-01
  version: 1.0.0
paths:
  /2026-01/shipment:batchCancel:
    post:
      operationId: batch-cancel-shipments
      summary: Batch Cancel Shipments
      description: >-
        Cancels multiple shipments in a single request. Shipments can only be
        cancelled if they are in a cancellable state (i.e. not picked, packed,
        or shipped yet).
      tags:
        - subpackage_orders
      parameters:
        - name: Authorization
          in: header
          description: Authentication using Personal Access Token (PAT) token or OAuth2
          required: true
          schema:
            type: string
        - name: shipbob_channel_id
          in: header
          description: >-
            Retrieve your channel ID from the [GET
            /channel](/api/channels/get-channels) endpoint. Use the channel ID
            that has write scopes.
          required: true
          schema:
            type: string
            format: int32
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Orders.CanceledShipmentsViewModel'
        '401':
          description: No access right at this time
          content:
            application/json:
              schema:
                description: Any type
        '403':
          description: No access
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Orders.Post.Api.Shipment.Cancelbulk.Unprocessable.Entity.Object
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Orders.Post.Api.Shipment.Cancelbulk.Internal.Server.Error.Object
      requestBody:
        description: The shipment IDs to cancel
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Orders.CancelShipmentsModel'
servers:
  - url: https://api.shipbob.com
  - url: https://sandbox-api.shipbob.com
components:
  schemas:
    Orders.CancelShipmentsModel:
      type: object
      properties:
        shipment_ids:
          type:
            - array
            - 'null'
          items:
            type: integer
          description: Shipment IDs to cancel
      description: Model for cancel multiple shipments at once
      title: Orders.CancelShipmentsModel
    Orders.ShipmentAction:
      type: string
      enum:
        - CleanSweep
        - Reassign
        - ReleaseOrderHold
        - MoveToOnHoldAndKeepInventory
        - MoveToOnHoldAndReleaseInventory
        - Cancel
        - AddLineItem
        - RemoveLineItem
        - UpdateShipOption
      title: Orders.ShipmentAction
    Orders.CanceledShipmentViewModel:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/Orders.ShipmentAction'
        is_success:
          type: boolean
          description: If the cancel action was successful
        reason:
          type:
            - string
            - 'null'
          description: The reason the cancellation result
        shipment_id:
          type: integer
          format: int64
          description: The ID of the shipment
      title: Orders.CanceledShipmentViewModel
    Orders.CanceledShipmentsViewModel:
      type: object
      properties:
        results:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Orders.CanceledShipmentViewModel'
          description: The results of all cancellation actions
      title: Orders.CanceledShipmentsViewModel
    Orders.Post.Api.Shipment.Cancelbulk.Unprocessable.Entity.Object:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
      title: Orders.Post.Api.Shipment.Cancelbulk.Unprocessable.Entity.Object
    Orders.Post.Api.Shipment.Cancelbulk.Internal.Server.Error.Object:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
      title: Orders.Post.Api.Shipment.Cancelbulk.Internal.Server.Error.Object
  securitySchemes:
    PAT:
      type: http
      scheme: bearer
      description: Authentication using Personal Access Token (PAT) token or OAuth2

```

## SDK Code Examples

```python Orders_batchCancelShipments_example
import requests

url = "https://api.shipbob.com/2026-01/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_batchCancelShipments_example
const url = 'https://api.shipbob.com/2026-01/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_batchCancelShipments_example
package main

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

func main() {

	url := "https://api.shipbob.com/2026-01/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_batchCancelShipments_example
require 'uri'
require 'net/http'

url = URI("https://api.shipbob.com/2026-01/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_batchCancelShipments_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.shipbob.com/2026-01/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_batchCancelShipments_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.shipbob.com/2026-01/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_batchCancelShipments_example
using RestSharp;

var client = new RestClient("https://api.shipbob.com/2026-01/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_batchCancelShipments_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/2026-01/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()
```