> For the complete documentation index, see [llms.txt](https://docs.parcellab.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.parcellab.com/docs/developers/v2/returns/warehouse-events-for-returns.md).

# Warehouse Events for Returns

Use the Return Processed API to trigger different return flows based on the acceptance or rejection of the registered return.

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

For API v4 return registration integrations that should close the return directly, use [Process Return Mutations](https://github.com/parcelLab/gitbook-documentation/tree/main/developers-v4/returns/process-return-mutations.md).

{% 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](https://github.com/parcelLab/gitbook-documentation/tree/main/how-parcellab-works/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"}}}}}}
```

## Authentication and `403 Forbidden`

`POST /hook-rma-processed` requires a valid token with the `write` scope for the target account. Supply the credentials in headers, using either the encoded `Authorization: Parcellab-API-Token <encoded-token>` value or the legacy `user` and raw `token` headers. See [Authentication](/docs/developers/v2/getting-started/authentication.md).

| Response                                 | Meaning                                                                                                   | Action                                                                                                                |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `401` with `No valid credentials given.` | Credentials are missing, or the account ID is not numeric.                                                | Check the header format and account ID.                                                                               |
| `403` with `Forbidden.`                  | The account does not exist, the token is not valid for the account, or the token lacks the `write` scope. | Check that the token is valid for the account and includes `write`. A read-only token cannot submit warehouse events. |

These failures occur before the event payload is processed. Resolve access before retrying. A successful retry returns `202 Accepted`; check the resulting return state and configured follow-up actions separately.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
