Skip to content

Whether a spend would pass the checks before the kernel, or why not.

GET
/v1/accounts/{account}/can-spend
curl --request GET \
--url https://example.com/v1/accounts/example/can-spend \
--header 'Authorization: Bearer <token>'

Says whether a spend of amount minor units of asset from the account would pass the checks before the kernel, and names the reason if it would not. Both parameters are required: a missing one is refused as ERR-QueryUnbounded. Any other parameter, an asset that is not a valid symbol and an amount that is not a count of minor units are refused as ERR-MalformedCommand.

account
required
string

A did:aledgent identifier.

amount

For can_spend: the amount, in minor units.

string | null
asset

The asset.

string | null

The answer, from one consistent view (REQ-QR-2).

Media typeapplication/json

can_spend (SPEC §8.2): yes, or a refusal naming why not.

object
ok
required

Always true: a “no” is a refusal with its reason.

boolean
Examplegenerated
{
"ok": true
}

Refused, with the named condition. The status is the alternative’s x-http-status.

Media typeapplication/json
One of:
ERR-NotAuthorised
object
description
required
Allowed value: The initiating principal holds no authority that covers this operation, account, asset or bound
error
required
Allowed value: ERR-NotAuthorised
Example
{
"description": "The initiating principal holds no authority that covers this operation, account, asset or bound",
"error": "ERR-NotAuthorised"
}

Refused, with the named condition. The status is the alternative’s x-http-status.

Media typeapplication/json
One of:
ERR-NotAuthorised
object
description
required
Allowed value: The initiating principal holds no authority that covers this operation, account, asset or bound
error
required
Allowed value: ERR-NotAuthorised
Example
{
"description": "The initiating principal holds no authority that covers this operation, account, asset or bound",
"error": "ERR-NotAuthorised"
}
Retry-After
integer

On ERR-DecisionUnavailable (503): seconds to wait before retrying with the same client key (DEC-27 (g)).