Faucet API
The faucet allows users to get test APT
on Devnet and Testnet. It is not available on Mainnet.
Differences between devnet and testnet
What are the differences between devnet and testnet? Effectively none. In the past, the testnet faucet had a Captcha in front of it, making it unqueryable by normal means. This is no longer true.
The endpoints for each faucet are:
- Devnet: https://faucet.devnet.aptoslabs.com
- Testnet: https://faucet.testnet.aptoslabs.com
Integrating with the faucet
See the System Integrators Guide for more information on how to use the faucet with your project.
Calling the faucet via Terminal
If you are trying to call the faucet in other languages, you have two options:
- Generate a client from the OpenAPI spec.
- Call the faucet on your own.
For the latter, you will want to build a query similar to this:
curl -X POST
'https://faucet.devnet.aptoslabs.com/mint?amount=10000&address=0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6'
This means mint 10000 Octas to
address 0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6
.
Calling the faucet: JavaScript / TypeScript
If you are building a client in JavaScript or TypeScript, you should make use of the @aptos-labs/aptos-faucet-client package. This client is generated based on the OpenAPI spec published by the faucet service.
Example use:
import {
AptosFaucetClient,
FundRequest,
} from "@aptos-labs/aptos-faucet-client";
async function callFaucet(amount: number, address: string): Promise<string []> {
const faucetClient = new AptosFaucetClient({
BASE: "https://faucet.devnet.aptoslabs.com",
});
const request: FundRequest = {
amount,
address,
};
const response = await faucetClient.fund({ requestBody: request });
return response.txn_hashes;
}