À quoi sert la ressource « Retours & RMA » ?
Retours clients/fournisseurs (RMA) — réception avec arbitrage du rebut, résolutions à effet (avoir, échange, réparation, rejet)
Quels endpoints sont disponibles ?
| Méthode | Adresse | Action |
|---|---|---|
| GET | /api/v1/returns et /{id} | lire (liste paginée ou un élément par identifiant) |
| POST | /api/v1/returns | créer un élément |
| PUT | /api/v1/returns/{id} | remplacer un élément |
| PATCH | /api/v1/returns/{id} | modifier certains champs |
| DELETE | /api/v1/returns/{id} | supprimer un élément |
Quels champs contient la ressource « Retours & RMA » ?
| Champ | Type et description |
|---|---|
| id | string |
| tenantId | string |
| tenant_id | string — alias legacy de tenantId, présent sur les dossiers anciens, ne pas utiliser en écriture |
| rmaNumber | string — n° RMA réservé de façon atomique |
| clientId | string |
| sourceDocId | string — document d'origine (facture/BL) |
| sourceDocNumber | string |
| date | ISO8601 |
| receivedAt | ISO8601 |
| diagnosedAt | ISO8601 |
| resolvedAt | ISO8601 |
| slaDeadline | ISO8601 |
| status | Ouvert|Reçu en entrepôt|En diagnostic|En réparation|Prêt à expédier|Résolu|Clôturé|Rejeté |
| priority | low|normal|high|urgent |
| channel | email|phone|store|portal|courier|other |
| resolutionType | refund|exchange|repair|credit_note|reject|pending |
| warrantyStatus | in_warranty|out_warranty|expired|commercial |
| items | ReturnItem[] — { id, productId, productName, sku, serialNumber, quantity, unitPrice, reason, defectCode, conditionOnArrival: intact|damaged|incomplete|destroyed, resolution |
| assignedTo | string |
| customerNotes | string |
| internalNotes | string |
| refusalReason | string — motif obligatoire d'un rejet |
| shippingCarrierReturn | string |
| trackingNumberReturn | string |
| creditNoteId | string — avoir réellement généré par la résolution |
| creditNoteAmount | number |
| totalRefundAmount | number — recalculé depuis les lignes à l'enregistrement |
| exchangeDocId | string — BL de remplacement généré par la résolution « Échange » (garde anti-doublon) |
| exchangeDocNumber | string |
| repairStartedAt | ISO8601 |
| repairCompletedAt | ISO8601 — exigé pour passer « Résolu » |
| repairReturnedToClientAt | ISO8601 — exigé pour passer « Clôturé » |
| rejectDisposition | returned|destroyed — sort de la marchandise d'un retour rejeté |
| rejectStockApplied | boolean — idempotence de la sortie de stock du rejet |
| scrapAdjustments | ReturnScrapAdjustment[] — rebuts décidés APRÈS réception : { id, date, author, lines: [{ itemId, productId, quantity, reason }] } |
| stockAdjusted | boolean — réception passée au grand livre de stock (verrouille l'arbitrage du rebut) |
| customerSatisfactionScore | number |
| tags | string[] |
| history | ReturnHistoryEntry[] — { date, status, note, author } |
| isUnderWarranty | boolean |
| productId | string — legacy mono-ligne, remplacé par items[] |
| reason | string — legacy mono-ligne |
| quantity | number — legacy mono-ligne |
| createdAt | ISO8601 |
| updatedAt | ISO8601 |
Comment filtrer, trier et paginer ?
Exemple de lecture filtrée et triée : GET /api/v1/returns?filter[tenant_id]=…&sort=rmaNumber:desc&limit=50.
Le filtre est une égalité stricte sur un champ déclaré, le tri s’écrit champ:asc ou champ:desc, la page contient 50 éléments par défaut et 200 au plus, un champ inconnu renvoie une erreur 400 plutôt qu’un résultat faux.
Quelles autorisations faut-il ?
- Une offre qui inclut l’API publique : Enterprise.
- Une clé d’API créée dans Système › Intégrations, envoyée dans l’en-tête Authorization: Bearer, limitée au dossier qui l’a émise.
- Une portée accordée à la clé pour cette ressource : lecture, écriture et suppression.