凭据决定 App、环境、身份与权限;范围头只核对。客户请求不接受任意 customerId。Funnel 命令保留原 requestId、当前节点与 revision;超时 retry 重放原输入。
| 方法 | 路径 | 调用方 | 权限 |
|---|---|---|---|
| POST | /api/v1/billing/setup-payment | mixed | billing:write |
| POST | /api/v1/billing/payment-setup | mixed | billing:read |
| POST | /api/v1/subscriptions/batches/preview | server | billing:write |
| POST | /api/v1/subscriptions/batches/confirm | server | billing:write |
| POST | /api/v1/subscriptions/batches/read | server | billing:read |
| POST | /api/v1/subscriptions/batches/abandon | server | billing:write |
| POST | /api/v1/subscriptions/trials/manage | server | billing:write |
| POST | /api/v1/subscriptions/trials/read | server | billing:read |
| POST | /api/v1/subscriptions/list | server | billing:read |
| POST | /api/v1/purchases/list | server | billing:read |
| POST | /api/v1/subscriptions/conflicts/list | server | billing:read |
| POST | /api/v1/subscriptions/conflicts/retry | server | billing:write |
| POST | /api/v1/ai/pricing/read | server | credits:read |
| POST | /api/v1/usage/read | server | credits:read |
| POST | /api/v1/usage/set | server | credits:manage |
| POST | /api/v1/subscriptions/refunds/preview | server | billing:read |
| POST | /api/v1/subscriptions/refunds/confirm | server | billing:write |
| POST | /api/v1/subscriptions/refunds/read | server | billing:read |
| POST | /api/v1/subscriptions/preview-update | mixed | billing:read |
| POST | /api/v1/subscriptions/update | mixed | billing:write |
| POST | /api/v1/subscriptions/updates/read | mixed | billing:read |
| POST | /api/v1/subscriptions/native/restore | mixed | billing:write |
| POST | /api/v1/subscriptions/verify | server | billing:read |
| POST | /api/v1/subscriptions/preview-attach | mixed | billing:read |
| POST | /api/v1/subscriptions/attach | mixed | billing:write |
| POST | /api/v1/subscriptions/operations/read | mixed | billing:read |
| POST | /api/v1/balances/grants/manage | server | credits:manage |
| POST | /api/v1/balances/source/read | server | credits:read |
| POST | /api/v1/balances/source/adjust | server | credits:manage |
| POST | /api/v1/balances/grants/list | server | credits:read |
| POST | /api/v1/billing/controls/read | customer | billing:read |
| POST | /api/v1/billing/authorizations/prepare | customer | billing:write |
| POST | /api/v1/billing/authorizations/confirm | customer | billing:write |
| POST | /api/v1/billing/coupons | customer | billing:write |
| POST | /api/v1/billing/authorizations/revoke | customer | billing:write |
| POST | /api/v1/billing/invoices/read | customer | billing:read |
| POST | /api/v1/billing/invoices/confirm-adjustment | customer | billing:write |
| POST | /api/v1/billing/controls/manage | server | billing:write |
| POST | /api/v1/customers | server | customers:write |
| POST | /api/v1/customers/get | server | customers:read |
| POST | /api/v1/customers/list | server | customers:read |
| POST | /api/v1/customers/update | server | customers:write |
| POST | /api/v1/customer-sessions | server | sessions:create |
| POST | /api/v1/customer-sessions/renew | server | sessions:create |
| POST | /api/v1/customer-sessions/revoke | server | sessions:create |
| POST | /api/v1/customers/guests | server | sessions:create |
| POST | /api/v1/customers/guests/session | server | sessions:create |
| POST | /api/v1/customers/guests/claim | server | customers:write |
| POST | /api/v1/entitlements/check | mixed | entitlements:read |
| POST | /api/v1/customer-holdings | mixed | entitlements:read |
| POST | /api/v1/customer-ledger | mixed | credits:read |
| POST | /api/v1/billing/invoices/detail | mixed | billing:read |
| POST | /api/v1/credit-statements/read | mixed | credits:read |
| POST | /api/v1/balances/quote | mixed | credits:read |
| POST | /api/v1/balances/execute | server | credits:consume |
| POST | /api/v1/usage/entities | server | credits:manage |
| POST | /api/v1/usage/analytics | server | credits:read |
| POST | /api/v1/credits/analytics | server | credits:read |
| POST | /api/v1/usage/batch | server | credits:consume |
| POST | /api/v1/usage/batch/read | server | credits:read |
| GET | /api/v1/offers | customer | offers:resolve |
| POST | /api/v1/offers/grant | server | offers:grant |
| POST | /api/v1/offers/redeem | customer | offers:resolve |
| POST | /api/v1/rewards/redeem | customer | offers:resolve |
| POST | /api/v1/rewards/referral-code | customer | offers:resolve |
| POST | /api/v1/rewards/product/claim | customer | offers:resolve |
| POST | /api/v1/seats/list | server | customers:read |
| POST | /api/v1/seats/manage | server | billing:write |
当前 HTTP 接口与权限
POST
- 路径
- /api/v1/billing/setup-payment
- 调用方
- mixed
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/payment-setup
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/batches/preview
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/batches/confirm
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/batches/read
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/batches/abandon
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/trials/manage
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/trials/read
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/list
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/purchases/list
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/conflicts/list
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/conflicts/retry
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/ai/pricing/read
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/usage/read
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/usage/set
- 调用方
- server
- 权限
- credits:manage
POST
- 路径
- /api/v1/subscriptions/refunds/preview
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/refunds/confirm
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/refunds/read
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/preview-update
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/update
- 调用方
- mixed
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/updates/read
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/native/restore
- 调用方
- mixed
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/verify
- 调用方
- server
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/preview-attach
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/subscriptions/attach
- 调用方
- mixed
- 权限
- billing:write
POST
- 路径
- /api/v1/subscriptions/operations/read
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/balances/grants/manage
- 调用方
- server
- 权限
- credits:manage
POST
- 路径
- /api/v1/balances/source/read
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/balances/source/adjust
- 调用方
- server
- 权限
- credits:manage
POST
- 路径
- /api/v1/balances/grants/list
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/billing/controls/read
- 调用方
- customer
- 权限
- billing:read
POST
- 路径
- /api/v1/billing/authorizations/prepare
- 调用方
- customer
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/authorizations/confirm
- 调用方
- customer
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/coupons
- 调用方
- customer
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/authorizations/revoke
- 调用方
- customer
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/invoices/read
- 调用方
- customer
- 权限
- billing:read
POST
- 路径
- /api/v1/billing/invoices/confirm-adjustment
- 调用方
- customer
- 权限
- billing:write
POST
- 路径
- /api/v1/billing/controls/manage
- 调用方
- server
- 权限
- billing:write
POST
- 路径
- /api/v1/customers
- 调用方
- server
- 权限
- customers:write
POST
- 路径
- /api/v1/customers/get
- 调用方
- server
- 权限
- customers:read
POST
- 路径
- /api/v1/customers/list
- 调用方
- server
- 权限
- customers:read
POST
- 路径
- /api/v1/customers/update
- 调用方
- server
- 权限
- customers:write
POST
- 路径
- /api/v1/customer-sessions
- 调用方
- server
- 权限
- sessions:create
POST
- 路径
- /api/v1/customer-sessions/renew
- 调用方
- server
- 权限
- sessions:create
POST
- 路径
- /api/v1/customer-sessions/revoke
- 调用方
- server
- 权限
- sessions:create
POST
- 路径
- /api/v1/customers/guests
- 调用方
- server
- 权限
- sessions:create
POST
- 路径
- /api/v1/customers/guests/session
- 调用方
- server
- 权限
- sessions:create
POST
- 路径
- /api/v1/customers/guests/claim
- 调用方
- server
- 权限
- customers:write
POST
- 路径
- /api/v1/entitlements/check
- 调用方
- mixed
- 权限
- entitlements:read
POST
- 路径
- /api/v1/customer-holdings
- 调用方
- mixed
- 权限
- entitlements:read
POST
- 路径
- /api/v1/customer-ledger
- 调用方
- mixed
- 权限
- credits:read
POST
- 路径
- /api/v1/billing/invoices/detail
- 调用方
- mixed
- 权限
- billing:read
POST
- 路径
- /api/v1/credit-statements/read
- 调用方
- mixed
- 权限
- credits:read
POST
- 路径
- /api/v1/balances/quote
- 调用方
- mixed
- 权限
- credits:read
POST
- 路径
- /api/v1/balances/execute
- 调用方
- server
- 权限
- credits:consume
POST
- 路径
- /api/v1/usage/entities
- 调用方
- server
- 权限
- credits:manage
POST
- 路径
- /api/v1/usage/analytics
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/credits/analytics
- 调用方
- server
- 权限
- credits:read
POST
- 路径
- /api/v1/usage/batch
- 调用方
- server
- 权限
- credits:consume
POST
- 路径
- /api/v1/usage/batch/read
- 调用方
- server
- 权限
- credits:read
GET
- 路径
- /api/v1/offers
- 调用方
- customer
- 权限
- offers:resolve
POST
- 路径
- /api/v1/offers/grant
- 调用方
- server
- 权限
- offers:grant
POST
- 路径
- /api/v1/offers/redeem
- 调用方
- customer
- 权限
- offers:resolve
POST
- 路径
- /api/v1/rewards/redeem
- 调用方
- customer
- 权限
- offers:resolve
POST
- 路径
- /api/v1/rewards/referral-code
- 调用方
- customer
- 权限
- offers:resolve
POST
- 路径
- /api/v1/rewards/product/claim
- 调用方
- customer
- 权限
- offers:resolve
POST
- 路径
- /api/v1/seats/list
- 调用方
- server
- 权限
- customers:read
POST
- 路径
- /api/v1/seats/manage
- 调用方
- server
- 权限
- billing:write
| 权限 |
|---|
| customers:read |
| customers:write |
| entitlements:read |
| sessions:create |
| funnels:run |
| offers:resolve |
| offers:grant |
| billing:read |
| billing:write |
| credits:read |
| credits:consume |
| credits:manage |
当前 API Key 权限
customers:read
customers:write
entitlements:read
sessions:create
funnels:run
offers:resolve
offers:grant
billing:read
billing:write
credits:read
credits:consume
credits:manage
| HTTP | code | 含义 |
|---|---|---|
| 400 | INVALID_REQUEST | 请求体或参数不符合接口定义 |
| 401 | UNAUTHENTICATED | 缺少、无效、过期或已撤销的凭据 |
| 403 | FORBIDDEN | 权限不足,或浏览器来源不在允许列表 |
| 403 | SCOPE_MISMATCH | 校验头与凭据所属 App / 环境不一致 |
| 404 | NOT_FOUND | 当前 App 与环境里没有这个对象 |
| 409 | CONFLICT | 与已有数据冲突(例如同一 eventId 内容不同) |
| 413 | PAYLOAD_TOO_LARGE | 请求体超过 16 KiB |
| 429 | RATE_LIMITED | 请求频率超出限制,请稍后重试 |
| 500 | INTERNAL_ERROR | 内部失败或响应不符合契约;不返回内部异常细节 |
| 501 | NOT_CONFIGURED | 该能力未配置或尚未实现 |
| 503 | SERVICE_UNAVAILABLE | 服务暂时不可用,请稍后重试 |
服务端错误码
INVALID_REQUEST400- 含义
- 请求体或参数不符合接口定义
UNAUTHENTICATED401- 含义
- 缺少、无效、过期或已撤销的凭据
FORBIDDEN403- 含义
- 权限不足,或浏览器来源不在允许列表
SCOPE_MISMATCH403- 含义
- 校验头与凭据所属 App / 环境不一致
NOT_FOUND404- 含义
- 当前 App 与环境里没有这个对象
CONFLICT409- 含义
- 与已有数据冲突(例如同一 eventId 内容不同)
PAYLOAD_TOO_LARGE413- 含义
- 请求体超过 16 KiB
RATE_LIMITED429- 含义
- 请求频率超出限制,请稍后重试
INTERNAL_ERROR500- 含义
- 内部失败或响应不符合契约;不返回内部异常细节
NOT_CONFIGURED501- 含义
- 该能力未配置或尚未实现
SERVICE_UNAVAILABLE503- 含义
- 服务暂时不可用,请稍后重试
| code | 含义 |
|---|---|
NOT_IDENTIFIED | 还没有调用 identify 传入客户 Token |
INVALID_TOKEN | Token 为空,或把 gg_sk_ 开头的服务端 Key 传给了浏览器 SDK |
SERVER_ONLY | 在浏览器里创建了服务端客户端 |
TIMEOUT | 请求超时(默认 10 秒,可设 1–120,000 毫秒) |
NETWORK_ERROR | 网络请求失败;SDK 不会自动重试 |
IDENTITY_CHANGED | 请求进行中切换了客户或调用了 reset,旧响应被丢弃 |
SCOPE_MISMATCH | 响应所属的 App 或环境与 SDK 配置的 scope 不一致 |
INVALID_REQUEST | 调用参数在本地校验失败 |
INVALID_RESPONSE | 服务端响应不符合接口定义 |
HTTP_ERROR | 服务端返回了无法解析的错误响应 |
INVALID_URL | baseUrl 不是 HTTPS(本地开发可用 localhost HTTP),或带有凭据、查询参数 |
INVALID_TIMEOUT | timeoutMs 不在 1–120,000 毫秒之间 |
SDK 客户端错误码
NOT_IDENTIFIED- 含义
- 还没有调用
identify传入客户 Token
INVALID_TOKEN- 含义
- Token 为空,或把
gg_sk_开头的服务端 Key 传给了浏览器 SDK
SERVER_ONLY- 含义
- 在浏览器里创建了服务端客户端
TIMEOUT- 含义
- 请求超时(默认 10 秒,可设 1–120,000 毫秒)
NETWORK_ERROR- 含义
- 网络请求失败;SDK 不会自动重试
IDENTITY_CHANGED- 含义
- 请求进行中切换了客户或调用了
reset,旧响应被丢弃
SCOPE_MISMATCH- 含义
- 响应所属的 App 或环境与 SDK 配置的 scope 不一致
INVALID_REQUEST- 含义
- 调用参数在本地校验失败
INVALID_RESPONSE- 含义
- 服务端响应不符合接口定义
HTTP_ERROR- 含义
- 服务端返回了无法解析的错误响应
INVALID_URL- 含义
- baseUrl 不是 HTTPS(本地开发可用 localhost HTTP),或带有凭据、查询参数
INVALID_TIMEOUT- 含义
timeoutMs不在 1–120,000 毫秒之间