Create coupon

Create a coupon with a discount type, amount, expiry date, usage limits and allowed emails.

POST https://cotlet.dev/api/v1/woocommerce/coupons

write Confirm

Creates one coupon. The code is required and not case-sensitive. discount_type is percent, fixed_cart or fixed_product, the default is fixed_cart, and amount is a number given as a string, also for percentages. Add date_expires, usage limits, a minimum or maximum spend, and email_restrictions to tie the code to customers. A coupon gives money off at checkout, so it is treated as reaching your customers. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: create_coupon
NameTypeDescription
code string required string Coupon code. Not case-sensitive.
amount string required string Discount as a number, for example "15", also for percentages.
discount_type enum enum percent, fixed_cart or fixed_product. Default: fixed_cart.
date_expires date date Last day the coupon works, YYYY-MM-DD.
usage_limit integer integer Total uses across all customers.
usage_limit_per_user integer integer Uses allowed per customer.
minimum_amount string string Minimum spend for the coupon to apply.
free_shipping boolean boolean true makes the coupon work with free shipping. Default: false.
email_restrictions array array Billing emails allowed to use the coupon; wildcards such as *@gmail.com work.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/woocommerce/coupons \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"SPRING-JL3K","amount":"15","discount_type":"percent","date_expires":"2026-11-30","usage_limit":1,"usage_limit_per_user":1,"email_restrictions":["jordan.lee@example.com"]}'
Python
result = client.call("woocommerce", "create_coupon", {"code":"SPRING-JL3K","amount":"15","discount_type":"percent","date_expires":"2026-11-30","usage_limit":1,"usage_limit_per_user":1,"email_restrictions":["jordan.lee@example.com"]})
Node.js
const result = await cotlet.call('woocommerce', 'create_coupon', {"code":"SPRING-JL3K","amount":"15","discount_type":"percent","date_expires":"2026-11-30","usage_limit":1,"usage_limit_per_user":1,"email_restrictions":["jordan.lee@example.com"]});
CLI
cotlet call woocommerce create_coupon --data '{"code":"SPRING-JL3K","amount":"15","discount_type":"percent","date_expires":"2026-11-30","usage_limit":1,"usage_limit_per_user":1,"email_restrictions":["jordan.lee@example.com"]}'

Example response

JSON

{
  "coupon_id": 2210,
  "code": "SPRING-JL3K",
  "discount_type": "percent",
  "amount": "15",
  "date_expires": "2026-11-30",
  "usage_limit": 1,
  "usage_limit_per_user": 1,
  "email_restrictions": [
    "jordan.lee@example.com"
  ]
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.