Check Limits

Check whether limits are reached before sending meta transaction

Developer can apply limits on the usage of meta transaction from the Dashboard on per DApp, per User and per API for each user.

So before sending meta transaction on client side, developer can use this API to check whether the limits have already reached or not. If limits are reached developer can either fallback to default web3 provider, show a message to user that your free transactions limits have been exhausted and let user pay the gas fee or show an error message to the user.

get
Check Limits

https://api.biconomy.io/api/v1/dapp/checkLimits?userAddress=<user_address>&apiId=<api_id>
This API lets you know the current status of DApp limits for a particular user address and api id (smart contract method). In case when limits are exhausted, response will contain information about what was the type of limits applied and when the limits will be reset.
Request
Response
Request
Headers
x-api-key
required
string
API Key can be found on the Dashboard on view DApp page under Keys section. This is specific to a DApp.
Query Parameters
apiId
required
string
Api Id corresponding to smart contract methods against which limits needs to be checked for given user. This can be get from the dashboard under "Manage API" section
userAddress
required
string
Address of the user for whom the limits needs to be checked.
Response
200: OK
When limits are not exhausted. "allowed" field in the response should be checked first if limits are allowed or not. If "allowed" == true, then limits are not consumed and user can do meta transaction without any limit failure. If "allowed" == false then limits are exhausted, in this case "code" field will have different values based on the limit exhausted as mentioned below code = 150 when DApp limits are exhausted code = 151 when User limits are exhausted code = 152 when API/User limits are exhausted In case of failure, "limit" key will contain information about type of limit exhausted and the limit reset time (in GMT) limit.type = 0 || 1 0 if the limit was applied on gas usage. 1 if the limit was applied on the number of meta transaction. limit.resetTime = <number of milliseconds since epoch time in GMT timezone> Please convert it to local timezone if this is needed to show to the end user. limit.limitLeft = <limit applied - limit usage> Difference between limit value applied on the dashboard and limit usage done by the user. This will be either 0 or negative value.
// When limits are not exhausted
{
"code": 200,
"message": "Limits are not consumed",
"responseCode": 200,
"allowed": true
}
// When DApp limit is exhausted
{
"code": 150,
"message": "DApp limit reached",
"responseCode": 200,
"limit": {
"allowed": false,
"type": 0,
"limitLeft": -0.001542277,
"resetTime": 1594684800000
},
"allowed": false
}
// When User limit is exhausted
{
"code": 151,
"message": "User limit reached",
"responseCode": 200,
"limit": {
"allowed": false,
"type": 1,
"limitLeft": 0,
"resetTime": 1594684800000
},
"allowed": false
}
// When API/User limit is exhausted
{
"code": 152,
"message": "API limit reached",
"responseCode": 200,
"limit": {
"allowed": false,
"type": 1,
"limitLeft": 0,
"resetTime": 1594684800000
},
"allowed": false
}

Example Curl Request

curl --request GET --url 'https://api.biconomy.io/api/v1/dapp/checkLimits?userAddress=<USER_ADDRESS>&apiId=<API_ID_HERE>' --header 'x-api-key: <API_KEY_HERE>'