> ## 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.

# Process Return

> Process a return in Loop based on the return ID. Processing a return will archive it in Loop and
fulfill any remaining outcomes, such as placing exchange orders or creating gift cards.

> ⚡ **Processing Note**
>
> This endpoint queues the return for processing. The actual processing occurs in the background.
> A successful response indicates the return has been queued, not that processing has completed.

Optionally, you may include a JSON payload in the request body. If you choose to do so, Loop will
add these values to any new Shopify orders that result from processing the return. For example, if
the return includes an exchange when the return is processed, Loop will create that exchange order
and these values will be added to the order as "Additional Details." Loop will also add a note to
the return timeline with the values in the request body.
> 🚧 Process Error Codes
>
> Returns must be in a processable state to successfully process. If your return is not in a
> processable state, your response will include an `errors` object with a corresponding message and
> error code.
>
>
> If you would like to configure your flagged returns to process, please reach out to
> support@loopreturns.com.

```json
{
  "errors": {
    "message": "Return is open and therefore cannot be processed.",
    "code": "UNPROCESSABLE_FLAGGED_RETURN"
  }
}
```

### Required API key scope
- Returns




## OpenAPI

````yaml post /warehouse/return/{return_id}/process
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}/process:
    post:
      tags:
        - Return Actions
      summary: Process Return
      description: >
        Process a return in Loop based on the return ID. Processing a return
        will archive it in Loop and

        fulfill any remaining outcomes, such as placing exchange orders or
        creating gift cards.


        > ⚡ **Processing Note**

        >

        > This endpoint queues the return for processing. The actual processing
        occurs in the background.

        > A successful response indicates the return has been queued, not that
        processing has completed.


        Optionally, you may include a JSON payload in the request body. If you
        choose to do so, Loop will

        add these values to any new Shopify orders that result from processing
        the return. For example, if

        the return includes an exchange when the return is processed, Loop will
        create that exchange order

        and these values will be added to the order as "Additional Details."
        Loop will also add a note to

        the return timeline with the values in the request body.

        > 🚧 Process Error Codes

        >

        > Returns must be in a processable state to successfully process. If
        your return is not in a

        > processable state, your response will include an `errors` object with
        a corresponding message and

        > error code.

        >

        >

        > If you would like to configure your flagged returns to process, please
        reach out to

        > support@loopreturns.com.


        ```json

        {
          "errors": {
            "message": "Return is open and therefore cannot be processed.",
            "code": "UNPROCESSABLE_FLAGGED_RETURN"
          }
        }

        ```


        ### Required API key scope

        - Returns
      operationId: processReturn
      parameters:
        - in: path
          name: return_id
          schema:
            type: integer
          required: true
          description: The unique identifier associated with the return.
      responses:
        '200':
          $ref: '#/components/responses/ProcessReturn'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - api_key: []
components:
  responses:
    ProcessReturn:
      description: >
        Success - The return has been queued for processing. The actual
        processing will occur asynchronously.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/SuccessMessage'
              - $ref: '#/components/schemas/UnprocessableCancelledReturn'
              - $ref: '#/components/schemas/UnprocessableStateReturn'
              - $ref: '#/components/schemas/UnprocessableInReviewReturn'
    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.
  schemas:
    SuccessMessage:
      description: The value returned when the return has been queued for processing.
      type: string
      examples:
        - 'true'
    UnprocessableCancelledReturn:
      type: object
      description: The value returned when the return is cancelled and can't be processed.
      properties:
        message:
          type: string
          examples:
            - Return is cancelled and therefore cannot be processed.
    UnprocessableStateReturn:
      type: object
      description: The value returned when the return is closed and can't be processed.
      properties:
        errors:
          type: object
          properties:
            message:
              type: string
              examples:
                - Return is closed and therefore cannot be processed.
            code:
              type: string
              examples:
                - UNPROCESSABLE_RETURN
    UnprocessableInReviewReturn:
      type: object
      description: >-
        The value returned when the return is under review and can't be
        processed.
      properties:
        message:
          type: string
          examples:
            - Return is review and therefore cannot be processed.
  securitySchemes:
    api_key:
      type: apiKey
      name: X-Authorization
      in: header

````