Skip to content

券模板 ​

GET /coupon-templates

权限范围幂等operationId
assets:read只读Assets_couponTemplates

本店券模板,发券前用来挑模板。status=enabled 只看启用的(默认),all 看全部。

参数 ​

名称位置类型必填说明
status查询stringenabled 只看启用的(默认)/ all 全部(默认 enabled)

示例 ​

js
const res = await client.get("/coupon-templates");
http
GET /open/v1/coupon-templates HTTP/1.1
Host: api.sybb.pw
Authorization: SY-HMAC-SHA256 Credential=ak_…, Timestamp=1796035200, Nonce=…, Signature=…

响应 200:

json
{
  "items": [
    {
      "templateId": "ctpl_12bSxK7PtEm1DoKtT0783s3",
      "name": "周末双排体验券",
      "type": "full_reduction",
      "discountValueCents": 10000,
      "discountRate": 1,
      "minAmountCents": 10000,
      "maxDiscountCents": 10000,
      "validityRule": "fixed_period",
      "validDays": 30,
      "validFrom": "2026-11-30T20:15:00+08:00",
      "validTo": "2026-11-30T20:15:00+08:00",
      "enabled": true,
      "totalQuantity": 1,
      "issuedCount": 1,
      "description": "说明文字"
    }
  ]
}

响应 ​

CouponTemplateView ​

字段类型必填说明
templateIdstring券模板 ID(ctpl_…)
namestring名称
typestringfull_reduction 满减 / discount 折扣 / direct_reduction 直减 / free 免单
discountValueCentsinteger金额(分)
discountRatenumber折扣(如 8.5 = 八五折);非折扣券为 null
minAmountCentsinteger金额(分)
maxDiscountCentsinteger金额(分)
validityRulestringfixed_period 固定时间段 / days_after_issue 领取后 N 天 / permanent 永久
validDaysinteger领取后有效天数(validityRule = days_after_issue 时)
validFromstringRFC 3339,如 2026-11-30T20:15:00+08:00
validTostringRFC 3339,如 2026-11-30T20:15:00+08:00
enabledboolean是是否启用
totalQuantityinteger发行总量(null = 不限)
issuedCountinteger已发数量
descriptionstring说明

错误 ​

签名、权限、限流等通用错误见错误处理。

ByteForge · 神运开放平台接口地址 https://api.sybb.pw/open/v1