- Returns
- Create Returns
Returns
Create Returns
Create return authorizations (RMA) with automatic return label generation
curl --request POST \
--url https://sandbox.masonhub.co/dragonfly-cosmetics-demo/api/v1/rmas \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"customer_identifier": "<string>",
"return_type": "<string>",
"line_items": [],
"manifest_id": "<string>",
"generate_return_label": "true",
"customer_instructions": "<string>",
"customer_address_name": "<string>",
"customer_address_street_line_one": "<string>",
"customer_address_street_line_two": "<string>",
"customer_address_city": "<string>",
"customer_address_state": "<string>",
"customer_address_postal_code": "<string>",
"customer_address_country_code": "<string>",
"return_reason_code": "<string>",
"return_inventory_status": "<string>"
}'Create return merchandise authorizations (RMA) for customer returns. The system supports automatic DHL return label generation and various return types.
MasonHub automatically generates DHL return labels when generate_return_label is true (default) and complete customer address is provided.
Return label URLs require API authentication and contain customer personal information. Treat them as sensitive data.
Request Body Schema
Send an array of RMA objects. Multiple returns can be created in a single request.
Required Fields
Unique RMA identifier in your system. Used to reference this return in future operations.
Type of return. Options:
rma_submitted_by_customer- Customer-initiated returnquality_control- Quality control returndamaged_in_transit- Damaged during shippingwrong_item_shipped- Incorrect item shipped
Array of items being returned. Each item must include:
customer_sku_id(string, required): Your SKU identifierquantity(integer, required): Quantity being returnedreturn_reason_code(string, required): Reason for returnreturn_inventory_status(string, required): Target inventory statuscustomer_order_id(string, optional): Original order referencereturn_notes(string, optional): Additional notes
Optional Fields
Manifest identifier for grouping related returns.
Whether to generate a DHL return label. Requires complete customer address when true.
Special handling instructions for warehouse team (e.g., “Dry clean before restocking”).
Customer Address Fields
Customer name. Required if generate_return_label is true.
Street address line 1. Required if generate_return_label is true.
Street address line 2 (apartment, suite, etc.). Optional.
City. Required if generate_return_label is true.
State or province code (e.g., “NY”, “CA”). Required if generate_return_label is true.
Postal/ZIP code. Required if generate_return_label is true.
Country code (e.g., “US”, “CA”). Required if generate_return_label is true.
Return Reason Codes
Standardized reason codes for analytics:
tooBig- Item was too largetooSmall- Item was too smalldamaged- Customer received damaged itemwrongItem- Customer received wrong itemother- Reason not captured in standard codes
Return Inventory Statuses
Target inventory status for returned items:
available- Ready for resalequality-control- Requires inspectiondamaged- Damaged itemsrefurbishing- Needs refurbishmentunder-investigation- Under review
curl -X POST "https://app.masonhub.co/{account}/api/v1/rmas" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '[
{
"customer_identifier": "rma123",
"return_type": "rma_submitted_by_customer",
"generate_return_label": true,
"customer_address_name": "John Smith",
"customer_address_street_line_one": "100 First Ave",
"customer_address_city": "New York",
"customer_address_state": "NY",
"customer_address_postal_code": "10016",
"customer_address_country_code": "US",
"customer_instructions": "Dry clean before restocking",
"line_items": [
{
"customer_order_id": "54321",
"customer_sku_id": "shirts872340",
"quantity": 1,
"return_reason_code": "tooBig",
"return_notes": "Didn'\''t fit properly",
"return_inventory_status": "quality-control"
}
]
}
]'
{
"records_submitted": 1,
"records_processed": 1,
"records_failed": 0,
"records_succeeded": 1,
"results": [
{
"customer_identifier": "rma123",
"status": "success",
"uri": "https://app.masonhub.co/demo_account/api/v1/rmas?cid=rma123",
"additional_data": {
"return_label_url": "https://app.masonhub.co/demo_account/api/v1/return-labels/demo1234.pdf",
"return_tracking_number": "9302020514103629166400"
}
}
]
}
Return Label Generation
When creating an RMA with return label generation:
Validate Address
System validates that all required address fields are provided
Generate Label
DHL return label is automatically generated
Return URLs
Response includes return_label_url and return_tracking_number
Email Label
Optionally email the label directly to the customer
Order Dependencies
RMAs can be created with or without order references. This flexibility supports:
- Historical returns during system go-live
- Returns without order tracking
- Cross-order returns (single RMA referencing multiple orders)
When customer_order_id is provided, the system validates:
- Order exists in the system
- SKU was on the referenced order
- Quantity doesn’t exceed original order quantity
Cross-Order Returns
A single RMA can reference multiple orders at the line item level:
{
"customer_identifier": "rma123",
"return_type": "rma_submitted_by_customer",
"line_items": [
{
"customer_order_id": "order001",
"customer_sku_id": "shirt123",
"quantity": 1,
"return_reason_code": "tooBig",
"return_inventory_status": "available"
},
{
"customer_order_id": "order002",
"customer_sku_id": "pants456",
"quantity": 2,
"return_reason_code": "wrongItem",
"return_inventory_status": "quality-control"
}
]
}
Best Practices
Complete Addresses
Provide complete customer addresses for successful return label generation.
Clear Instructions
Include detailed handling instructions for quality control and restocking.
Proper Reason Codes
Use appropriate return reason codes for analytics and trend analysis.
Quality Control Routing
Route questionable returns through quality-control status for inspection.
Callback Events
After creating an RMA, you’ll receive rmaEvent callbacks as the return progresses:
- tendered: Package picked up by carrier
- inTransit: Package in transit to facility
- delivered: Package arrived at facility
- received: Items processed into inventory (includes line item details)
curl -X POST "https://app.masonhub.co/{account}/api/v1/rmas" \
-H "Authorization: Bearer your_jwt_token" \
-H "Content-Type: application/json" \
-d '[
{
"customer_identifier": "rma123",
"return_type": "rma_submitted_by_customer",
"generate_return_label": true,
"customer_address_name": "John Smith",
"customer_address_street_line_one": "100 First Ave",
"customer_address_city": "New York",
"customer_address_state": "NY",
"customer_address_postal_code": "10016",
"customer_address_country_code": "US",
"customer_instructions": "Dry clean before restocking",
"line_items": [
{
"customer_order_id": "54321",
"customer_sku_id": "shirts872340",
"quantity": 1,
"return_reason_code": "tooBig",
"return_notes": "Didn'\''t fit properly",
"return_inventory_status": "quality-control"
}
]
}
]'
curl --request POST \
--url https://sandbox.masonhub.co/dragonfly-cosmetics-demo/api/v1/rmas \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"customer_identifier": "<string>",
"return_type": "<string>",
"line_items": [],
"manifest_id": "<string>",
"generate_return_label": "true",
"customer_instructions": "<string>",
"customer_address_name": "<string>",
"customer_address_street_line_one": "<string>",
"customer_address_street_line_two": "<string>",
"customer_address_city": "<string>",
"customer_address_state": "<string>",
"customer_address_postal_code": "<string>",
"customer_address_country_code": "<string>",
"return_reason_code": "<string>",
"return_inventory_status": "<string>"
}'{
"records_submitted": 1,
"records_processed": 1,
"records_failed": 0,
"records_succeeded": 1,
"results": [
{
"customer_identifier": "rma123",
"status": "success",
"uri": "https://app.masonhub.co/demo_account/api/v1/rmas?cid=rma123",
"additional_data": {
"return_label_url": "https://app.masonhub.co/demo_account/api/v1/return-labels/demo1234.pdf",
"return_tracking_number": "9302020514103629166400"
}
}
]
}