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.
  • 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

  • Staff/org token required. Customer portal alias: Customer.Appointments.Coupon.AddBatch.

Required Parameters

NameTypeSampleExplanation
customer_id
post
int108545Customer id. Aliases: cust_id, coupon_cust.
coupon_code
post
json["12345","67890"]JSON array of coupon codes (or single string).

Optional Parameters

NameTypeSampleWhat it gives
appointment_type_id
post
json["697","697"]Parallel array. Alias: coupon_appo_type_id.
insurance
post
json["2","2"]Parallel array. Alias: coupon_insurance_company.
amount
post
json["100","200"]Parallel array. Alias: coupon_amount.
left_amount
post
json["50","10"]Parallel array. Alias: coupon_left_amount.
notes
post
json["note 1","note 2"]Parallel array. Alias: coupon_note.
coupon_date
post
json["2026-02-17","2026-02-18"]Parallel array of Y-m-d dates.
order_id
post
json["0","0"]Parallel array.

Authentication

Send the bearer token returned by Login in the request header.

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.AddBatch

Sample 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"
}