{"openapi":"3.0.3","info":{"description":"Public HCL data plane. Use the tenant API key signing profile. JSON quantities and versions are decimal strings.","title":"HCL ledger API","version":"1.0.0"},"servers":[{"url":"https://api.boma.spopc.com"}],"paths":{"/hcl/v1/health":{"get":{"operationId":"GetHealth","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[]}},"/hcl/v1/tenants/{tenant}/ledgers":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"post":{"description":"Optional Idempotency-Key header makes creation retryable, scoped to the tenant.","operationId":"CreateLedger","parameters":[{"in":"header","name":"Idempotency-Key","schema":{"maxLength":256,"minLength":1,"type":"string"}}],"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ledger"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"get":{"operationId":"GetLedger","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ledger"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}/accounts":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"post":{"operationId":"CreateAccount","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDefinition"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}/accounts/{uid}":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"uid","required":true,"schema":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"}}],"get":{"operationId":"GetAccount","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"post":{"description":"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.","operationId":"Execute","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions/{id}":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"get":{"operationId":"GetTransaction","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/ledgers/{ledger}/transactions/by-key":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"ledger","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"get":{"operationId":"GetTransactionByKey","parameters":[{"in":"query","name":"key","required":true,"schema":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"Key"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/resources":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}}],"post":{"description":"Create a resource using a local UID; the server prepends the owning tenant namespace and a dot. Returns the globally unique full UID.","operationId":"CreateResource","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateResourceRequest"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}},"/hcl/v1/tenants/{tenant}/resources/{uid}":{"parameters":[{"in":"path","name":"tenant","required":true,"schema":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},{"in":"path","name":"uid","required":true,"schema":{"description":"Full resource UID returned by CreateResource, including the tenant namespace; at most 256 UTF-8 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"}}],"get":{"operationId":"GetResource","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Resource"}}},"description":"Successful response"},"default":{"$ref":"#/components/responses/Failure"}},"security":[{"RequestSignature":[],"SignatureInput":[],"ContentDigest":[]}]}}},"components":{"responses":{"Failure":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"400 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."}},"schemas":{"Account":{"additionalProperties":false,"properties":{"balance":{"description":"Signed 64-bit integer encoded as a decimal JSON string to preserve precision. Valid range: -9223372036854775808 through 9223372036854775807.","maxLength":20,"pattern":"^-?(0|[1-9][0-9]*)$","type":"string","x-go-type":"int64","x-oapi-codegen-extra-tags":{"json":"balance,string"}},"created_at":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"ledger_id":{"format":"uuid","type":"string","x-go-name":"LedgerID","x-go-type":"string"},"non_negative":{"type":"boolean"},"resource_uid":{"description":"Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.","maxLength":256,"minLength":1,"type":"string","x-go-name":"ResourceUID"},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"},"uid":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"},"version":{"description":"Non-negative int64 account version encoded as a decimal JSON string. Valid range: 0 through 9223372036854775807.","maxLength":20,"pattern":"^(0|[1-9][0-9]*)$","type":"string","x-go-type":"int64","x-oapi-codegen-extra-tags":{"json":"version,string"}}},"required":["id","tenant_id","ledger_id","uid","resource_uid","non_negative","balance","version","created_at"],"type":"object"},"AccountDefinition":{"additionalProperties":false,"description":"Account definition for explicit or lazy creation during Execute. Reusing an existing UID requires matching resource and non_negative.","properties":{"non_negative":{"default":false,"description":"Reject a transaction if this account would have a negative final balance.","type":"boolean","x-go-type-skip-optional-pointer":true,"x-omitempty":false},"resource_uid":{"description":"Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.","maxLength":256,"minLength":1,"type":"string","x-go-name":"ResourceUID"},"uid":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"}},"required":["uid","resource_uid"],"type":"object"},"AccountState":{"additionalProperties":false,"description":"Immutable account snapshot. Version increases once per successful transaction touching this account, including a zero net change.","properties":{"balance":{"description":"Signed 64-bit integer encoded as a decimal JSON string to preserve precision. Valid range: -9223372036854775808 through 9223372036854775807.","maxLength":20,"pattern":"^-?(0|[1-9][0-9]*)$","type":"string","x-go-type":"int64","x-oapi-codegen-extra-tags":{"json":"balance,string"}},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"resource_uid":{"description":"Full globally unique resource UID returned by CreateResource, including the creator namespace. Accounts may reference resources created by any tenant.","maxLength":256,"minLength":1,"type":"string","x-go-name":"ResourceUID"},"uid":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"},"version":{"description":"Non-negative int64 account version encoded as a decimal JSON string. Valid range: 0 through 9223372036854775807.","maxLength":20,"pattern":"^(0|[1-9][0-9]*)$","type":"string","x-go-type":"int64","x-oapi-codegen-extra-tags":{"json":"version,string"}}},"required":["id","uid","resource_uid","balance","version"],"type":"object"},"CreateResourceRequest":{"additionalProperties":false,"properties":{"display_name":{"maxLength":1024,"type":"string","x-go-type-skip-optional-pointer":true,"x-omitempty":false},"uid":{"description":"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.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"}},"required":["uid"],"type":"object"},"CreateTenantRequest":{"additionalProperties":false,"properties":{"name":{"maxLength":1024,"type":"string","x-go-type-skip-optional-pointer":true,"x-omitempty":false},"namespace":{"description":"Globally unique, case-sensitive resource namespace of 5 to 8 ASCII characters. Must start with a letter or digit; remaining characters may also be underscores or hyphens. Format and length are validated by the application.","maxLength":8,"minLength":5,"pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{4,7}$","type":"string"},"webhook_url":{"description":"Absolute HTTP(S) URL without credentials or fragment. Empty disables new transactions with events; already queued deliveries retain their original URL.","maxLength":2048,"type":"string","x-go-name":"WebhookURL","x-go-type-skip-optional-pointer":true,"x-omitempty":true}},"required":["namespace"],"type":"object"},"CreatedTenantAPIKey":{"additionalProperties":false,"properties":{"display_name":{"maxLength":256,"minLength":1,"type":"string"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"secret":{"description":"Returned only on creation.","type":"string"}},"required":["id","secret","display_name"],"type":"object"},"Entry":{"additionalProperties":false,"description":"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.","properties":{"amount":{"description":"Positive int64 quantity encoded as a decimal JSON string. Valid range: 1 through 9223372036854775807.","maxLength":20,"pattern":"^[1-9][0-9]*$","type":"string","x-go-type":"int64","x-oapi-codegen-extra-tags":{"json":"amount,string"}},"credit":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"Credit"},"debit":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"Debit"}},"required":["debit","credit","amount"],"type":"object"},"Error":{"additionalProperties":false,"properties":{"code":{"$ref":"#/components/schemas/ErrorCode"},"message":{"type":"string"}},"required":["code","message"],"type":"object"},"ErrorCode":{"enum":["invalid_request","unauthorized","not_found","conflict","idempotency_conflict","resource_mismatch","insufficient_balance","overflow","events_not_configured","unavailable","internal_error"],"type":"string","x-enum-varnames":["CodeInvalidRequest","CodeUnauthorized","CodeNotFound","CodeConflict","CodeIdempotencyConflict","CodeResourceMismatch","CodeInsufficientBalance","CodeOverflow","CodeEventsNotConfigured","CodeUnavailable","CodeInternal"]},"ErrorResponse":{"additionalProperties":false,"properties":{"error":{"$ref":"#/components/schemas/Error"}},"required":["error"],"type":"object"},"Event":{"allOf":[{"$ref":"#/components/schemas/EventIntent"},{"properties":{"accounts":{"items":{"$ref":"#/components/schemas/AccountState"},"type":"array"},"api_key_id":{"description":"Key that committed this data-plane transaction. Stored with the event for delivery and replay.","format":"uuid","type":"string","x-go-name":"APIKeyID","x-go-type":"string","x-go-type-skip-optional-pointer":true},"created_at":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"ledger_id":{"format":"uuid","type":"string","x-go-name":"LedgerID","x-go-type":"string"},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"},"transaction_id":{"format":"uuid","type":"string","x-go-name":"TransactionID","x-go-type":"string"}},"required":["id","tenant_id","transaction_id","ledger_id","created_at","accounts"],"type":"object"}],"description":"At-least-once webhook delivery envelope. Event ID is stable across retries; account versions are from the committing transaction. Payload balance references are already resolved; delivery and replay preserve the stored payload, including escaped literal references."},"EventIntent":{"description":"Business intent delivered after the ledger transaction commits.","properties":{"key":{"maxLength":256,"type":"string","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"payload":{"description":"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.","nullable":true,"x-go-type":"json.RawMessage","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"type":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"Type"}},"required":["type"],"type":"object"},"ExecuteRequest":{"additionalProperties":false,"description":"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.","properties":{"accounts":{"items":{"$ref":"#/components/schemas/AccountDefinition"},"maxItems":512,"type":"array","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"entries":{"items":{"$ref":"#/components/schemas/Entry"},"maxItems":256,"minItems":1,"type":"array"},"events":{"items":{"$ref":"#/components/schemas/EventIntent"},"maxItems":32,"type":"array","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"idempotency_key":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"IdempotencyKey"},"metadata":{"description":"Caller-defined JSON value, preserved without converting numbers to floating point.","nullable":true,"x-go-type":"json.RawMessage","x-go-type-skip-optional-pointer":true,"x-omitempty":true}},"required":["idempotency_key","entries"],"type":"object"},"HealthResponse":{"additionalProperties":false,"properties":{"status":{"example":"ok","type":"string"}},"required":["status"],"type":"object"},"Ledger":{"additionalProperties":false,"properties":{"created_at":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"}},"required":["id","tenant_id","created_at"],"type":"object"},"Resource":{"additionalProperties":false,"properties":{"created_at":{"format":"date-time","type":"string"},"display_name":{"maxLength":1024,"type":"string"},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"},"uid":{"description":"Globally unique UID in namespace.local_uid form. Includes the owning tenant namespace and is at most 256 UTF-8 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"UID"},"updated_at":{"format":"date-time","type":"string"}},"required":["tenant_id","uid","display_name","created_at","updated_at"],"type":"object"},"Tenant":{"additionalProperties":false,"properties":{"created_at":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"},"name":{"maxLength":1024,"type":"string"},"namespace":{"description":"Globally unique, case-sensitive resource namespace of 5 to 8 ASCII characters. System-seeded tenants may start with an underscore; ordinary creation requires a letter or digit.","maxLength":8,"minLength":5,"pattern":"^[A-Za-z0-9_][A-Za-z0-9_-]{4,7}$","type":"string"},"updated_at":{"format":"date-time","type":"string"},"webhook_url":{"description":"Absolute HTTP(S) URL without credentials or fragment. Empty disables new transactions with events; already queued deliveries retain their original URL.","maxLength":2048,"type":"string","x-go-name":"WebhookURL"}},"required":["id","namespace","name","webhook_url","created_at","updated_at"],"type":"object"},"TenantAPIKey":{"additionalProperties":false,"properties":{"created_at":{"format":"date-time","type":"string"},"display_name":{"maxLength":256,"minLength":1,"type":"string"},"enabled":{"type":"boolean"},"id":{"format":"uuid","type":"string","x-go-name":"ID","x-go-type":"string"}},"required":["id","display_name","enabled","created_at"],"type":"object"},"TenantAPIKeyList":{"additionalProperties":false,"properties":{"keys":{"items":{"$ref":"#/components/schemas/TenantAPIKey"},"type":"array"},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"}},"required":["tenant_id","keys"],"type":"object"},"TenantKeyName":{"additionalProperties":false,"properties":{"display_name":{"maxLength":256,"minLength":1,"type":"string"}},"required":["display_name"],"type":"object"},"TenantList":{"additionalProperties":false,"description":"UUID cursor page. Omitted next means no further page is known.","properties":{"next":{"format":"uuid","type":"string","x-go-name":"Next","x-go-type":"string","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"tenants":{"items":{"$ref":"#/components/schemas/Tenant"},"type":"array"}},"required":["tenants"],"type":"object"},"TenantServiceKeyRequest":{"additionalProperties":false,"properties":{"key_id":{"format":"uuid","type":"string","x-go-name":"KeyID","x-go-type":"string"},"secret":{"description":"Base64URL signing secret supplied through the internal control plane.","maxLength":43,"minLength":43,"type":"string"}},"required":["key_id","secret"],"type":"object"},"Transaction":{"additionalProperties":false,"description":"Transaction record, returned on execution, idempotent retries, and historical queries. Account snapshots and events are delivered through Anclax tasks.","properties":{"created_at":{"format":"date-time","type":"string"},"idempotency_key":{"description":"Opaque caller-defined identifier; nonempty UTF-8 text, at most 256 bytes.","maxLength":256,"minLength":1,"type":"string","x-go-name":"IdempotencyKey"},"ledger_id":{"format":"uuid","type":"string","x-go-name":"LedgerID","x-go-type":"string"},"metadata":{"description":"Caller-defined JSON value, preserved without converting numbers to floating point.","nullable":true,"x-go-type":"json.RawMessage","x-go-type-skip-optional-pointer":true,"x-omitempty":true},"tenant_id":{"format":"uuid","type":"string","x-go-name":"TenantID","x-go-type":"string"},"transaction_id":{"format":"uuid","type":"string","x-go-name":"TransactionID","x-go-type":"string"}},"required":["transaction_id","tenant_id","ledger_id","idempotency_key","created_at"],"type":"object"},"UpdateWebhookRequest":{"additionalProperties":false,"properties":{"webhook_url":{"description":"Absolute HTTP(S) URL without credentials or fragment. Empty disables new transactions with events; already queued deliveries retain their original URL.","maxLength":2048,"type":"string","x-go-name":"WebhookURL","x-go-type":"*string"}},"required":["webhook_url"],"type":"object"}},"securitySchemes":{"SignatureInput":{"type":"apiKey","in":"header","name":"Signature-Input","description":"Covered components and signed created, keyid and nonce parameters."},"ContentDigest":{"type":"apiKey","in":"header","name":"Content-Digest","description":"SHA-256 digest of the exact request body, including an empty body."},"RequestSignature":{"type":"apiKey","in":"header","name":"Signature","description":"HMAC-SHA256 using a decoded HCL tenant API Secret."}}}}