# 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.1 info: title: Batch Cancel Shipments version: endpoint_orders.batchCancelShipments 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: {} '403': description: No access content: {} '422': description: Client Error content: {} '500': description: Server Error content: {} requestBody: description: The shipment IDs to cancel content: application/json: schema: $ref: '#/components/schemas/Orders.CancelShipmentsModel' components: schemas: Orders.CancelShipmentsModel: type: object properties: shipment_ids: type: - array - 'null' items: type: integer description: Shipment IDs to cancel Orders.ShipmentAction: type: string enum: - value: CleanSweep - value: Reassign - value: ReleaseOrderHold - value: MoveToOnHoldAndKeepInventory - value: MoveToOnHoldAndReleaseInventory - value: Cancel - value: AddLineItem - value: RemoveLineItem - value: UpdateShipOption 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 Orders.CanceledShipmentsViewModel: type: object properties: results: type: - array - 'null' items: $ref: '#/components/schemas/Orders.CanceledShipmentViewModel' description: The results of all cancellation actions ``` ## 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 ", "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 ', '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 ") 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 ' 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 response = Unirest.post("https://api.shipbob.com/2026-01/shipment:batchCancel") .header("shipbob_channel_id", "shipbob_channel_id") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"shipment_ids\": [\n 0\n ]\n}") .asString(); ``` ```php Orders_batchCancelShipments_example request('POST', 'https://api.shipbob.com/2026-01/shipment:batchCancel', [ 'body' => '{ "shipment_ids": [ 0 ] }', 'headers' => [ 'Authorization' => 'Bearer ', '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 "); 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 ", "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() ```