POST
AppointmentCoupon.Add
Create one appointment coupon for a customer. Same fields as the dashboard Add/Edit Coupon modal (Advance → Appointment Coupon Report → ADD COUPONS). Returns coupon_id and structured data.
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
- Creates a AppointmentCoupon record or sends the requested data after validation.
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
- Staff/org token required. Customer portal alias (cust_id from JWT): Customer.Appointments.Coupon.Add.
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
customer_idpost | int | 108545 | Customer id. Aliases: cust_id, coupon_cust. |
coupon_codepost | string | 12345 | Unique coupon code for this organization. |
appointment_type_idpost | int | 697 | doctor_appointments_type id. Alias: coupon_appo_type_id. |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
insurancepost | int | 2 | appointment_insurance_company id. Alias: coupon_insurance_company. |
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\/AppointmentCoupon.Add",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"customer_id": "108545",
"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\/AppointmentCoupon.Add",
"url_domain": "https:\/\/{domain}\/app\/AppointmentCoupon.Add"
}Endpoint
POST /app/AppointmentCoupon.Add
POST https://{user}.bull36.com/app/AppointmentCoupon.Add
POST https://{domain}/app/AppointmentCoupon.AddSample Output
{
"success": 1,
"message": "Customer Coupon added",
"coupon_id": 388,
"data": {
"id": 388,
"coupon_code": "12345",
"customer_id": 108545,
"status_label": "unused"
}
}JavaScript Example
const token = 'YOUR TOKEN';
const body = new URLSearchParams({ customer_id: '108545', coupon_code: '12345', appointment_type_id: '697', amount: '100', left_amount: '50' });
const res = await fetch('/app/AppointmentCoupon.Add', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
console.log(await res.json());Error Example
{
"success": 2,
"error": "coupon_code_exists",
"message": "This coupons already exists : 12345"
}