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

> **Note on instant refunds**
>
> If the return has an open Reshop instant-refund credit, processing is intentionally skipped: a
> successful (`true`) response is returned without dispatching any processing jobs.

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 orders in the commerce provider (e.g. Shopify) 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/{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/{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.


        > **Note on instant refunds**

        >

        > If the return has an open Reshop instant-refund credit, processing is
        intentionally skipped: a

        > successful (`true`) response is returned without dispatching any
        processing jobs.


        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 orders in the commerce provider (e.g.
        Shopify) 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: 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/ReturnActionError'
              - $ref: '#/components/schemas/UnprocessableStateReturn'
              - $ref: '#/components/schemas/UnprocessableFlaggedReturn'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            required:
              - errors
            properties:
              errors:
                type: string
                examples:
                  - Unauthorized.
  schemas:
    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.
    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
    UnprocessableFlaggedReturn:
      type: object
      description: >-
        Returned when a return cannot be processed because processing of flagged
        returns is disabled, or when a generic processing error occurs (the
        catch-all in `process` also returns this code). The return's current
        state is interpolated into the message.
      properties:
        errors:
          type: object
          properties:
            message:
              type: string
              examples:
                - Return is open and therefore cannot be processed.
            code:
              type: string
              examples:
                - UNPROCESSABLE_FLAGGED_RETURN
  securitySchemes:
    api_key:
      type: apiKey
      name: X-Authorization
      in: header

````