Update Lab Coupon (v1)
Method & Path
PATCH /api/v1/workspace/:workspaceId/labs/coupons/:couponId
Actual backend path: /v1/workspace/:workspaceId/labs/coupons/:couponId
Description
Update an existing lab coupon in the workspace.
Authentication
Required: JWT token in Authorization header
Required Permissions:
labs.manage
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token: Bearer <token> |
Content-Type | string | Yes | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | Workspace identifier (MongoDB ObjectId) |
couponId | string | Yes | Lab coupon identifier (MongoDB ObjectId) |
Request Body
{
"couponTitle": "Summer Sale 2025 - Updated",
"couponValue": 20,
"couponStatus": "inactive"
}
| Field | Type | Required | Description |
|---|---|---|---|
couponTitle | string | No | Coupon title (1-500 characters) |
couponCode | string | No | Unique coupon code (1-100 characters) |
couponType | string | No | Coupon type: "percentage" or "currency" |
couponValue | number | No | Discount value (must be >= 0) |
couponStatus | string | No | Coupon status: "active" or "inactive" |
Response 200 OK
{
"labCoupon": {
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"couponTitle": "Summer Sale 2025 - Updated",
"couponCode": "SUMMER25",
"couponType": "percentage",
"couponValue": 20,
"couponStatus": "inactive",
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T11:00:00.000Z",
"deletedAt": null
}
}
Common Errors
400 Bad Request: Invalid request body
401 Unauthorized: Missing or invalid authentication token
403 Forbidden: Insufficient permissions (labs.manage required)
404 Not Found: Lab coupon or workspace not found
409 Conflict: Lab coupon with the same code already exists
422 Validation Error: Invalid workspace ID, coupon ID format, or validation errors