Access Keys
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
The RPC API enables you to retrieve information about an account's access keys.
View access key
Returns information about a single access key for given account.
If permission
of the key is FunctionCall
, it will return more details such as the allowance
, receiver_id
, and method_names
.
method:
query
params:
request_type
:view_access_key
finality
ORblock_id
account_id
:"example.testnet"
public_key
:"example.testnet's public key"
What Could Go Wrong?
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by view_access_key
request type:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
INVALID_ACCOUNT
The requested account_id
is invalid
Provide a valid
account_id
UNKNOWN_ACCOUNT
The requested account_id
has not been found while viewing since the account has not been created or has been already deleted
Check the
account_id
Specify a different block or retry if you request the latest state
UNKNOWN_ACCESS_KEY
The requested public_key
has not been found while viewing since the public key has not been created or has been already deleted
Check the
public_key
Specify a different block or retry if you request the latest state
UNAVAILABLE_SHARD
The node was unable to found the requested data because it does not track the shard where data is present
Send a request to a different node which might track the shard
NO_SYNCED_BLOCKS
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
View access key list
You can query all access keys for a given account.
method:
query
params:
request_type
:view_access_key_list
finality
ORblock_id
account_id
:"example.testnet"
Example:
What Could Go Wrong?
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by view_access_key_list
request type:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
INVALID_ACCOUNT
The requested account_id
is invalid
Provide a valid
account_id
UNKNOWN_ACCOUNT
The requested account_id
has not been found while viewing since the account has not been created or has been already deleted
Check the
account_id
Specify a different block or retry if you request the latest state
UNAVAILABLE_SHARD
The node was unable to find the requested data because it does not track the shard where data is present
Send a request to a different node which might track the shard
NO_SYNCED_BLOCKS
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
View access key changes (single)
Returns individual access key changes in a specific block. You can query multiple keys by passing an array of objects containing the account_id
and public_key
.
method:
EXPERIMENTAL_changes
params:
changes_type
:single_access_key_changes
keys
:[{ account_id, public_key }]
finality
ORblock_id
Example:
What Could Go Wrong?{#what-could-go-wrong-2}
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by EXPERIMENTAL_changes_in_block
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
NOT_SYNCED_YET
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
View access key changes (all)
Returns changes to all access keys of a specific block. Multiple accounts can be quereied by passing an array of account_ids
.
method:
EXPERIMENTAL_changes
params:
changes_type
:all_access_key_changes
account_ids
:[ "example.testnet", "example2.testnet"]
finality
ORblock_id
Example:
What Could Go Wrong?{#what-could-go-wrong-3}
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by EXPERIMENTAL_changes
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_BLOCK
The requested block has not been produced yet or it has been garbage-collected (cleaned up to save space on the RPC node)
Check that the requested block is legit
If the block had been produced more than 5 epochs ago, try to send your request to an archival node
NOT_SYNCED_YET
The node is still syncing and the requested block is not in the database yet
Wait until the node finish syncing
Send a request to a different node which is synced
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details