POST
AppointmentCoupon.AddBatch
Create multiple appointment coupons for one customer in a single call. Same as the dashboard Add Coupons modal with coupon_code[] arrays.
Permissions
- User must be logged in with a valid bearer token.
- The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
- Returned or changed records are limited by the user permissions, team access, folder access, and account settings.
Action
- Runs the AppointmentCoupon.AddBatch 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
- On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
- Staff/org token required. Customer portal alias: Customer.Appointments.Coupon.AddBatch.
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
customer_idpost | int | 108545 | Customer id. Aliases: cust_id, coupon_cust. |
coupon_codepost | json | ["12345","67890"] | JSON array of coupon codes (or single string). |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
appointment_type_idpost | json | ["697","697"] | Parallel array. Alias: coupon_appo_type_id. |
insurancepost | json | ["2","2"] | Parallel array. Alias: coupon_insurance_company. |
amountpost | json | ["100","200"] | Parallel array. Alias: coupon_amount. |
left_amountpost | json | ["50","10"] | Parallel array. Alias: coupon_left_amount. |
notespost | json | ["note 1","note 2"] | Parallel array. Alias: coupon_note. |
coupon_datepost | json | ["2026-02-17","2026-02-18"] | Parallel array of Y-m-d dates. |
order_idpost | json | ["0","0"] | Parallel array. |
Authentication
Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).
Authorization: Bearer YOUR TOKEN
Sample Request
{
"url": "\/app\/AppointmentCoupon.AddBatch",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"customer_id": "108545",
"coupon_code": "[\"12345\",\"67890\"]",
"appointment_type_id": "[\"697\",\"697\"]",
"amount": "[\"100\",\"200\"]",
"left_amount": "[\"50\",\"10\"]"
},
"url_user": "https:\/\/{user}.bull36.com\/app\/AppointmentCoupon.AddBatch",
"url_domain": "https:\/\/{domain}\/app\/AppointmentCoupon.AddBatch"
}Endpoint
POST /app/AppointmentCoupon.AddBatch
POST https://{user}.bull36.com/app/AppointmentCoupon.AddBatch
POST https://{domain}/app/AppointmentCoupon.AddBatchSample Output
{
"success": 1,
"message": "Customer Coupon added",
"count": 2,
"coupon_codes": [
"12345",
"67890"
]
}JavaScript Example
const token = 'YOUR TOKEN';
const res = await fetch('/app/AppointmentCoupon.AddBatch', {
method: 'POST',
headers: { Authorization: 'Bearer ' + token, 'Content-Type': 'application/json' },
body: JSON.stringify({ customer_id: '108545', coupon_code: ['12345','67890'], appointment_type_id: ['697','697'], amount: ['100','200'], left_amount: ['50','10'] })
});
console.log(await res.json());Error Example
{
"success": 2,
"error": "coupon_code_exists",
"message": "This coupons already exists : 12345"
}