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

# Cancel a shipment

> Use this endpoint to cancel an announced shipment, if the carrier supports cancellation.

You can use this endpoint to **Cancel** an announced shipment.

## Cancelling a shipment

When you **cancel** a shipment which is already announced (has shipping labels attached to it), you will still be able to find it via the `id` and the [Retrieve a shipment](/api/v3/shipments/retrieve-a-shipment) endpoint. In the Sendcloud platform, it will appear in your **Cancelled labels** overview.

**Insurance Notice**: If you proceed to send a shipment that was initially cancelled, the parcel's insurance coverage will become void, and any insurance claims will not be valid for that shipment.

<Warning>
  After 42 days, it's no longer possible to cancel a shipment, even if it hasn't been sent.
</Warning>

## Conditions for label cancellation

It's not always possible to cancel a shipment whose parcel has already been announced. As a result, cancellation is not guaranteed and may be asynchronous depending on the state of the shipment parcel. When you send a cancellation request via this endpoint, the response will indicate the status of the cancellation request.

<Info>
  Each carrier will have different cancellation deadlines. Some carriers do not accept cancellation requests regardless of whether or not the label is cancelled within the deadline. You can find more information about cancellation deadlines on our [help center](https://support.sendcloud.com/hc/en-us/articles/360025143991-How-do-I-cancel-my-shipment-).
</Info>


## OpenAPI

````yaml /.openapi/v3/shipments/openapi.yaml post /shipments/{id}/cancel
openapi: 3.1.0
info:
  title: Shipments
  version: 3.0.0
  description: >-
    The Shipments API allows you to create and announce, retrieve, and cancel
    outgoing shipments and their associated parcels within the Sendcloud
    platform.
  contact:
    name: Sendcloud API Support
    email: contact@sendcloud.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://panel.sendcloud.sc/api/v3
    description: Sendcloud Production
security: []
tags:
  - name: Shipments
    description: Shipments API
paths:
  /shipments/{id}/cancel:
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: ID of the shipment
    post:
      tags:
        - Shipments
      summary: Cancel a shipment
      description: >-
        Use this endpoint to cancel an announced shipment, if the carrier
        supports cancellation.
      operationId: sc-public-v3-scp-post-cancel_shipment
      responses:
        '200':
          description: |-
            Cancelled
            - The shipment has been cancelled if all valid conditions apply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cancel-shipment-status'
              examples:
                Cancelled:
                  summary: Successfully Cancelled
                  value:
                    data:
                      status: cancelled
                      message: Shipment has been cancelled
        '202':
          description: >-
            Shipment cancellation has been queued

            - The shipment having the status of ready to send (1000) will be
            watched for 14 days and if nothing nothing has changed to the
            shipment, it will be cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cancel-shipment-status'
              examples:
                Cancelled:
                  summary: Successfully queued for cancellation
                  value:
                    data:
                      status: queued
                      message: Shipment cancellation has been queued
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors'
              examples:
                ShipmentToBeCancelledNotFound:
                  summary: Shipment not found
                  value:
                    errors:
                      - status: '404'
                        code: not_found
                        detail: Not found
        '409':
          description: >-
            Cancellation rejected

            - When shipment has the status of 2000 which means it is already
            cancelled.

            - After period of 42 days of the shipment being announced we cannot
            cancel it and will let you know about it through a response message.

            - When shipment has the status code (11) saying that it’s delivered
            it will not do anything to the shipment and your request will be
            rejected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors'
              examples:
                CancellationRejected:
                  summary: Cancellation rejected
                  value:
                    errors:
                      - status: '409'
                        code: invalid
                        detail: This shipment is already being cancelled.
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
components:
  schemas:
    cancel-shipment-status:
      title: Cancel Shipment Status object
      type: object
      properties:
        data:
          $ref: '#/components/schemas/cancellation-status'
      required:
        - data
    errors:
      title: Errors
      description: >-
        A standardized format for errors in
        [JSON:API](https://jsonapi.org/format/#error-objects) responses.
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/ErrorObject'
          - required:
              - status
              - code
              - detail
    cancellation-status:
      title: Cancel Shipment Status Object
      type: object
      properties:
        status:
          type: string
          minLength: 1
          example: cancelled
        message:
          type: string
          minLength: 1
          example: Shipment has been cancelled
      required:
        - status
        - message
    ErrorObject:
      title: Error
      type: object
      description: Error in a JSON:API error format
      properties:
        id:
          type: string
          description: A unique identifier for the error.
        links:
          type: object
          description: >-
            A set of hyperlinks that provide additional information about the
            error.
          properties:
            about:
              type: string
              description: A URL that provides additional information about the error.
        status:
          type: string
          format: int32
          description: The HTTP status code of the error.
          minLength: 1
        code:
          type: string
          description: A unique error code for the error, in snake case format.
          minLength: 1
          enum:
            - unknown_field
            - invalid
            - forbidden
            - invalid_choice
            - min_value
            - 'null'
            - not_found
            - required
            - not_a_list
            - non_field_errors
            - authentication_failed
            - validation_error
            - parcel_announcement_error
        title:
          type: string
          description: A short, human-readable summary of the error.
          minLength: 1
        detail:
          type: string
          description: A human-readable explanation of the error.
          minLength: 1
        source:
          type: object
          description: >-
            An object that identifies the source of the error within the request
            payload.
          properties:
            pointer:
              type: string
              description: >-
                A `JSON` pointer to the location of the error within the request
                payload.
            parameter:
              type: string
              description: The name of the `query` parameter that caused the error.
            header:
              type: string
              description: The name of the `header` parameter that caused the error.
        meta:
          type: object
          description: Additional metadata about the error.
  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.

````