contract interface - Stacks

Returns the interface (ABI) of a deployed Clarity contract: its public and read-only functions, data variables, maps, fungible and non-fungible tokens, and the Clarity version.

Endpoint

httpGET /v2/contracts/interface/{deployer_address}/{contract_name}

Path Parameters

ParameterTypeDescription
deployer_addressstringThe contract deployer's standard address
contract_namestringThe contract name

Example

bashexport STACKS_RPC=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

curl "${STACKS_RPC}v2/contracts/interface/SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7/my-contract"

Response

json{
    "functions": [
        {
            "name": "transfer",
            "access": "public",
            "args": [
                {
                    "name": "amount",
                    "type": "uint128"
                },
                {
                    "name": "recipient",
                    "type": "principal"
                }
            ],
            "outputs": {
                "type": {
                    "response": {
                        "ok": "bool",
                        "error": "uint128"
                    }
                }
            }
        }
    ],
    "variables": [],
    "maps": [
        {
            "name": "balances",
            "key": "principal",
            "value": "uint128"
        }
    ],
    "fungible_tokens": [],
    "non_fungible_tokens": [],
    "clarity_version": "Clarity3",
    "epoch": "Epoch30"
}

Response Fields

FieldTypeDescription
functionsarrayThe contract's functions, each with access, args, and outputs
variablesarrayData variables declared in the contract
mapsarrayData maps, each with key and value types
fungible_tokensarrayFungible tokens defined by the contract
non_fungible_tokensarrayNon-fungible tokens defined by the contract
clarity_versionstringThe contract's Clarity version

Use Cases

  • Call building: Read a contract's function signatures before calling
  • Type discovery: Inspect maps and token definitions

Error Handling

ErrorMessageDescription
400 / Bad requestBad requestA path, query, or body parameter was invalid or the transaction was rejected
404 / Not foundNot foundThe account, contract, map entry, variable, or constant does not exist
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect