> ## Documentation Index
> Fetch the complete documentation index at: https://sendcloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete a shipment

> Allows you to delete a shipment from Sendcloud, e.g. if it has been canceled or deleted in your shop system.

<Warning>
  **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
</Warning>

The `order_status` and `payment_status` fields we retrieve from integrations are not mapped in our system, meaning that orders will not be automatically updated or deleted if the values for these fields change after an order is placed.

You can delete an order by providing either a `shipment_uuid`, or a combination of the `external_order_id` and `external_shipment_id` properties.


## OpenAPI

````yaml /.openapi/v2/integrations/openapi.yaml post /integrations/{id}/shipments/delete
openapi: 3.1.0
info:
  title: Integrations
  contact:
    name: Sendcloud API Support
    email: contact@sendcloud.com
    url: https://www.sendcloud.dev
  version: 2.0.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  description: >-
    The Integrations API allows you to retrieve, update and add orders to custom
    webshop integrations.
servers:
  - url: https://panel.sendcloud.sc/api/v2
    description: Sendcloud Production
security: []
tags:
  - name: Integrations
  - name: Shipments
paths:
  /integrations/{id}/shipments/delete:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: The id of the integration to which the shipments belong
    post:
      tags:
        - Shipments
      summary: Delete a shipment
      description: >-
        Allows you to delete a shipment from Sendcloud, e.g. if it has been
        canceled or deleted in your shop system.
      operationId: sc-public-v2-orders-post-delete_a_shipment
      requestBody:
        description: >-
          You must provide either a shipment_uuid or the combination of
          external_order_id and external_shipment_id to this endpoint.
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    shipment_uuid:
                      type: string
                      format: uuid
                      description: Autogenerated Sendcloud's internal ID
                  required:
                    - shipment_uuid
                - type: object
                  properties:
                    external_order_id:
                      type: string
                      description: External order ID assigned by shop system
                    external_shipment_id:
                      type: string
                      description: External shipment ID assigned by shop system
                  required:
                    - external_order_id
                    - external_shipment_id
            examples:
              DeleteByUUID:
                summary: Delete a shipment (via UUID)
                value:
                  shipment_uuid: 39874b59-2a68-4a3d-8e00-aeb9e0540d00
              DeleteByOrderIdShipmentId:
                summary: Delete a shipment (via `order_id` and `shipment_id`)
                value:
                  external_order_id: '123457'
                  external_shipment_id: S00002
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      request:
                        type: string
                      message:
                        type: string
              examples:
                RequiredFieldMissing:
                  summary: Missing required fields
                  value:
                    error:
                      code: 400
                      request: api/v2/integrations/1234/shipments/delete
                      message: >-
                        Missing shipment_uuid or the pair external_order_id and
                        external_shipment_id
                invalid_uuid:
                  summary: Invalid UUID
                  value:
                    error:
                      code: 400
                      request: api/v2/integrations/1234/shipments/delete
                      message: Must be a valid UUID.
        '404':
          $ref: '#/components/responses/404-Shipments'
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
components:
  responses:
    404-Shipments:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    description: HTTP response status code
                    example: 404
                  request:
                    type: string
                    description: Endpoint which returned the response
                  message:
                    type: string
                    description: Human readable error message
                required:
                  - code
                  - request
                  - message
          examples:
            ShipmentNotFound:
              summary: Shipment not found
              value:
                error:
                  code: 404
                  request: api/v2/integrations/1/shipments/
                  message: No ShipmentBlob matches the given query.
            IntegrationNotFound:
              summary: Integration not found
              value:
                error:
                  code: 404
                  request: api/v2/integrations/1/shipments/
                  message: No Integration matches the given query.
  securitySchemes:
    HTTPBasicAuth:
      type: http
      description: >-
        Basic Authentication using API key and secrets is currently the main
        authentication mechanism.
      scheme: basic
    OAuth2ClientCreds:
      type: oauth2
      description: >-
        OAuth2 is a standardized protocol for authorization that allows users to
        share their private resources stored on one site with another site
        without having to provide their credentials. OAuth2 Client Credentials
        Grant workflow. This workflow is typically used for server-to-server
        interactions that require authorization to access specific resources.
      flows:
        clientCredentials:
          tokenUrl: https://account.sendcloud.com/oauth2/token/
          scopes:
            api: Default OAuth scope required to access Sendcloud API.

````