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

# Cancel a pending return

> Cancels a return that is still `PENDING` (not yet resolved or received). Any stock reserved
for the return (for example replacement items of an exchange, or units of a return by
carrier) is released back to available inventory. Cancelling is a resolution of the return:
your API credentials need the permission to resolve returns.

- Only `PENDING` returns can be cancelled; any other status answers 422 `RETURN_NOT_CANCELABLE`.
- The request body is empty.
- After cancellation the order can receive a new return request.




## OpenAPI

````yaml /openapi.yaml patch /returns/{return_id}/cancel
openapi: 3.1.0
info:
  title: Cubbo Clients API
  version: '1.0'
  summary: >-
    Orders, inventory, replenishments, returns, shipping and webhooks for Cubbo
    fulfillment.
  description: >
    The Cubbo Clients API connects your store, ERP or marketplace with Cubbo's
    fulfillment network.

    All endpoints except `POST /auth/token` require a bearer token; see the
    Authentication guide.

    Request and response bodies are JSON. Errors are JSON objects with an
    `error` key.
  contact:
    name: Cubbo integrations
    email: integraciones@cubbo.com
servers:
  - url: https://api.cubbo.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Exchange client credentials for a bearer token.
  - name: Orders
    description: Create, update, hold, cancel and read sales orders.
  - name: Shipping labels
    description: Read the shipping labels generated for an order.
  - name: Inventory
    description: Products and stock per store.
  - name: Lots
    description: Lot-level inventory for products with expiration or batch tracking.
  - name: Reports
    description: Bulk reports for reconciliation.
  - name: Replenishments
    description: Inbound shipments to the warehouse.
  - name: Returns
    description: Returns and exchanges.
  - name: Stores
    description: Store provisioning and settings.
  - name: Shipping methods
    description: Available shipping methods, coverage and quotes.
  - name: Click and collect
    description: Pickup points and in-store pickup orders.
paths:
  /returns/{return_id}/cancel:
    patch:
      tags:
        - Returns
      summary: Cancel a pending return
      description: >
        Cancels a return that is still `PENDING` (not yet resolved or received).
        Any stock reserved

        for the return (for example replacement items of an exchange, or units
        of a return by

        carrier) is released back to available inventory. Cancelling is a
        resolution of the return:

        your API credentials need the permission to resolve returns.


        - Only `PENDING` returns can be cancelled; any other status answers 422
        `RETURN_NOT_CANCELABLE`.

        - The request body is empty.

        - After cancellation the order can receive a new return request.
      operationId: cancelReturn
      parameters:
        - name: return_id
          in: path
          required: true
          description: Numeric id of the return.
          schema:
            type: integer
          example: 98765
      responses:
        '200':
          description: The return, now cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnCancelled'
              example:
                id: 98765
                status: CANCELLED
                return_type: TO_BE_DETERMINED
                resolved_at: '2026-10-12T16:00:00.000Z'
                created_at: '2026-10-12T15:04:05.123Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: No return with that id in your stores.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: no return found with return_id 98765
        '409':
          description: Another cancel for the same return is still being processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnError'
              example:
                error: a cancel for this return is already in progress
                code: CANCEL_IN_FLIGHT
        '422':
          description: The return cannot be cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnError'
              examples:
                notCancelable:
                  value:
                    error: return 98765 is not pending and cannot be cancelled
                    code: RETURN_NOT_CANCELABLE
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - bearerAuth: []
components:
  schemas:
    ReturnCancelled:
      type: object
      description: Response of `PATCH /returns/{return_id}/cancel`.
      required:
        - id
        - status
        - return_type
        - resolved_at
        - created_at
      properties:
        id:
          type: integer
          description: Unique id of the return.
          example: 98765
        status:
          $ref: '#/components/schemas/ReturnStatus'
        return_type:
          $ref: '#/components/schemas/ReturnType'
        resolved_at:
          type: string
          format: date-time
          description: When the return was cancelled.
          example: '2026-10-12T16:00:00.000Z'
        created_at:
          type: string
          format: date-time
          description: When the return was created.
          example: '2026-10-12T15:04:05.123Z'
    Error:
      type: object
      description: Error body returned by every failed request.
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Human-readable description of the failure. For `401` responses it is
            always `Unauthorized`.
          example: Parameter store_id is required
        message:
          type: string
          description: >-
            Present on `401` responses only; the reason the request was
            rejected.
          example: invalid token
        code:
          type:
            - string
            - 'null'
          description: >-
            Stable machine-readable code, present on some order, return and
            replenishment errors.
          example: ORDER_ALREADY_EXISTS
        context:
          type:
            - object
            - 'null'
          description: >-
            Extra data about the failure when available, for example the id of
            the conflicting order.
          additionalProperties: true
          example:
            order_id: 987654
    ReturnError:
      type: object
      description: >-
        Error body of the create, cancel and decision endpoints, with a
        machine-readable `code`.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable message.
          example: order already has an active return
        code:
          type:
            - string
            - 'null'
          description: Stable error code; null for parameter validation errors.
          example: RETURN_ALREADY_EXISTS
        context:
          type:
            - object
            - 'null'
          description: >-
            Extra details, when available (for example the offending `sku`).
            Only sent by `POST /returns`.
          example:
            sku: SKU-RED-M
    ReturnStatus:
      type: string
      description: >
        Lifecycle status of a return.

        - `PENDING`: created and waiting for a decision (review of a customer
        request, or decision on an order returned by the carrier).

        - `REQUESTED`: resolved; the customer has the return instructions and
        the goods are expected back.

        - `ORDERED`: resolved by creating a new (replacement or resend) order.

        - `CANCELLED`: cancelled before the goods came back; reserved stock was
        released.

        - `ARRIVED_AT_WAREHOUSE`: the package arrived at the warehouse and is
        waiting to be processed.

        - `AWAITING_INSPECTION`: the package was opened and is waiting for
        inspection of its contents.

        - `RECEIVED`: the goods were checked in and are being re-entered into
        inventory.

        - `REENTERED`: the goods were fully re-entered into inventory; the
        return is complete.

        - `UNSUCCESSFUL`: closed without receiving anything; every expected
        product was missing on reception.
      enum:
        - PENDING
        - REQUESTED
        - ORDERED
        - CANCELLED
        - ARRIVED_AT_WAREHOUSE
        - AWAITING_INSPECTION
        - RECEIVED
        - REENTERED
        - UNSUCCESSFUL
      example: PENDING
    ReturnType:
      type: string
      description: >
        What kind of return this is.

        - `TO_BE_DETERMINED`: requested by the customer or by you, not yet
        reviewed; the outcome (simple return, exchange, rejection) is decided
        later.

        - `SIMPLE_RETURN`: the customer sends the goods back; no replacement is
        shipped.

        - `EXCHANGE`: the customer sends the goods back and replacement items
        (`exchange_products`) are reserved to ship once the return arrives.

        - `IMMEDIATE_EXCHANGE`: replacement items ship right away, before the
        return arrives (created from the Cubbo app, not through this API).

        - `RETURNED_BY_CARRIER`: the carrier could not deliver the order and
        brought it back; decide it with `POST /returns/{return_id}/decision`.

        - `UNIDENTIFIED`: a package arrived at the warehouse that could not be
        matched to an order (created by warehouse staff).
      enum:
        - TO_BE_DETERMINED
        - SIMPLE_RETURN
        - EXCHANGE
        - IMMEDIATE_EXCHANGE
        - RETURNED_BY_CARRIER
        - UNIDENTIFIED
      example: TO_BE_DETERMINED
  responses:
    Unauthorized:
      description: >-
        Missing or invalid token, wrong credentials, or no access to the
        requested store.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalidToken:
              value:
                error: Unauthorized
                message: invalid token
            noHeader:
              value:
                error: Unauthorized
                message: no authorization header found
            storeNotAllowed:
              value:
                error: Unauthorized
                message: not allowed to show? this Store
    InternalServerError:
      description: >-
        Unexpected error. Retry with backoff; if it persists, send the timestamp
        to Cubbo support.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'unexpected error, timestamp: 1760000000'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Token returned by `POST /auth/token`, sent as `Authorization: Bearer
        <token>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.