Smart Contracts
Endpoints for interacting with Clarity smart contracts.
Get contract interface using a contract_address and contract name
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Contract interface
Bad request
Not found
Internal Server Error
Get specific data-map inside a contract
Attempt to fetch data from a contract data map. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The map is identified with [Map Name].
The key to lookup in the map is supplied via the POST body. This should be supplied as the hex string serialization of the key (which should be a Clarity value). Note, this is a JSON string.
The response is a JSON object with the following properties:
data: The hex serialization of the map response. Note that map responses are Clarity option types, for non-existent values, this is a serialized none, and for all other responses, it is a serialized (some ...) object.proof: The hex serialization of the Merkle proof for the data.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$Controls MARF proof inclusion in response. Set to 1 (default) to include proof, 0 to exclude. Invalid values default to 0 (no proof).
1Example: 1Possible values: Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Internal Server Error
Returns the Clarity source code of a given contract, along with the block height it was published in, and the MARF proof for the data.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Controls MARF proof inclusion in response. Set to 1 (default) to include proof, 0 to exclude. Invalid values default to 0 (no proof).
1Example: 1Possible values: Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Internal Server Error
Call read-only function
Call a read-only public function on a given contract.
The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The function is identified with [Function Name].
The arguments to the function are supplied via the POST body. This should be a JSON object with two main properties:
senderwhich should be a standard Stacks addressargumentswhich should be an array of hex-encoded Clarity values.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset
The simulated tx-sender
The simulated sponsor address
An array of hex serialized Clarity values
Function executed successfully
The result of a read-only function call.
Bad request
Not found
Internal Server Error
Call read-only function in fast mode (no cost and memory tracking)
Call a read-only public function on a given smart contract without cost tracking.
The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The function is identified with [Function Name].
The arguments to the function are supplied via the POST body. This should be a JSON object with two main properties:
senderwhich should be a standard Stacks addressargumentswhich should be an array of hex-encoded Clarity values.
This API endpoint requires a basic Authorization header.
Plain-text secret value that must exactly equal the node's
configured password, which is set as connection_options.auth_token
in the node's configuration file.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset
The simulated tx-sender
The simulated sponsor address
An array of hex serialized Clarity values
Function executed successfully
The result of a read-only function call.
Bad request
Unauthorized. Invalid or missing authentication token.
Not found
Timeout
Internal Server Error
Get trait implementation details
Determine whether or not a specified trait is implemented (either explicitly or implicitly) within a given contract.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Stacks address of the trait-defining contract.
SP2Z1K16238380NBP4T38A4G10A90Q03JJ2C2003Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name of the trait-defining contract.
some-traitPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$some-traitPattern: ^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Attempt to fetch the value of a MARF key. The key is a 64-character hex string representing the MARF node hash.
The 64-character hex-encoded hash of the MARF key.
^[0-9a-f]{64}$Controls MARF proof inclusion in response. Set to 1 (default) to include proof, 0 to exclude. Invalid values default to 0 (no proof).
1Example: 1Possible values: Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Get the contract metadata for the metadata key
Attempt to fetch the metadata of a contract. The contract is identified with [Contract Address] and [Contract Name] in the URL path. The metadata key is identified with [Clarity Metadata Key].
In the response, data is formatted as JSON.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Metadata key
Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Internal Server Error
Get the value of a constant inside a contract
Attempt to fetch the value of a constant inside a contract. The contract is identified with [Stacks Address] and [Contract Name] in the URL path. The constant is identified with [Constant Name].
In the response, data is the hex serialization of the constant value.
Standard Stacks address (e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0).
Must be 28-41 characters long using Stacks base58check format.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0Pattern: ^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$^([a-zA-Z0-9_]|[-!?+<>=/*]){1,128}$Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$Success
Bad request
Not found
Internal Server Error
Fetch a data variable from a smart contract. Returns the raw hex-encoded value of the variable.
Stacks address (28-41 characters) or a Contract identifier in format {address}.{contract_name}
(e.g. SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-infoPattern: ^([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41})|([0123456789ABCDEFGHJKMNPQRSTVWXYZ]{28,41}\.[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127})$Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
get-infoPattern: ^[a-zA-Z]([a-zA-Z0-9]|[-_]){0,127}$Variable name
Controls MARF proof inclusion in response. Set to 1 (default) to include proof, 0 to exclude. Invalid values default to 0 (no proof).
1Example: 1Possible values: Stacks chain tip to query from. Options:
- (empty/omitted): Use latest anchored tip (canonical confirmed state)
latest: Use latest known tip including unconfirmed microblocks{block_id}: Use specific block ID (64 hex characters)
latestPattern: ^(latest|[0-9a-f]{64})?$The data variable value
Bad request
Not found
Last updated
Was this helpful?
