The Edit Offer API allows authorized users (admins, vendors, employees) to update specific fields of an offer based on their role and the origin of the offer. Admins can update approval status and remarks for vendor offers, while vendors and employees can update their own offers' content and reset the approval status to pending.Endpoint
Path Parameters
Name
Type
Required
Description
id
string
Yes
The ID of the offer to be updated (MongoDB ObjectId).
AuthenticationUser must be authenticated and authorized based on their role (admin, subAdmin, vendor, or employee).Request BodyFields are dynamic based on role and existing offer type. The body may include any of the following:
Name
Type
Required
Description
title
string
Optional
Offer title.
description
string
Optional
Description of the offer.
startDate
string
Optional
ISO date string for the offer's start.
endDate
string
Optional
ISO date string for the offer's end.
status
string
Optional
Offer status (e.g., active, inactive).
offerType
string
Optional
Type of the offer (if editable by the user).
image
file
Optional
New image file (handled via multipart upload).
approvalStatus
string
Optional
Admins can update status (Approved, Rejected, etc.).
remarks
string
Optional
Optional remarks (admin-only update).
🔒 Field-Level Permissions by Role
Field
Admin/SubAdmin (Vendor Offers)
Vendor / Employee (Vendor Offers)
Admin (Admin Offers)
title
❌
✅
✅
description
❌
✅
✅
startDate
❌
✅
✅
endDate
❌
✅
✅
status
❌
✅
✅
image (file)
❌
✅
✅
offerType
❌
❌
✅
approvalStatus
✅
⚠️ (automatically set to "Pending")
✅
remarks
✅
❌
✅
Response
Status Code
Description
200
Offer updated successfully.
400
Invalid offer ID, validation error, or bad input.
401
Unauthorized - authentication required.
403
Forbidden - user does not have permission to update this offer.
404
Not Found - offer not found.
500
Internal Server Error.
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.