---
title: Batch withdraw orders
description: Withdraw up to 100 submitted orders back to draft in one request.
  An order that has already been added to a route can no longer be withdrawn.
  Always returns `200`; per-order outcomes are split across `success` and
  `failed`.
url: /api/orders/withdrawOrders
---

# Batch withdraw orders

`POST /orders:withdraw`

````yaml
openapi: 3.2.0
info:
  title: Spoke Connect API
  version: v1
servers:
  - url: https://api.spoke.com/connect/v1
security:
  - BearerAuth: []
  - BasicAuth: []
paths:
  /orders:withdraw:
    post:
      operationId: withdrawOrders
      summary: Batch withdraw orders
      tags:
        - Orders
      description: Withdraw up to 100 submitted orders back to draft in one request. An order that has already been added to a route can no longer be withdrawn. Always returns `200`; per-order outcomes are split across `success` and `failed`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                orderIds:
                  minItems: 1
                  maxItems: 100
                  type: array
                  items:
                    type: string
                    pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
                    description: Unique identifier of an order, in the format `orders/{id}`.
                  description: The orders to withdraw. At most 100 per request.
              required:
                - orderIds
              additionalProperties: false
              description: Input shape accepted by `POST /orders:withdraw`.
        required: true
        description: Input shape accepted by `POST /orders:withdraw`.
      responses:
        "200":
          description: The per-order results. Always returned when the request itself is valid, even when every order fails.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: array
                    items:
                      type: string
                      pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
                      description: Unique identifier of an order, in the format `orders/{id}`.
                    description: The ids of the orders withdrawn successfully.
                  failed:
                    type: array
                    items:
                      type: object
                      properties:
                        orderId:
                          type: string
                          pattern: ^orders\/[a-zA-Z0-9_-]{1,50}$
                          description: The order id the failure applies to.
                        error:
                          type: object
                          properties:
                            code:
                              anyOf:
                                - type: string
                                  enum:
                                    - order_not_submitted
                                    - order_already_scheduled
                                    - order_not_found
                                    - order_no_courier_link
                                    - order_courier_managed
                                    - order_paid
                                    - order_read_only
                                    - order_concurrent_modification
                                - type: string
                              description: The public error code.
                            message:
                              type: string
                              description: A human-readable error message.
                          required:
                            - code
                            - message
                          additionalProperties: false
                          description: "Why the order was not withdrawn: a stable public code plus a human-readable message."
                      required:
                        - orderId
                        - error
                      additionalProperties: false
                    description: The order ids that failed, each with the public error code.
                required:
                  - success
                  - failed
                additionalProperties: false
                description: The per-order results. Always returned when the request itself is valid, even when every order fails.
        "400":
          description: The request is invalid, for example more than 100 orders.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The request is invalid, for example more than 100 orders.
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: Unauthorized
        "500":
          description: An internal server error occurred
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: An internal server error occurred
        default:
          description: The default error model
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    description: The error code.
                  param:
                    type: string
                    description: The parameter that caused the error.
                  url:
                    type: string
                    description: The URL with more information about the error.
                required:
                  - message
                description: The default error model
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Pass the API key directly as the token.
    BasicAuth:
      type: http
      scheme: basic
      description: Use the API key as the username and leave the password empty.
````