Admin API
This page is an overview of the Admin API associated with AvalancheGo.
The Admin API can be used for measuring node health and debugging.
The Admin API is disabled by default for security reasons. To run a node with the Admin API enabled, use config flag --api-admin-enabled=true
.
This API set is for a specific node, it is unavailable on the public server.
Format
This API uses the json 2.0
RPC format. For details, see here.
Endpoint
Methods
admin.alias
Assign an API endpoint an alias, a different endpoint for the API. The original endpoint will still work. This change only affects this node; other nodes will not know about this alias.
Signature:
endpoint
is the original endpoint of the API.endpoint
should only include the part of the endpoint after/ext/
.- The API being aliased can now be called at
ext/alias
. alias
can be at most 512 characters.
Example Call:
Example Response:
Now, calls to the X-Chain can be made to either /ext/bc/X
or, equivalently, to /ext/myAlias
.
admin.aliasChain
Give a blockchain an alias, a different name that can be used any place the blockchain's ID is used.
Aliasing a chain can also be done via the Node API.
Note that the alias is set for each chain on each node individually. In a multi-node Avalanche L1, the same alias should be configured on each node to use an alias across an Avalanche L1 successfully. Setting an alias for a chain on one node does not register that alias with other nodes automatically.
Signature:
chain
is the blockchain's ID.alias
can now be used in place of the blockchain's ID (in API endpoints, for example.)
Example Call:
Example Response:
Now, instead of interacting with the blockchain whose ID is sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM
by making API calls to /ext/bc/sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM
, one can also make calls to ext/bc/myBlockchainAlias
.
admin.getChainAliases
Returns the aliases of the chain
Signature:
chain
is the blockchain's ID.
Example Call:
Example Response:
admin.getLoggerLevel
Returns log and display levels of loggers.
Signature:
loggerName
is the name of the logger to be returned. This is an optional argument. If not specified, it returns all possible loggers.
Example Call:
Example Response:
admin.loadVMs
Dynamically loads any virtual machines installed on the node as plugins. See here for more information on how to install a virtual machine on a node.
Signature:
failedVMs
is only included in the response if at least one virtual machine fails to be loaded.
Example Call:
Example Response:
admin.lockProfile
Writes a profile of mutex statistics to lock.profile
.
Signature:
Example Call:
Example Response:
admin.memoryProfile
Writes a memory profile of the to mem.profile
.
Signature:
Example Call:
Example Response:
admin.setLoggerLevel
Sets log and display levels of loggers.
Signature:
loggerName
is the logger's name to be changed. This is an optional parameter. If not specified, it changes all possible loggers.logLevel
is the log level of written logs, can be omitted.displayLevel
is the log level of displayed logs, can be omitted.
logLevel
and displayLevel
cannot be omitted at the same time.
Example Call:
Example Response:
admin.startCPUProfiler
Start profiling the CPU utilization of the node. To stop, call admin.stopCPUProfiler
. On stop, writes the profile to cpu.profile
.
Signature:
Example Call:
Example Response:
admin.stopCPUProfiler
Stop the CPU profile that was previously started.
Signature:
Example Call:
Example Response: