---
title: Delete an order
description: "Delete an order for the authenticated retailer. Only a draft order
  can be deleted: a submitted order must be withdrawn first, and a read-only
  order (added by the courier, or already on a route) cannot be deleted."
url: /api/orders/deleteOrder
---

# Delete an order

`DELETE /orders/{id}`

````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/{id}:
    delete:
      operationId: deleteOrder
      summary: Delete an order
      tags:
        - Orders
      description: "Delete an order for the authenticated retailer. Only a draft order can be deleted: a submitted order must be withdrawn first, and a read-only order (added by the courier, or already on a route) cannot be deleted."
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 50
            pattern: ^[a-zA-Z0-9_-]{1,50}$
          in: path
          name: id
          required: true
          description: The Spoke order ID.
      responses:
        "204":
          description: The order was deleted.
        "400":
          description: ID format is invalid
          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: ID format is invalid
                title: The request is invalid
        "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
        "404":
          description: The order does not exist, or has been deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    type: string
                    enum:
                      - order_not_found
                required:
                  - message
                  - code
                description: The order does not exist, or has been deleted.
                title: Order not found
        "409":
          description: The order cannot be deleted in its current state.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: The error message.
                  code:
                    anyOf:
                      - type: string
                        enum:
                          - order_read_only
                          - order_already_submitted
                      - type: string
                required:
                  - message
                  - code
                description: The order cannot be deleted in its current state.
                title: Order delete conflict
        "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.
````