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

# Remove Line Items

> Remove one or more line items from an open return.

Only returns whose outcome is entirely a refund or entirely store credit can be modified. Exchanges
and mixed outcomes cannot.

Removing items reduces the return total and its refund or gift card value.

### What happens to the return afterwards

If the request removes every remaining item, the return is cancelled rather than processed, freeing
the items for a new return. This is checked first, so it applies at any item count, whatever the
outcome.

Otherwise:

- **Refund outcome**: the return is processed and closed and the remaining items refunded, without a
  separate call to [Process Return](/api-reference/latest/return-actions/process-return). A later
  call for the same return responds with a `422`.
- **Store credit outcome**: the return stays open and further items can be removed. Reshop instant
  refunds count as a refund outcome and close the return.

<Warning>
  On a refund return, pass every line item ID in a single comma separated request. Removing them one
  at a time fails: the first request closes the return.
</Warning>

### Required API key scope
- Returns


## Common error responses

Each of these responds with a `422`.

**Return not modifiable.** The return is already closed or cancelled, or it has an exchange. This is
also what a second removal request returns, once the first one has closed a refund return.

```json theme={null}
{
  "data": { "line_item_id": "1234567" },
  "errors": { "message": "Return cannot be modified." }
}
```

**Some items do not qualify.** One or more of the requested IDs are already returned or refunded. No
items are removed when this happens, including the ones that would otherwise qualify.

```json theme={null}
{
  "data": { "line_item_id": "1234567,7654321" },
  "errors": {
    "message": "Not all line items qualify for removal - Received: 1234567, 7654321 - Qualifying: 7654321"
  }
}
```

**Missing `line_item_id`.**

```json theme={null}
{
  "message": "The line item id field is required.",
  "errors": { "line_item_id": ["The line item id field is required."] }
}
```


## OpenAPI

````yaml post /warehouse/return/{id}/remove
openapi: 3.1.0
info:
  title: Returns API
  version: v1
  description: API used for performing operations on returns.
servers:
  - url: https://api.loopreturns.com/api/2026-10
    description: 2026-10 (Stable)
  - url: https://api.loopreturns.com/api/2026-07
    description: 2026-07
  - url: https://api.loopreturns.com/api/unstable
    description: Unstable (Preview)
security: []
tags:
  - name: Return Actions
  - name: Return Data
paths:
  /warehouse/return/{id}/remove:
    post:
      tags:
        - Return Actions
      summary: Remove Line Items
      description: >
        Remove one or more line items from an open return.


        Only returns whose outcome is entirely a refund or entirely store credit
        can be modified. Exchanges

        and mixed outcomes cannot.


        Removing items reduces the return total and its refund or gift card
        value.


        ### What happens to the return afterwards


        If the request removes every remaining item, the return is cancelled
        rather than processed, freeing

        the items for a new return. This is checked first, so it applies at any
        item count, whatever the

        outcome.


        Otherwise:


        - **Refund outcome**: the return is processed and closed and the
        remaining items refunded, without a
          separate call to [Process Return](/api-reference/latest/return-actions/process-return). A later
          call for the same return responds with a `422`.
        - **Store credit outcome**: the return stays open and further items can
        be removed. Reshop instant
          refunds count as a refund outcome and close the return.

        <Warning>
          On a refund return, pass every line item ID in a single comma separated request. Removing them one
          at a time fails: the first request closes the return.
        </Warning>


        ### Required API key scope

        - Returns
      operationId: removeLineItems
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The unique identifier associated with the return.
        - in: query
          name: line_item_id
          description: >
            The `line_item_id` of an item on the return, as listed in the
            return's `line_items` array. To

            remove more than one, pass them as comma separated values.
          required: true
          schema:
            type: string
      responses:
        '200':
          $ref: '#/components/responses/RemoveLineItems'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoveReturnNotFound'
        '422':
          $ref: '#/components/responses/UnprocessableRemove'
        '500':
          $ref: '#/components/responses/FailedToProcess'
      security:
        - api_key: []
components:
  responses:
    RemoveLineItems:
      description: Success
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/SuccessMessage'
              - $ref: '#/components/schemas/ReturnActionError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            required:
              - errors
            properties:
              errors:
                type: string
                examples:
                  - Unauthorized.
    UnprocessableRemove:
      description: Unprocessable
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/RemoveLineItemValidationError'
              - $ref: '#/components/schemas/RemoveLineItemError'
    FailedToProcess:
      description: Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RemoveLineItemError'
  schemas:
    RemoveReturnNotFound:
      type: object
      description: >-
        Returned with HTTP 403 when no return matches the given ID for the
        authenticated shop. Note that `errors` is an array of objects here.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
                examples:
                  - No return found with this ID.
    SuccessMessage:
      description: The value returned when the return action succeeds.
      type: boolean
      examples:
        - true
    ReturnActionError:
      type: object
      description: >-
        An error response for a return action, containing a message describing
        the failure.
      properties:
        errors:
          type: object
          properties:
            message:
              type: string
              examples:
                - No return found with this ID.
    RemoveLineItemValidationError:
      type: object
      description: >-
        Standard Laravel validation error returned when `line_item_id` is
        missing or invalid.
      properties:
        message:
          type: string
          examples:
            - The line item id field is required.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          examples:
            - line_item_id:
                - The line item id field is required.
    RemoveLineItemError:
      type: object
      description: >-
        Error envelope returned by the remove-line-items endpoint for
        modification failures (return not modifiable, item count mismatch, or a
        processing error). The requested `line_item_id` is echoed back under
        `data`, and the `errors.message` varies by failure — count-mismatch
        messages include a ` - Received: … - Qualifying: …` suffix.
      properties:
        data:
          type: object
          properties:
            line_item_id:
              type:
                - string
                - 'null'
              examples:
                - '123456789'
        errors:
          type: object
          properties:
            message:
              type: string
              examples:
                - Return cannot be modified.
  securitySchemes:
    api_key:
      type: apiKey
      name: X-Authorization
      in: header

````

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