Algorand REST APIs
Algod, Indexer and KMD REST Endpoints
Integration with the Algorand protocol daemon (algod
), Algorand key management daemon (kmd
) or Algorand Indexer daemon (algorand-indexer
) is performed using a set of REST APIs.
All REST methods and models are fully described within reference documentation.
Algod REST Endpoints
Algod REST Endpoints OAS3 spec file(.yml)
Algod REST Endpoints OAS2 spec file
Indexer REST Endpoints
The algorand-indexer
daemon provides its API from the host:port defined by the —server flag specified at start up. The default port is 8980.
Indexer REST Endpoints OAS3 spec file(.yml)
Indexer REST Endpoints OAS2 spec file
KMD REST Endpoints
This API is described using the Open API Specification version 2 (OAS 2). The kmd
daemon serves it’s API from the kmd.net files found in the ~/node/data and ~/node/data/kmd-{version} directories. The kmd
daemons provide their API specifications in a swagger json format available from this endpoint:
Algorand Key Management Daemon (kmd
)
curl http://$(cat ~/node/data/kmd-v0.5/kmd.net)/swagger.json
Security Token
Most REST calls will also require an API token header to authenticate with the API server. For both algod
and kmd
the token is automatically generated by the daemon at startup and stored in a file. algod
places algod.token in the ~/node/data directory. kmd
places kmd.token the ~/node/data/kmd-{version} directory. Security tokens can be regenerated for both using the goal node generatetoken
command.
Daemon | Header Identifier | Header Value Defined Via |
---|---|---|
algod | X-Algo-API-Token | file: ~/node/data/algod.token |
kmd | X-KMD-API-Token | file: ~/node/data/kmd-{version}/kmd.token |
indexer | X-Indexer-API-Token |
Each SDK provides a method for setting these headers. Most REST tools provide a method for setting additional headers. To set the header with a curl
command use the -H
parameter. For example, to make a call to retrieve a specific block, use the following curl command:
curl http://$(cat ~/node/data/algod.net)/v2/blocks/16486179 -H "X-Algo-API-Token: $(cat ~/node/data/algod.token)"
In the above example, the block information will be displayed if the block exists on the local node. If the node is a non-Archival node, blocks older than 1000 blocks will not be available.