HCL 账本与密钥
Boma 店铺密钥管理和 HCL 公网数据面。
使用流程与权限要求见 HCL 账本。
GET列出店铺所属商户的 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
shop | 路径 | string | 必填 |
响应
200Success
application/jsontenant_idstring必填- uuid
keysTenantAPIKey[]必填查看结构
idstring必填- uuid
display_namestring必填- 最短 1 字符 · 最长 256 字符
enabledboolean必填created_atstring必填- date-time
POST创建 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
shop | 路径 | string | 必填 |
请求体
application/json必填display_namestring必填- 最短 1 字符 · 最长 256 字符
响应
200Success
application/jsonidstring必填- uuid
display_namestring必填- 最短 1 字符 · 最长 256 字符
secretstring必填Returned only on creation.
PUT重命名 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
shop | 路径 | string | 必填 |
key | 路径 | string | 必填 |
请求体
application/json必填display_namestring必填- 最短 1 字符 · 最长 256 字符
响应
200Success
application/jsonokboolean必填
POST禁用 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}/disable
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
shop | 路径 | string | 必填 |
key | 路径 | string | 必填 |
响应
200Success
application/jsonokboolean必填
DELETE删除 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
shop | 路径 | string | 必填 |
key | 路径 | string | 必填 |
响应
200Success
application/jsonokboolean必填
GET检查 HCL 数据面/hcl/v1/health
响应
200Successful response
application/jsonstatusstring必填
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
POST创建租户账本/hcl/v1/tenants/{tenant}/ledgers
Optional Idempotency-Key header makes creation retryable, scoped to the tenant.
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
Idempotency-Key | 请求头 | string | 可选 · 最短 1 字符 · 最长 256 字符 |
响应
201Successful response
application/jsoncreated_atstring必填- date-time
idstring必填- uuid
tenant_idstring必填- uuid
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
GET查询账本/hcl/v1/tenants/{tenant}/ledgers/{ledger}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
响应
200Successful response
application/jsoncreated_atstring必填- date-time
idstring必填- uuid
tenant_idstring必填- uuid
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
POST创建账本账户/hcl/v1/tenants/{tenant}/ledgers/{ledger}/accounts
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
请求体
application/json必填Account definition for explicit or lazy creation during Execute. Reusing an existing UID requires matching resource and non_negative.
non_negativebooleanReject a transaction if this account would have a negative final balance.
默认值 falseresource_uidstring必填Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.
最短 1 字符 · 最长 256 字符uidstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符
响应
201Successful response
application/jsonbalancestring必填Signed 64-bit integer encoded as a decimal JSON string to preserve precision. Valid range: -9223372036854775808 through 9223372036854775807.
最长 20 字符 · 匹配 ^-?(0|[1-9][0-9]*)$created_atstring必填- date-time
idstring必填- uuid
ledger_idstring必填- uuid
non_negativeboolean必填resource_uidstring必填Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.
最短 1 字符 · 最长 256 字符tenant_idstring必填- uuid
uidstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符versionstring必填Non-negative int64 account version encoded as a decimal JSON string. Valid range: 0 through 9223372036854775807.
最长 20 字符 · 匹配 ^(0|[1-9][0-9]*)$
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
GET查询账户余额与版本/hcl/v1/tenants/{tenant}/ledgers/{ledger}/accounts/{uid}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
uid | 路径 | string | 必填 · 最短 1 字符 · 最长 256 字符 |
响应
200Successful response
application/jsonbalancestring必填Signed 64-bit integer encoded as a decimal JSON string to preserve precision. Valid range: -9223372036854775808 through 9223372036854775807.
最长 20 字符 · 匹配 ^-?(0|[1-9][0-9]*)$created_atstring必填- date-time
idstring必填- uuid
ledger_idstring必填- uuid
non_negativeboolean必填resource_uidstring必填Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.
最短 1 字符 · 最长 256 字符tenant_idstring必填- uuid
uidstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符versionstring必填Non-negative int64 account version encoded as a decimal JSON string. Valid range: 0 through 9223372036854775807.
最长 20 字符 · 匹配 ^(0|[1-9][0-9]*)$
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
POST提交原子账本交易/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions
Commit balances, immutable entries, transaction records and Anclax webhook tasks in the same PostgreSQL transaction. All events use the tenant webhook URL read by this transaction; later URL changes do not reroute pending events.
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
请求体
application/json必填Execute one atomic transaction. Reusing the same key and content returns the original transaction; changed content conflicts. A failed transaction does not reserve its key.
accountsAccountDefinition[]- 至多 512 项
查看结构
Account definition for explicit or lazy creation during Execute. Reusing an existing UID requires matching resource and non_negative.
non_negativebooleanReject a transaction if this account would have a negative final balance.
默认值 falseresource_uidstring必填Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.
最短 1 字符 · 最长 256 字符uidstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符
entriesEntry[]必填- 至少 1 项 · 至多 256 项
查看结构
Decrease debit and increase credit by the same positive amount. Both accounts must be in the same ledger and hold the same resource. BOM conversion uses multiple same-resource entries atomically.
amountstring必填Positive int64 quantity encoded as a decimal JSON string. Valid range: 1 through 9223372036854775807.
最长 20 字符 · 匹配 ^[1-9][0-9]*$creditstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符debitstring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符
eventsEventIntent[]- 至多 32 项
查看结构
Business intent delivered after the ledger transaction commits.
keystring- 最长 256 字符
payload任意值Caller-defined JSON value, preserving exact numbers. On Execute, string values exactly equal to ${uid} are replaced with the referenced account's final balance as a decimal string, recursively through objects and arrays. The entire text inside the braces is the opaque account UID and must name an account involved in this transaction's entries; otherwise the transaction fails with invalid_request. $${uid} produces the literal ${uid}, without evaluating it again. Object keys, event type/key, metadata, and strings containing additional text are not substituted. Idempotency uses the original request template. Anclax task payloads store the resolved event once, before the transaction commits, and retries never re-evaluate it.
可为 nulltypestring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符
idempotency_keystring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符metadata任意值Caller-defined JSON value, preserved without converting numbers to floating point.
可为 null
响应
200Successful response
application/jsonTransaction record, returned on execution, idempotent retries, and historical queries. Account snapshots and events are delivered through Anclax tasks.
created_atstring必填- date-time
idempotency_keystring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符ledger_idstring必填- uuid
metadata任意值Caller-defined JSON value, preserved without converting numbers to floating point.
可为 nulltenant_idstring必填- uuid
transaction_idstring必填- uuid
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
GET按交易 ID 查询交易/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions/{id}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
id | 路径 | string | 必填 · uuid |
响应
200Successful response
application/jsonTransaction record, returned on execution, idempotent retries, and historical queries. Account snapshots and events are delivered through Anclax tasks.
created_atstring必填- date-time
idempotency_keystring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符ledger_idstring必填- uuid
metadata任意值Caller-defined JSON value, preserved without converting numbers to floating point.
可为 nulltenant_idstring必填- uuid
transaction_idstring必填- uuid
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
GET按业务幂等键查询交易/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions/by-key
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
ledger | 路径 | string | 必填 · uuid |
key | 查询 | string | 必填 · 最短 1 字符 · 最长 256 字符 |
响应
200Successful response
application/jsonTransaction record, returned on execution, idempotent retries, and historical queries. Account snapshots and events are delivered through Anclax tasks.
created_atstring必填- date-time
idempotency_keystring必填Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.
最短 1 字符 · 最长 256 字符ledger_idstring必填- uuid
metadata任意值Caller-defined JSON value, preserved without converting numbers to floating point.
可为 nulltenant_idstring必填- uuid
transaction_idstring必填- uuid
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
POST创建租户资源/hcl/v1/tenants/{tenant}/resources
Create a resource using a local UID; the server prepends the owning tenant namespace and a dot. Returns the globally unique full UID.
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
请求体
application/json必填display_namestring- 最长 1024 字符
uidstring必填Local resource name. The server prepends the tenant namespace and a dot; the resulting full UID must be at most 256 UTF-8 bytes. Use the returned UID for queries and account references.
最短 1 字符 · 最长 256 字符
响应
201Successful response
application/jsoncreated_atstring必填- date-time
display_namestring必填- 最长 1024 字符
tenant_idstring必填- uuid
uidstring必填Globally unique UID in namespace.local_uid form. Includes the owning tenant namespace and is at most 256 UTF-8 bytes.
最短 1 字符 · 最长 256 字符updated_atstring必填- date-time
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填
GET查询资源/hcl/v1/tenants/{tenant}/resources/{uid}
参数
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
tenant | 路径 | string | 必填 · uuid |
uid | 路径 | string | 必填 · 最短 1 字符 · 最长 256 字符 |
响应
200Successful response
application/jsoncreated_atstring必填- date-time
display_namestring必填- 最长 1024 字符
tenant_idstring必填- uuid
uidstring必填Globally unique UID in namespace.local_uid form. Includes the owning tenant namespace and is at most 256 UTF-8 bytes.
最短 1 字符 · 最长 256 字符updated_atstring必填- date-time
default400 invalid request/resource mismatch/overflow; 401 invalid tenant credential; 404 missing or foreign-tenant record; 409 conflict/non-negative balance failure; 503 unavailable/event delivery not configured; 500 internal error. Retry ambiguous transaction failures with the same key.
application/jsonerrorError必填查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填messagestring必填