POST
Customer.Appointments.Coupon.Add
Create one appointment coupon for the logged-in customer. Same fields as dashboard Add Coupon modal. cust_id is forced from JWT. Staff equivalent: AppointmentCoupon.Add.
Permissions
- User must be logged in with a valid bearer token.
- Returned or changed records are limited by the user permissions, team access, folder access, and account settings.
Action
- Runs the Customer.Appointments.Coupon.Add function and returns JSON.
Push Service
No push is sent because this function only reads data or returns helper information.
Automation
No automation is run for this function.
Special Instructions
- Requires Customer.Login token. Do not send customer_id / cust_id — ignored; always JWT c_id.
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
coupon_codepost | string | 12345 | Unique coupon code for this organization. |
appointment_type_idpost | int | 697 | doctor_appointments_type id. Aliases: coupon_appo_type_id, appointments_type_id, appo_type_id. |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
insurancepost | int | 2 | appointment_insurance_company id. Aliases: coupon_insurance_company, insurance_id. |
amountpost | number | 100 | Coupon amount. Alias: coupon_amount. |
left_amountpost | number | 50 | Left amount. Alias: coupon_left_amount. |
notespost | string | this coupon offer you | Notes. Alias: coupon_note. |
coupon_datepost | date | 2026-02-17 | Coupon date Y-m-d. Defaults to today. Send date filters and date values as UTC Y-m-d H:i:s when the route accepts date/time; date-only table columns store the Y-m-d date part. |
order_idpost | int | 0 | Optional coupon order id. |
Authentication
Send the bearer token returned by Login in the request header.
Authorization: Bearer YOUR TOKEN
Sample Request
{
"url": "\/app\/Customer.Appointments.Coupon.Add",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"coupon_code": "12345",
"appointment_type_id": "697",
"insurance": "2",
"amount": "100",
"left_amount": "50",
"notes": "this coupon offer you",
"coupon_date": "2026-02-17"
},
"url_user": "https:\/\/{user}.bull36.com\/app\/Customer.Appointments.Coupon.Add",
"url_domain": "https:\/\/{domain}\/app\/Customer.Appointments.Coupon.Add"
}Endpoint
POST /app/Customer.Appointments.Coupon.Add
POST https://{user}.bull36.com/app/Customer.Appointments.Coupon.Add
POST https://{domain}/app/Customer.Appointments.Coupon.AddSample Output
{
"success": 1,
"message": "Customer Coupon added",
"coupon_id": 388,
"data": {
"id": 388,
"coupon_code": "12345",
"status_label": "unused",
"can_edit": true,
"can_delete": true
}
}JavaScript Example
const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('coupon_code', '12345');
body.set('appointment_type_id', '697');
body.set('insurance', '2');
body.set('amount', '100');
body.set('left_amount', '50');
body.set('notes', 'this coupon offer you');
body.set('coupon_date', '2026-02-17');
const res = await fetch('/app/Customer.Appointments.Coupon.Add', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body
});
const data = await res.json();
console.log(data);Error Example
{
"success": 2,
"error": "coupon_code_exists",
"message": "This coupons already exists : 12345"
}