Cancel orders in bulk

The Orders API supports two bulk-cancel methods:

  1. Bulk cancel all queued orders.
  2. Bulk cancel a specified list of order_ids.

Bulk cancel queued orders

To cancel all of your queued orders, POST an empty JSON object ({}) to https://api.planet.com/compute/ops/bulk/orders/v2/cancel.

Example request

POST https://api.planet.com/compute/ops/bulk/orders/v2/cancel

{}

Example response

The response includes a count of the orders that were canceled and any that failed to cancel.

{
  "result": {
    "failed": {
      "count": 0,
      "failures": []
    },
    "succeeded": {
      "count": 6
    }
  }
}

Note: Because the ordering system is asynchronous, some orders that are queued when you send the request might transition to a running state and become non-cancellable. Planet cannot guarantee that 100% of queued orders are canceled.

Bulk cancel specified orders

To cancel a specific set of orders, POST an array of order_ids to https://api.planet.com/compute/ops/bulk/orders/v2/cancel.

Example request

POST https://api.planet.com/compute/ops/bulk/orders/v2/cancel

{
  "order_ids": [
    "<order_id_1>",
    "<order_id_2>",
    "<order_id_3>",
    "<order_id_4>",
    "<order_id_5>",
    "<order_id_6>"
  ]
}

Example response

{
  "result": {
    "failed": {
      "count": 2,
      "failures": [
        {
          "message": "Order not in a cancellable state",
          "order_id": "<order_id_5>"
        },
        {
          "message": "Order not in a cancellable state",
          "order_id": "<order_id_6>"
        }
      ]
    },
    "succeeded": {
      "count": 4
    }
  }
}

In the response above, two of the six orders failed to cancel.

Related articles

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.