外观
券模板
GET /coupon-templates
| 权限范围 | 幂等 | operationId |
|---|---|---|
assets:read | 只读 | Assets_couponTemplates |
本店券模板,发券前用来挑模板。status=enabled 只看启用的(默认),all 看全部。
参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
status | 查询 | string | enabled 只看启用的(默认)/ 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
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
templateId | string | 券模板 ID(ctpl_…) | |
name | string | 名称 | |
type | string | full_reduction 满减 / discount 折扣 / direct_reduction 直减 / free 免单 | |
discountValueCents | integer | 金额(分) | |
discountRate | number | 折扣(如 8.5 = 八五折);非折扣券为 null | |
minAmountCents | integer | 金额(分) | |
maxDiscountCents | integer | 金额(分) | |
validityRule | string | fixed_period 固定时间段 / days_after_issue 领取后 N 天 / permanent 永久 | |
validDays | integer | 领取后有效天数(validityRule = days_after_issue 时) | |
validFrom | string | RFC 3339,如 2026-11-30T20:15:00+08:00 | |
validTo | string | RFC 3339,如 2026-11-30T20:15:00+08:00 | |
enabled | boolean | 是 | 是否启用 |
totalQuantity | integer | 发行总量(null = 不限) | |
issuedCount | integer | 已发数量 | |
description | string | 说明 |
错误
签名、权限、限流等通用错误见错误处理。