> ## 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 line items from a return and process the return.

Currently, only line items tied to a refund or store credit
outcome allow for line items to be removed programmatically.

### Required API key scope
- Returns




## OpenAPI

````yaml post /warehouse/return/{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/v1
security: []
tags:
  - name: Return Actions
  - name: Return Data
paths:
  /warehouse/return/{return_id}/remove:
    post:
      tags:
        - Return Actions
      summary: Remove Line Items
      description: |
        Remove line items from a return and process the return.

        Currently, only line items tied to a refund or store credit
        outcome allow for line items to be removed programmatically.

        ### Required API key scope
        - Returns
      operationId: removeLineItems
      parameters:
        - in: path
          name: return_id
          schema:
            type: integer
          required: true
          description: The unique identifier associated with the return.
        - in: query
          name: line_item_id
          description: >
            The ID of the line item to remove. Optionally, you can include more
            than one using 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
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                    examples:
                      - '401'
                  http_code:
                    type: string
                    examples:
                      - GEN-UNAUTHORIZED
                  message:
                    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

````