Skip to main content

Create Feedback(s)

This endpoint allows the creation of one or more feedback entries associated with specific tenant transactions.


Authorization

HeaderValue
Api-keystring (tkn_ten_XXX..)
Content-Typeapplication/json

Endpoint

POST https://enrichment-prd-uae.lunedata.io/api/v2/feedbacks/

Request Body Schema

FieldTypeRequiredDescription
feedbackobjectYesWrapper object holding the feedback details.
↳ transaction_idsarray[string]YesNon-empty array of ref transaction IDs or global transaction IDs for which feedback is being submitted.
↳ feedback_typestringYesOne of wrong_category, wrong_brand, wrong_logo.
↳ category_idintegerConditionalThe correct category. Used when feedback_type is wrong_category. Must be a valid ID from the categories lookup.
↳ brand_idintegerOptionalThe correct brand ID being suggested. Typically used with feedback_type: "wrong_brand".
↳ recommendationstringConditionalRequired when feedback_type is wrong_brand, and when feedback_type is wrong_category and no category_id is provided.
↳ descriptionstringNoAdditional descriptive text for the feedback.

Validation Rules

  • transaction_ids must be a non-empty array of ref_id or global_tx_id values taken from an enrichment response.
  • feedback_type must be exactly one of wrong_category, wrong_brand, or wrong_logo.
  • When feedback_type is wrong_category, supply either a valid category_id or a non-blank recommendation.
  • When feedback_type is wrong_brand, recommendation is required and cannot be blank.
  • Uniqueness Constraint: Each transaction can only have one pending feedback entry.
  • Atomicity: All feedback entries are created within a single database transaction. If the creation of any single feedback fails (e.g., due to validation), all created feedback entries are rolled back.
  • Duplicate transaction IDs provided in the transaction_ids array will be automatically deduplicated before processing.

Request Example

POST /api/v2/feedbacks/
Api-key: tkn_ten_XXX*************************
Content-Type: application/json
{
"feedback": {
"transaction_ids": ["bwq1-437c-c027", "437c-c027-bwq1", "c027-bwq1-437c"],
"feedback_type": "wrong_category",
"category_id": 5,
"brand_id": null,
"description": "Category is incorrect",
"recommendation": null
}
}

Success Response

201 Created

{
"success": true,
"message": "Feedback submitted successfully!",
"data": null
}
FieldTypeDescription
successbooleanAlways true for a successful response.
messagestringSuccess message.
datanullNot used by this endpoint.

Error Responses

422 Unprocessable Entity is returned for validation failures and missing resources.

ScenarioResponse body
Transaction not found{ "success": false, "error": "Tenant Transaction with id [MISSING_ID] not found", "status_code": 422 }
Duplicate pending feedback{ "success": false, "error": "Failed to save feedback: Tenant transaction already has a pending feedback", "status_code": 422 }
Missing recommendation{ "success": false, "error": "recommendation is required with the selected option", "status_code": 422 }
Invalid feedback_type{ "success": false, "error": "Invalid feedback_type", "status_code": 422 }
transaction_ids is not an array{ "success": false, "error": "transaction_ids should be a non empty array", "status_code": 422 }
category_id does not exist{ "success": false, "error": "Invalid category_id", "status_code": 422 }