AlgoKit TestNet Dispenser API Documentation

February 6, 2024 ยท View on GitHub

Overview

The AlgoKit TestNet Dispenser API provides functionalities to interact with the Dispenser service. This service enables users to fund and refund assets.

Base URLs

  • Production Instance (publicly available): https://api.dispenser.algorandfoundation.tools

Authorization

All API endpoints require an Authorization header containing a valid JWT token.

Refer to algokit dispenser command documentation to learn how to obtain a valid JWT token by executing algokit dispenser login --ci command.

Endpoints

1. POST /fund/{assetID}

Funds a user's wallet with a specified asset.

URL Parameters:

ParameterDescription
assetIDID of the asset for which the funding limit is sought. Use 0 for ALGO.

Request Body:

ParameterDescription
receiverAddress of the wallet to be funded.
amountAmount of the asset to be funded.

Response Body:

{
    "txID": "string",
    "amount": "number"
}
ParameterDescription
txIDID of the fund transaction from the dispenser to the requesting address.
amountAmount of the asset to be funded.

2. GET /fund/{assetID}/limit

Fetches the funding limit for a specified asset.

URL Parameters:

ParameterDescription
assetIDID of the asset for which the funding limit is sought. Use 0 for ALGO.

Response Body:

{
    "amount": "number"
}
ParameterDescription
amountCurrent daily amount limit for the requested asset.

3. POST /refund

Allows refunding a transaction. A status code 200 indicates a successful refund.

Request Body:

{
    "refundTransactionID": "string"
}
ParameterDescription
refundTransactionIDID of the refund transaction.

Error Handling

If an error occurs, the API returns a specific status and error code.

Error Codes Table:

Status CodeError CodeDescription
400dispenser_out_of_fundsDispenser is out of funds
403forbiddenDispenser access is forbidden
400fund_limit_exceededDispenser fund limit exceeded
400missing_paramsMissing required input parameters
403authorization_errorAuthorization error
400txn_expiredTransaction expired
400txn_invalidInvalid transaction
400txn_already_processedTransaction already processed
404txn_not_foundTransaction not found
400invalid_assetUnsupported asset ID
500unexpected_errorUnexpected internal error

For more detailed error information, please refer to the error code in the response body.

Common Error Response

All error responses have the following common format:

{
    "code": "string",
    "message": "string"
}
Error ParameterDescription
codeError code as described in the error codes table.
messageError message.

missing_params error response

{
    "code": "missing_params",
    "message": "string",
    "parameters": ["string"]
}
Error ParameterDescription
parametersList of missing parameters.

fund_limit_exceeded error response

{
    "code": "dispenser_fund_limit_exceeded",
    "message": "string",
    "limit": "number",
    "resetsAt": "string"
}
Error ParameterDescription
limitCurrent daily amount limit for the requested asset.
resetsAtTimestamp when the daily limit resets.