Returns and Refunds

The Returns API models the complete RMA lifecycle: a return is created on an order, it's approved or rejected, the customer ships the merchandise back, the merchant receives it, and finally the refund (or exchange) is processed. Each step is a separate endpoint, with its own permission.

The real catalog of return states has 12 values: return-requested, return-approved, return-rejected, return-shipped, return-received, inspecting, refund-pending, refunded, exchange-pending, exchange-shipped, exchange-completed, closed. Besides the refund flow there is also an exchange flow (exchange-*) — the return type (type) can be refund, exchange, or store-credit. Every response follows the standard Orders envelope.

List orders with returns

Paginated list of orders that have at least one return.

200Orders that have at least one return
{
  "data": {
    "orders": [
      {
        "_id": "65f3a1b2c4d5e6f7a8b9c0d1",
        "externalId": "FEN-10042",
        "returns": [{ "returnId": "65f3a1b2c4d5e6f7a8b9c0e0", "status": "return-approved" }]
      }
    ],
    "total": 47,
    "page": 0,
    "limit": 20
  }
}
curl "https://api.fenicia.io/orders/returns?status=return-approved&limit=20" \
  -H "Authorization: Bearer fkapi_your_api_key"

Returns the paginated list of orders with at least one return, wrapped in data.orders (each order with the detail of its returns[]), together with data.total, data.page, and data.limit. There is no meta.pagination — the handler doesn't pass a third argument to createSuccessResponse.

Required permission: returns:read

Parameters

pagenumber

Page number

limitnumber

Items per page

statusstring

Filter by return status

Return counts

Returns the count of returns grouped by status.

200Count by status group
{
  "data": {
    "open": 12,
    "inProgress": 5,
    "awaitingAction": 3,
    "completed": 27,
    "rejected": 2,
    "total": 49
  }
}
curl https://api.fenicia.io/orders/returns/counts \
  -H "Authorization: Bearer fkapi_your_api_key"

Returns the count of returns grouped by status, wrapped in data, with the keys open, inProgress, awaitingAction, completed, rejected, and total.

Required permission: returns:read

The groups map as follows (RETURN_STATUS_GROUPS): open = return-requested, return-approved; inProgress = return-shipped, return-received, inspecting; awaitingAction = refund-pending, exchange-pending; completed = refunded, exchange-completed, closed; rejected = return-rejected. total sums every return matched by the base filter, in any status.

List returns for an order

Lists all returns registered on a specific order.

200Returns on the order
{
  "data": {
    "orderId": "65f3a1b2c4d5e6f7a8b9c0d1",
    "orderHandle": "FEN-10042",
    "returns": [
      { "returnId": "65f3a1b2c4d5e6f7a8b9c0e0", "status": "return-approved", "type": "refund" }
    ],
    "totalReturns": 1
  }
}

Returns data.orderId and data.orderHandle, the order's returns array in data.returns, and its count in data.totalReturns. The returns array is NOT data directly.

Required permission: returns:read

Parameters

orderIdstringrequired

Order ID

Create a return

Creates a return on an order.

{
  "items": [{ "sku": "CAMISA-AZUL-M", "quantity": 1 }],
  "reason": "defective"
}
201Return created
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "return-requested",
    "type": "refund",
    "requestedBy": "seller",
    "reason": "defective",
    "items": [{ "sku": "CAMISA-AZUL-M", "title": "Camisa azul", "quantity": 1, "reason": "defective", "condition": "pending-inspection" }],
    "requestedAt": "2026-07-20T18:30:00.000Z"
  }
}
curl -X POST https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/returns \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"sku":"CAMISA-AZUL-M","quantity":1}],"reason":"defective"}'

Returns the created return, wrapped in data.

Required permission: returns:create

Parameters

orderIdstringrequired

Order ID

itemsarrayrequired

Order items to return, identified by sku (not by index). Minimum 1 element.

items.skustringrequired

SKU of the item within the original order. The service looks up this SKU in order.items; if it doesn't exist, it fails with OrderValidationError (items.sku).

items.quantitynumberrequired

Quantity to return for that SKU. Cannot exceed the quantity originally purchased on the order; if it does, it fails with OrderValidationError (items.quantity).

items.reasonenum

Return reason specific to this item. Same catalog as the root-level reason. If omitted, inherits the body's reason.

reasonenumrequired

Reason for the return. One of: defective, wrong-item, size-fit, quality-issue, not-as-described, changed-mind, arrived-late, damaged-shipping, duplicate-order, other. Hyphenated — wrong_item (underscore) fails validation.

typestring

Return type: refund, exchange, or store-credit. Not enforced at runtime (see note below).

requestedBystring

Who requests the return: customer, seller, platform, or marketplace. Default: seller.

initialStatusstring

Initial status of the return (for manual returns already created in an advanced state, e.g. return-received).

overallConditionstring

Overall condition of the merchandise, if already known when creating (see catalog in the receive section).

shipmentInfoobject

Return shipping information, if already known when creating (manual returns). The transport validator doesn't declare this field — createReturnSchema only validates items and reason, with .passthrough() — so Zod never checks it; the shape below is what the service (CreateReturnInput.shipmentInfo) consumes when it's sent.

shipmentInfo.trackingNumberstring

Tracking number of the return shipment.

shipmentInfo.carrierstring

Carrier code. Accepted values: fedex, dhl, ups, estafeta, redpack, 99minutos, other. If your carrier is not on the list, send `other` and put its name in `carrierName`. Do not send `manual`, `automatic`, `automatica` or similar: those are capture modes —how the label was obtained—, not carriers, and the API rejects them.

shipmentInfo.customCarrierNamestring

Carrier name when carrier is a generic value like 'other'.

shipmentInfo.trackingUrlstring

Tracking URL, for carriers without a direct integration.

shipmentInfo.waybillIdstring

Waybill ID.

shipmentInfo.labelUrlstring

URL of the PDF label.

shipmentInfo.shippedAtstring

Shipment date (ISO 8601). If sent, it also sets the return's shippedAt.

shipmentInfo.receivedAtstring

Receipt date (ISO 8601). If sent, it also sets the return's receivedAt.

shipmentInfo.costobject

Cost of the return shipment.

shipmentInfo.cost.labelCostnumberrequired

Cost of the label (≥ 0).

shipmentInfo.cost.feniciaFeenumber

Fenicia's fee on the shipment, if applicable.

shipmentInfo.cost.paidByenumrequired

Who pays for the shipment. One of: customer, seller, platform.

shipmentInfo.cost.currencystringrequired

3-letter currency (e.g. MXN).

items is identified by sku, not by itemIndex

Unlike POST /orders/{orderId}/prepare (which identifies items by itemIndex), creating a return identifies each item by sku: the service looks up that SKU inside order.items and fails with OrderValidationError if it isn't found, or if quantity exceeds the order's original quantity.ts`), as described above.

type isn't enforced at runtime despite the TypeScript type marking it required

The transport validator (createReturnSchema) only requires items and reason — it doesn't validate type at all. And at the library level, createReturn() assigns newReturn.type = input.type directly, with no check whatsoever: if you omit type, the field stays undefined in the saved document, with no error. The CreateReturnInput TypeScript interface marks type as non-optional, but that does NOT translate into an actual validation in any layer — it's a type promise the code doesn't keep. If your integration depends on every return having a type, send it explicitly; don't assume a default.

Get a return

Gets the detail of a specific return.

200Return detail
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "return-approved",
    "reason": "defective",
    "type": "refund"
  }
}
404No return with that ID exists on that order
{ "error": { "code": "returns:not_found", "message": "Return not found" } }

Returns the return's detail, wrapped in data.

Required permission: returns:read

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

Update a return

Updates fields of an existing return. At least one field is required in the body.

{
  "inspectionNotes": "Producto sin daños visibles",
  "overallCondition": "like-new"
}
200Return updated
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "inspecting",
    "inspectionNotes": "Producto sin daños visibles"
  }
}
curl -X PUT https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/returns/65f3a1b2c4d5e6f7a8b9c0e0 \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"inspectionNotes":"Producto sin daños visibles"}'

Returns the updated return, wrapped in data.

Required permission: returns:update

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

statusstring

New status of the return.

overallConditionstring

Overall condition of the merchandise (see catalog in the receive section).

inspectionNotesstring

Notes from the merchandise inspection.

rejectionReasonstring

Rejection reason, if applicable.

skipMerchandiseReturnboolean

Whether the physical return of the merchandise is skipped (e.g. refund without return).

inventoryDispositionobject

What to do with the returned inventory.

inventoryDisposition.locationIdstringrequired

Location where the returned merchandise is placed.

inventoryDisposition.locationNamestring

Location name, for display.

inventoryDisposition.placeTypeenumrequired

Destination of the merchandise. One of: available, reconditioning, damaged, shrinkage.

inventoryDisposition.placeCodestring

Internal code of the destination location, if applicable.

inventoryDisposition.costImpactnumber

Cost impact of this disposition (e.g. shrinkage value), if known.

inventoryDisposition.currencystring

3-letter currency for costImpact (e.g. MXN).

refundobject

Associated refund data.

refund.amountnumberrequired

Amount refunded (> 0).

refund.currencystringrequired

3-letter currency (e.g. MXN).

refund.methodenumrequired

Refund method. One of: original-payment, store-credit, bank-transfer.

refund.statusenumrequired

Refund status. One of: pending, processing, completed, failed.

refund.transactionIdstring

Transaction ID of the payment method, if applicable.

shipmentInfoobject

Return shipment information.

shipmentInfo.trackingNumberstring

Tracking number of the return shipment.

shipmentInfo.carrierstring

Carrier code. Accepted values: fedex, dhl, ups, estafeta, redpack, 99minutos, other. If your carrier is not on the list, send `other` and put its name in `carrierName`. Do not send `manual`, `automatic`, `automatica` or similar: those are capture modes —how the label was obtained—, not carriers, and the API rejects them.

shipmentInfo.customCarrierNamestring

Carrier name when carrier is a generic value like 'other'.

shipmentInfo.trackingUrlstring

Tracking URL, for carriers without a direct integration.

shipmentInfo.waybillIdstring

Waybill ID.

shipmentInfo.labelUrlstring

URL of the PDF label.

shipmentInfo.shippedAtstring

Shipment date (ISO 8601).

shipmentInfo.receivedAtstring

Receipt date (ISO 8601).

shipmentInfo.costobject

Cost of the return shipment.

shipmentInfo.cost.labelCostnumberrequired

Cost of the label (≥ 0).

shipmentInfo.cost.feniciaFeenumber

Fenicia's fee on the shipment, if applicable.

shipmentInfo.cost.paidByenumrequired

Who pays for the shipment. One of: customer, seller, platform.

shipmentInfo.cost.currencystringrequired

3-letter currency (e.g. MXN).

Approve a return

Approves a pending return. No body required.

{}
200Return approved
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "return-approved",
    "type": "refund",
    "requestedBy": "seller",
    "reason": "defective",
    "items": [{ "sku": "CAMISA-AZUL-M", "title": "Camisa azul", "quantity": 1, "reason": "defective", "condition": "pending-inspection" }],
    "requestedAt": "2026-07-20T18:30:00.000Z",
    "approvedAt": "2026-07-21T10:00:00.000Z"
  }
}

Returns the full return exactly as it was before the approval, with status updated to return-approved and approvedAt added — not just the ID and status — wrapped in data.

Required permission: returns:approve

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

Reject a return

Rejects a pending return, with a mandatory reason.

{
  "reason": "Fuera de la ventana de devoluciones"
}
200Return rejected
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "return-rejected",
    "type": "refund",
    "requestedBy": "seller",
    "reason": "defective",
    "items": [{ "sku": "CAMISA-AZUL-M", "title": "Camisa azul", "quantity": 1, "reason": "defective", "condition": "pending-inspection" }],
    "requestedAt": "2026-07-20T18:30:00.000Z",
    "rejectedAt": "2026-07-21T10:00:00.000Z",
    "rejectionReason": "Fuera de la ventana de devoluciones"
  }
}
curl -X POST https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/returns/65f3a1b2c4d5e6f7a8b9c0e0/reject \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Fuera de la ventana de devoluciones"}'

Returns the full return exactly as it was before the rejection, with status updated to return-rejected, plus rejectedAt and rejectionReason — not just the ID and status — wrapped in data.

Required permission: returns:approve

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

reasonstringrequired

Reason for the rejection (free text, not a domain enum).

Register the return shipment

Registers that the customer shipped the return merchandise back.

{
  "trackingNumber": "1Z999AA10123456784",
  "carrier": "fedex"
}
200Return shipment registered
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "return-shipped",
    "type": "refund",
    "requestedBy": "seller",
    "reason": "defective",
    "items": [{ "sku": "CAMISA-AZUL-M", "title": "Camisa azul", "quantity": 1, "reason": "defective", "condition": "pending-inspection" }],
    "requestedAt": "2026-07-20T18:30:00.000Z",
    "shippedAt": "2026-07-22T15:00:00.000Z",
    "shipmentInfo": { "trackingNumber": "1Z999AA10123456784", "carrier": "fedex", "shippedAt": "2026-07-22T15:00:00.000Z" }
  }
}

Returns the full return exactly as it was before the shipment, with status updated to return-shipped, plus shippedAt and shipmentInfo (merged with whatever already existed) — not just those loose fields — wrapped in data.

Required permission: returns:update

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

trackingNumberstringrequired

Tracking number of the return shipment.

carrierstringrequired

Carrier code. Accepted values: fedex, dhl, ups, estafeta, redpack, 99minutos, other. If your carrier is not on the list, send `other` and put its name in `carrierName`. Do not send `manual`, `automatic`, `automatica` or similar: those are capture modes —how the label was obtained—, not carriers, and the API rejects them.

waybillIdstring

Waybill ID.

labelUrlstring

URL of the PDF label.

costobject

Cost of the return shipment.

cost.labelCostnumberrequired

Cost of the label (≥ 0).

cost.feniciaFeenumber

Fenicia's fee on the shipment, if applicable (≥ 0).

cost.paidByenumrequired

Who pays for the shipment. One of: customer, seller — unlike PUT /orders/{orderId}/returns/{returnId}, the platform value does NOT exist here.

cost.currencystringrequired

3-letter currency (e.g. MXN).

originobject

Origin address of the return shipment. All fields are optional (normalization happens downstream); the schema is strict — an unknown key is rejected.

origin._idstring

ID of the saved address, if applicable.

origin.streetstring

Street.

origin.exteriorNumberstring

Exterior number.

origin.interiorNumberstring

Interior number.

origin.neighborhoodstring

Neighborhood.

origin.addressLine1string

Address line 1, for addresses that don't use the street/number breakdown.

origin.addressLine2string

Address line 2.

origin.citystring

City.

origin.statestring

State.

origin.provincestring

Province, for addresses outside Mexico.

origin.provinceCodestring

Province code.

origin.zipCodestring

ZIP/postal code.

origin.countryCodestring

Country code (ISO).

origin.countryNamestring

Country name.

origin.countrystring

Country, free-form (alternative to countryCode/countryName).

origin.referencesstring

References to locate the address.

origin.namestring

Contact name at this address.

origin.companyNamestring

Company name, if applicable.

origin.phonestring

Contact phone.

origin.emailstring

Contact email.

destinationobject

Destination address of the return shipment. Same fields as origin — all optional, strict schema.

destination._idstring

ID of the saved address, if applicable.

destination.streetstring

Street.

destination.exteriorNumberstring

Exterior number.

destination.interiorNumberstring

Interior number.

destination.neighborhoodstring

Neighborhood.

destination.addressLine1string

Address line 1, for addresses that don't use the street/number breakdown.

destination.addressLine2string

Address line 2.

destination.citystring

City.

destination.statestring

State.

destination.provincestring

Province, for addresses outside Mexico.

destination.provinceCodestring

Province code.

destination.zipCodestring

ZIP/postal code.

destination.countryCodestring

Country code (ISO).

destination.countryNamestring

Country name.

destination.countrystring

Country, free-form (alternative to countryCode/countryName).

destination.referencesstring

References to locate the address.

destination.namestring

Contact name at this address.

destination.companyNamestring

Company name, if applicable.

destination.phonestring

Contact phone.

destination.emailstring

Contact email.

Receive the returned merchandise

Registers the receipt of the returned merchandise, with its condition.

{
  "condition": "like-new"
}
200Merchandise received; with condition other than pending-inspection the return moves straight to refund-pending
{ "data": { "returnId": "65f3a1b2c4d5e6f7a8b9c0e0", "status": "refund-pending", "overallCondition": "like-new" } }
curl -X POST https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/returns/65f3a1b2c4d5e6f7a8b9c0e0/receive \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"condition":"like-new"}'

Returns the return's ID, its new status, and the registered overall condition (overallCondition), wrapped in data. The status is NOT always inspecting: receiveReturn only produces inspecting when condition is exactly pending-inspection; with any other catalog value (like-new, used-acceptable, damaged, etc.) the return moves straight to refund-pending, because the condition was already assessed in this same call.

The status depends on condition

receiveReturn (Lib/Services/Orders/src/returns/shipment-return.ts) computes newStatus = condition === "pending-inspection" ? "inspecting" : "refund-pending". Send condition: "pending-inspection" if you haven't assessed the merchandise yet and want it queued for inspection; send any other catalog value if you already assessed it on receipt, and the return will skip straight to awaiting refund.

Required permission: returns:process

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

conditionenumrequired

Condition of the merchandise received. One of: unopened, like-new, used-acceptable, used-poor, damaged, defective, pending-inspection. Hyphenated. Note: new, used, and unusable do NOT exist in this catalog.

notesstring

Notes on the receipt.

Process the refund

Processes the refund for a return already received/inspected.

{
  "amount": 799.50,
  "currency": "MXN",
  "method": "original-payment"
}
200Refund recorded — the return's status does NOT change to refunded (see the notice below)
{
  "data": {
    "returnId": "65f3a1b2c4d5e6f7a8b9c0e0",
    "status": "refund-pending",
    "refund": { "amount": 799.5, "currency": "MXN", "method": "original-payment", "status": "processing" }
  }
}
502The refund failed against the payment provider
{ "error": { "code": "returns:refund_failed", "message": "Refund could not be processed" } }
curl -X POST https://api.fenicia.io/orders/65f3a1b2c4d5e6f7a8b9c0d1/returns/65f3a1b2c4d5e6f7a8b9c0e0/refund \
  -H "Authorization: Bearer fkapi_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"amount":799.50,"currency":"MXN","method":"original-payment"}'

Returns the return with the processed refund data in data.refund (amount, currency, method, status: "processing", transactionId if sent), wrapped in data. data.status does NOT change to refunded — it stays exactly as it was before the call (see the notice below).

This endpoint never leaves the return at refunded

The body is .strict() (refundInputSchema: only accepts amount, currency, method, transactionId — no status). The handler (process-refund.ts) always builds the refund with status: "processing" before calling the library, and processRefund (refund.ts) only moves the return to refunded when it receives refundData.status === "completed" — a condition this endpoint never meets. In practice: the refund gets recorded (amount, currency, method, transactionId), but the return's status stays exactly as it was before the call.

We did not find, in this audit, a dedicated endpoint that automatically closes the return to refunded. The only verified path in the code is PUT /orders/{orderId}/returns/{returnId} with {"status": "refunded"} in the body — that validator does accept an explicit status — but that's a manual update, not an automatic consequence of processing the refund.

Required permission: returns:process

Parameters

orderIdstringrequired

Order ID

returnIdstringrequired

Return ID

amountnumberrequired

Amount to refund (> 0).

currencystringrequired

3-letter currency (e.g. MXN).

methodenumrequired

Refund method. Exactly one of: original-payment, store-credit, bank-transfer. Hyphenated — there is no generic fourth value; original_payment (underscore) fails validation.

transactionIdstring

Transaction ID of the payment method, if applicable.

Next steps