HCL 账本与密钥

Boma 店铺密钥管理和 HCL 公网数据面。

使用流程与权限要求见 HCL 账本。

GET列出店铺所属商户的 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys
鉴权已选身份的会话 / Boma API Key

参数

参数位置类型说明
shop路径string必填

响应

200Success
application/json
tenant_idstring必填
uuid
keysTenantAPIKey[]必填
查看结构
idstring必填
uuid
display_namestring必填
最短 1 字符 · 最长 256 字符
enabledboolean必填
created_atstring必填
date-time
POST创建 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys
鉴权已选身份的会话 / Boma API Key

参数

参数位置类型说明
shop路径string必填

请求体

application/json必填
display_namestring必填
最短 1 字符 · 最长 256 字符

响应

200Success
application/json
idstring必填
uuid
display_namestring必填
最短 1 字符 · 最长 256 字符
secretstring必填

Returned only on creation.

PUT重命名 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}
鉴权已选身份的会话 / Boma API Key

参数

参数位置类型说明
shop路径string必填
key路径string必填

请求体

application/json必填
display_namestring必填
最短 1 字符 · 最长 256 字符

响应

200Success
application/json
okboolean必填
POST禁用 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}/disable
鉴权已选身份的会话 / Boma API Key

参数

参数位置类型说明
shop路径string必填
key路径string必填

响应

200Success
application/json
okboolean必填
DELETE删除 HCL 密钥/boma/v1/shops/{shop}/hcl-api-keys/{key}
鉴权已选身份的会话 / Boma API Key

参数

参数位置类型说明
shop路径string必填
key路径string必填

响应

200Success
application/json
okboolean必填
GET检查 HCL 数据面/hcl/v1/health
鉴权公开

响应

200Successful response
application/json
statusstring必填
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/json
errorError必填
查看结构
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
鉴权HCL 租户 API Key

Optional Idempotency-Key header makes creation retryable, scoped to the tenant.

参数

参数位置类型说明
tenant路径string必填 · uuid
Idempotency-Key请求头string可选 · 最短 1 字符 · 最长 256 字符

响应

201Successful response
application/json
created_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/json
errorError必填
查看结构
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}
鉴权HCL 租户 API Key

参数

参数位置类型说明
tenant路径string必填 · uuid
ledger路径string必填 · uuid

响应

200Successful response
application/json
created_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/json
errorError必填
查看结构
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
鉴权HCL 租户 API Key

参数

参数位置类型说明
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_negativeboolean

Reject a transaction if this account would have a negative final balance.

默认值 false
resource_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/json
balancestring必填

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/json
errorError必填
查看结构
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}
鉴权HCL 租户 API Key

参数

参数位置类型说明
tenant路径string必填 · uuid
ledger路径string必填 · uuid
uid路径string必填 · 最短 1 字符 · 最长 256 字符

响应

200Successful response
application/json
balancestring必填

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/json
errorError必填
查看结构
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
鉴权HCL 租户 API Key

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_negativeboolean

Reject a transaction if this account would have a negative final balance.

默认值 false
resource_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.

可为 null
typestring必填

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/json

Transaction 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.

可为 null
tenant_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/json
errorError必填
查看结构
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}
鉴权HCL 租户 API Key

参数

参数位置类型说明
tenant路径string必填 · uuid
ledger路径string必填 · uuid
id路径string必填 · uuid

响应

200Successful response
application/json

Transaction 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.

可为 null
tenant_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/json
errorError必填
查看结构
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
鉴权HCL 租户 API Key

参数

参数位置类型说明
tenant路径string必填 · uuid
ledger路径string必填 · uuid
key查询string必填 · 最短 1 字符 · 最长 256 字符

响应

200Successful response
application/json

Transaction 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.

可为 null
tenant_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/json
errorError必填
查看结构
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
鉴权HCL 租户 API Key

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/json
created_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/json
errorError必填
查看结构
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}
鉴权HCL 租户 API Key

参数

参数位置类型说明
tenant路径string必填 · uuid
uid路径string必填 · 最短 1 字符 · 最长 256 字符

响应

200Successful response
application/json
created_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/json
errorError必填
查看结构
codeinvalid_request | unauthorized | not_found | conflict | idempotency_conflict | resource_mismatch | insufficient_balance | overflow | events_not_configured | unavailable | internal_error必填
messagestring必填