I'm having a hard time understanding why the v1/coupons/generate is throwing a {"message":"One or more input exceptions have occurred."} (status_code 400) error I'm using this call to batch generate 20 coupons:

curl -X POST path/index.php/rest/V1/coupons/generate \
-H "Authorization: Bearer TOKEN" \
-H "Content-type: application/json" -g \
-d '{
  "couponSpec": {
    "rule_id": 5,
    "format": "string",
    "quantity": 20,
    "length": 0,
    "prefix": "string",
    "suffix": "string",
    "delimiter_at_every": 0,
    "delimiter": "string",
    "extension_attributes": {}

If i do a get request on this sales rule id i get the following returned:

curl -X GET path/index.php/rest/V1/salesRules/5 \
-H "Authorization: Bearer TOKEN" \
  "rule_id": 5,
  "name": "test",
  "store_labels": [],
  "description": "",
  "website_ids": [
  "customer_group_ids": [
  "from_date": "2019-02-05",
  "to_date": "2019-02-06",
  "uses_per_customer": 1,
  "is_active": true,
  "condition": {
    "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Combine",
    "aggregator_type": "all",
    "operator": null,
    "value": true
  "action_condition": {
    "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine",
    "aggregator_type": "all",
    "operator": null,
    "value": true
  "stop_rules_processing": false,
  "is_advanced": true,
  "sort_order": 0,
  "simple_action": "by_percent",
  "discount_amount": 0,
  "discount_step": 0,
  "apply_to_shipping": false,
  "times_used": 0,
  "is_rss": true,
  "coupon_type": "SPECIFIC_COUPON",
  "use_auto_generation": true,
  "uses_per_coupon": 0,
  "simple_free_shipping": "0"

I don't have anything in my exception.log file - has anyone ran into this specific issue and/or have some thoughts on how to troubleshoot why this error is being placed.

I have been following the docs here https://devdocs.magento.com/swagger/#resource_salesRuleCouponManagementV1 to make the requests

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.