# Warehouse Events for Returns

## Overview

parcelLab provides an API you can use to trigger different flows in your returns experience based on a review of a return after it is received at your warehouse.

You can use the Return Processed API to send a custom event to parcelLab to update a return registered in your Returns Portal based on the outcome of returns that were processed in your warehouse. This event can be used to trigger subsequent events (for example: paying out a refund, sending emails to the customer).

{% hint style="info" %}
You can use the Return Processing app as an alternative to send the same information via devices in your warehouses or retail locations. For full details on configuring and using the Return Processing app, refer to the [product documentation](/docs/retain/return-processing-app.md).
{% endhint %}

## Return Processed API

You can submit a custom event to update a registered return using the `hook-rma-processed` endpoint.

Trackings can be identified using one of the following ways, as shown in the sample requests:

* Courier and tracking number
* `xid` reference
* RMA identifier and order number

{% hint style="warning" %}
The tracking identifier combination you use determines which fields are required in the request body.
{% endhint %}

## Process RMA updates

> Handles updates for RMA processed items and creates tracking updates

```json
{"openapi":"3.0.0","info":{"title":"RMA Processing Webhook Receiver","version":"1.0.0"},"servers":[{"url":"https://api.parcellab.com","description":"Production"}],"paths":{"/hook-rma-processed":{"post":{"summary":"Process RMA updates","description":"Handles updates for RMA processed items and creates tracking updates","parameters":[{"name":"user","in":"header","required":true,"schema":{"type":"string"},"description":"Your parcelLab account ID"},{"name":"token","in":"header","required":true,"schema":{"type":"string"},"description":"Your parcelLab authentication token"},{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"Must be application/json"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RMAProcessedRequest"}}}},"responses":{"202":{"description":"RMA update accepted and being processed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptResponse"}}}},"400":{"description":"Invalid request payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"RMAProcessedRequest":{"type":"object","required":["articles"],"properties":{"xid":{"type":"string","description":"External identifier for the return"},"orderNumber":{"type":"string","description":"Original order number"},"rmaId":{"type":"string","description":"RMA identifier"},"courier":{"type":"string","description":"Courier handling the return"},"trackingNumber":{"type":"string","description":"Tracking number for the return shipment"},"articles":{"type":"array","items":{"$ref":"#/components/schemas/Article"},"minItems":1,"description":"List of articles being processed in the return"},"treatUnspecifiedAsRejected":{"type":"boolean","description":"When `true`, articles with unspecified rejected quantities are treated as fully rejected. Defaults to `false` if not provided."}}},"Article":{"type":"object","required":["articleNo","acceptedQuantity","rejectedQuantity"],"properties":{"articleNo":{"type":"string","description":"Article identifier used to match with existing tracking articles"},"acceptedQuantity":{"type":"integer","description":"Number of items accepted in return","minimum":0},"rejectedQuantity":{"type":"integer","description":"Number of items rejected in return","minimum":0},"rejectionReason":{"type":"string","description":"Reason for rejection if applicable","nullable":true}}},"AcceptResponse":{"type":"object","properties":{"message":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parcellab.com/docs/developers/v2/returns/warehouse-events-for-returns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
