Skip to content

Create Publication

We are looking for publications that demonstrate building dApps or smart contracts!
See the full list of Gitcoin bounties that are eligible for rewards.

REST Endpoints

Algorand maintains SDK support in JavaScript, Python, Java and Go. More languages are also available through Community Provided SDKs. The Algorand SDKs offer both standalone and network-connected development functionality.

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 documention.

Algod REST Endpoints

Info

Algorand provides endpoints for Open API Specification version 2 (OAS2) and OAS3.

These APIs are described using the Open API Specification version 3 (OAS3).

Algod REST Endpoints OAS3 specfile(.yml)

Run Algod in Postman OAS3.

Run in Postman

OAS2 Algod specfile here

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 specfile(.yml)

Run Indexer in Postman OAS3.

Run in Postman

OAS2 Indexer specfile here

KMD REST Endpoints

Info

All examples in this section assume the data directory is ~/node/data

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

Info

The kmd daemon is only automatically started when using the goal command line tool with specific commands requiring key management access. If you require API access to kmd you will need to manually start the process with goal using the command: goal kmd start -d <data-dir>. If the kmd is started with the above command it never times out and stops running unless a timeout flag is specified with the -t flag. The default of 0 is no timeout.

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.