POST

Customer.Appointments.Coupon.AddBatch

Create multiple appointment coupons for the logged-in customer in one call. Same as dashboard Add Coupons modal with coupon_code[] arrays. cust_id forced from JWT. Staff equivalent: AppointmentCoupon.AddBatch.

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 Customer.Appointments.Coupon.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.
  • Requires Customer.Login token. Do not send customer_id — always JWT c_id.

Required Parameters

NameTypeSampleExplanation
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. 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\/Customer.Appointments.Coupon.AddBatch",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "coupon_code": "[\"12345\",\"67890\"]",
        "appointment_type_id": "[\"697\",\"697\"]",
        "amount": "[\"100\",\"200\"]",
        "left_amount": "[\"50\",\"10\"]"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Customer.Appointments.Coupon.AddBatch",
    "url_domain": "https:\/\/{domain}\/app\/Customer.Appointments.Coupon.AddBatch"
}

Endpoint

POST /app/Customer.Appointments.Coupon.AddBatch
POST https://{user}.bull36.com/app/Customer.Appointments.Coupon.AddBatch
POST https://{domain}/app/Customer.Appointments.Coupon.AddBatch

Sample Output

{
    "success": 1,
    "message": "Customer Coupon added",
    "count": 2,
    "coupon_ids": [
        388,
        389
    ]
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('coupon_code', '[\"12345\",\"67890\"]');
body.set('appointment_type_id', '[\"697\",\"697\"]');
body.set('amount', '[\"100\",\"200\"]');
body.set('left_amount', '[\"50\",\"10\"]');

const res = await fetch('/app/Customer.Appointments.Coupon.AddBatch', {
  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"
}