Generate AUTH token
Go to the "Account" tab on left menu to view your Auth Token.
You can regenerate you Auth Token by clicking on the Regenerate Token
button.
API to create a new dapp
POST
https://api.biconomy.io/api/v1/dapp/public-api/create-dapp
API lets you create a new dapp.
Using the authToken generated from the Account section, one can add create a new dapp for given network id.
Request Body
200: OK Dapp registered successfully 401: Unauthorized Failure in authentication 500: Internal Server Error Something went wrong
Copy {
code : 200 ,
message : 'Dapp registered successfully' ,
data : {
apiKey: 'UxTyLRqlJ.1cb6b15c-6351-4f30-9a56-30d7b143d167', // apiKey is used to init biconomy instance to relay transactions for this Dapp
fundingKey : 1655702620000 // This funding key can be used to recharge gas tank
}
}
Copy { code : 401 , message : 'Failure in authentication' , responseCode : 401 }
Copy { code : 500 , message : 'Something went wrong' , responseCode : 500 }
API to add a new smart contract for a given dapp
POST
https://api.biconomy.io/api/v1/smart-contract/public-api/addContract
API lets you add a new smart contract to an already registered dapp.
Using the authToken generated from the Account section and the apiKey of a dapp, one can add a new smart contract for that dapp.
Request Body
200: OK Smart contract successfully registered 400: Bad Request Happens when invalid contract address or abi is sent in request. 401: Unauthorized Failure of user authentication 404: Not Found Happens when User is not found 406: Not Acceptable When more than one Smart Contract Wallet is registered for a Dapp 409: Conflict Smart contract already exists
Copy { "code" : 200, "message" : "SmartContract registered successfull", "responseCode" : 200 }
Copy { "code" : 400, "message" : "Enter valid abi (contract address)", responseCode : 400 }
Copy { "code" : 401, "message" : "Failure in authentication", "responseCode" 401 }
Copy { "code" : 144, "message" : "User Does Not Exist", responseCode: 143 }
Copy { "code" : 406, "message" : "Only one Smart Contract Wallet is allowed per Dapp", "responseCode" : 406 }
Copy { "code" : 409, "message" : "SmartContract already exists", "responseCode" : 409 }
API to delete a smart contract from dashboard for a given dapp
DELETE
https://api.biconomy.io/api/v1/smart-contract/public-api/deleteContract
API lets you delete a smart contract.
Using the authToken generated from the Account section and the apiKey of a dapp, one can delete a smart contract of that dapp.
Request Body
200 Smart contract successfully removed 401 Failure of user authentication 404
Copy { "code" : 143, "message" : "Contract removed successfully", "responseCode": 143 }
Copy { "code" : 401, "message" : "Failure in authentication", "responseCode" 401 }
Copy { "code" : 144, "message" : "User Does Not Exist", responseCode: 143 }
API to add a method for a given dapp and smart contract address
POST
https://api.biconomy.io/api/v1/meta-api/public-api/addMethod
Using the authToken generated from the Account section and the apiKey of a dapp and API lets you add a contract method of an already registered smart-contract.
Request Body
200 Meta api successfully registered 400 Email is not verified 401 Failure of user authentication 409 Method name already registered
Copy { "code" : 144, "message" : "Verify your email first", "responseCode" : 144 }
Copy { "code" : 401, "message" : "Failure in authentication", "responseCode" 401 }
Copy { "code" : 144, "message" : "Api name already exists", responseCode : 144 }
API to delete a method for a given dapp and smart contract address
DELETE
https://api.biconomy.io/api/v1/meta-api/public-api/addMethod
Using authToken and the apiKey of a dapp and the contract address of a smart contract, API lets you delete an already registered method from the dashboard.
Request Body
200 Meta api successfully removed 401 Failure of user authentication
Copy { "code" : 401, "message" : "Failure in authentication", "responseCode" 401 }
You can register webhooks (post and get API calls) which would be executed before sending a transaction.
POST
https://api.biconomy.io/api/v1/dapp/register-webhook
If webhook returns true the transaction goes through and in case of false the transaction fails.
Request Body
200: OK Success 401: Unauthorized Failure In Authentication 500: Internal Server Error Something went wrong
Copy {
code : 200 ,
message: 'WebHook data: <YOUR WEBHOOK> saved for dappId: 62ea418f2945e82d28dc5d26 with webHookId: 0c225d23-cc1e-49cd-9d3d-0740962bc97d',
responseCode : 200 ,
data : { webHookId : '0c225d23-cc1e-49cd-9d3d-0740962bc97d' }
}
Copy { "code" : 401 , "message" : "Failure in authentication" , "responseCode" 401 }
Copy { code : 500 , message : 'Something went wrong' , responseCode : 500 }
In case you want to activate or deactivate your current webhook
PATCH
https://api.biconomy.io/api/v1/dapp/update-webhook
Request Body
200: OK Success 401: Unauthorized Failure in Authentication 500: Internal Server Error Something went wrong
Copy {
code : 200 ,
message: 'WebHook: <YOUR WEBHOOK> set to false for dappId: 62ea418f2945e82d28dc5d26 with webHookId: d9a6e587-0fea-4e06-a1ea-bce0e5b9c410',
responseCode : 200
}
Copy { "code" : 401 , "message" : "Failure in authentication" , "responseCode" 401 }
Copy { code : 500 , message : 'Something went wrong' , responseCode : 500 }
Dashboard APIs from backend
Adding a Dapp
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/dapp/public-api/create-dapp";
let formData = new URLSearchParams({
"dappName" : "dapp-test-2",
"networkId" : "80001",
"enableBiconomyWallet": true
})
const requestOptions = {
method: 'POST',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Adding a smart contract
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/smart-contract/public-api/addContract";
var abi = JSON.stringify(<Add your contract's ABI>);
var formData = new URLSearchParams({
"contractName" : "<contract name>",
"contractAddress" : "<contract address>",
"abi" : abi,
"contractType" : "<contract type>",
"metaTransactionType": "<meta transaction type>"
});
const requestOptions = {
method: 'POST',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken, "apiKey" : apiKey },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Deleting a smart contract
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/smart-contract/public-api/deleteContract";
var formData = new URLSearchParams({
"contractAddress" : "<contract address>",
"contractType" : "<contract type>",
});
const requestOptions = {
method: 'DELETE',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken, "apiKey" : apiKey },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Adding a meta API
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/meta-api/public-api/addMethod";
let formData = new URLSearchParams({
"apiType" : "<native/custom>",
"methodType" : "<read/write>",
"name": "<placeholder name for the method>",
"contractAddress" : "<contract address>",
"method" : "<contract's method name>"
})
const requestOptions = {
method: 'POST',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken, "apiKey" : apiKey },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Deleting a meta API
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/meta-api/public-api/deleteMethod";
let formData = new URLSearchParams({
"contractAddress" : "<contract address>",
"method" : "<contract's method name>"
})
const requestOptions = {
method: 'DELETE',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": authToken, "apiKey" : apiKey },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Registering A Webhook
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/dapp/register-webhook";
let formData = new URLSearchParams({
"webHook" : "https://2j6v8c5ee6.execute-api.ap-south-1.amazonaws.com/v0/check",
"requestType" : "post", // post or get
})
const requestOptions = {
method: 'POST',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": '8ee71107-5ce2-4eba-8978-fe51df4bdce2', "apiKey": 'iMVt-8yws.b303c5bd-b405-4e1b-ac66-d1d6d40001b2' },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Updating A Webhook
Copy const fetch = require("node-fetch");
const authToken = <AUTH Token to be generated from dashboard>;
const apiKey = <Dapp's API Key>;
const url = "https://api.biconomy.io/api/v1/dapp/update-webhook";
let formData = new URLSearchParams({
"webHookId" : "d9a6e587-0fea-4e06-a1ea-bce0e5b9c410",
"active": "false"
})
const requestOptions = {
method: 'PATCH',
headers: { "Content-Type": "application/x-www-form-urlencoded", "authToken": '8ee71107-5ce2-4eba-8978-fe51df4bdce2', "apiKey": 'iMVt-8yws.b303c5bd-b405-4e1b-ac66-d1d6d40001b2' },
body: formData
};
fetch(url, requestOptions)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));