Overview
The Coupon Management APIs provide comprehensive functionality for creating discount codes, managing promotional campaigns, tracking coupon usage, and analyzing campaign effectiveness across the TalentG platform.
Base URL
Authentication
Coupon management requires admin-level authentication for creation and management operations.
Authorization : Bearer <supabase_jwt_token>
Content-Type : application/json
Coupon CRUD Operations
List Coupons
Create Coupon
Update Coupon
Delete Coupon
Coupon Validation & Application
Validate Coupon (Already documented in Payments API)
The coupon validation endpoint is documented in the Payments API section .
Apply Coupon (Already documented in Payments API)
The coupon application endpoint is documented in the Payments API section .
Coupon Usage Tracking
Get Coupon Usage Details
Bulk Operations
Bulk Create Coupons
Bulk Update Coupons
Coupon Types
Percentage Discount
Reduces the total amount by a percentage.
{
"discount_type" : "percentage" ,
"discount_value" : 20 // 20% off
}
Fixed Amount Discount
Reduces the total amount by a fixed amount in paise.
{
"discount_type" : "fixed_amount" ,
"discount_value" : 10000 // ₹100 off
}
Free Access
Provides 100% discount for complete free access.
{
"discount_type" : "free_access" ,
"discount_value" : null // 100% discount
}
Applicable Services
Coupons can be restricted to specific services/features:
Service Key Description strength_finderStrength Finder Assessment premium_supportPremium Support Access advanced_analyticsAdvanced Analytics Dashboard training_programsTraining Programs Access allAll services (wildcard)
Error Handling
Common Error Codes
Code HTTP Status Description UNAUTHORIZED401 User not authenticated FORBIDDEN403 Admin access required COUPON_EXISTS409 Coupon code already exists INVALID_DISCOUNT400 Invalid discount configuration USAGE_LIMIT_EXCEEDED400 Coupon usage limit reached COUPON_EXPIRED400 Coupon has expired
{
"success" : false ,
"error" : {
"code" : "COUPON_EXISTS" ,
"message" : "Coupon code already exists" ,
"details" : {
"code" : "SAVE20" ,
"existing_coupon_id" : "coupon_123"
}
}
}
Rate Limiting
Read operations : 1000 requests per hour per user
Create/Update operations : 500 requests per hour per user
Bulk operations : 50 requests per hour per user
Validation operations : 2000 requests per hour per user
SDK Examples
JavaScript - Create Coupon
Python - List Coupons
const createCoupon = async ( couponData ) => {
const token = await getSupabaseToken ();
const response = await fetch ( '/api/admin/coupons' , {
method: 'POST' ,
headers: {
'Authorization' : `Bearer ${ token } ` ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ( couponData )
});
return response . json ();
};
// Usage
const coupon = await createCoupon ({
code: 'FLASH50' ,
description: 'Flash sale 50% off' ,
discount_type: 'percentage' ,
discount_value: 50 ,
applicable_services: [ 'strength_finder' ],
expiration_date: '2025-11-01T23:59:59Z'
});
Best Practices
Use uppercase letters and numbers only
Keep codes between 6-12 characters
Avoid special characters except underscores
Make codes memorable and brandable
Usage Limits
Set reasonable usage limits to prevent abuse
Consider per-user limits for fairness
Monitor usage patterns and adjust limits as needed
Expiration Management
Set appropriate expiration dates based on campaign goals
Consider timezone implications for global users
Provide clear expiration notifications
Security Considerations
Validate all coupon inputs server-side
Implement rate limiting on validation endpoints
Log all coupon usage for audit trails
Use secure random generation for bulk codes
Coupon codes are case-sensitive and should be validated exactly as entered by users. Always implement server-side validation to prevent abuse.
Coupon analytics are automatically tracked and can be viewed through the Analytics API. Monitor campaign performance regularly to optimize promotional strategies.