🌎Dashboard APIs

Using these APIs you can perform actions that you can do on dashboard UI like creating or deleting smart contracts or a method of the contract without manually accessing the dashboard.

Generate AUTH token

  1. Go to the "Account" tab on left menu to view your Auth Token.

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

Headers

NameTypeDescription

authToken

string

Token unique to every user account

Request Body

NameTypeDescription

dappName*

String

Name of the dapp you want to set

networkId

String

Network id on which you want to register your dapp on

enableBiconomyWallet

String

Can be set as 'true' or 'false' is you want Biconomy Wallet feature (for SDK version 2.0.38)

{
  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 
  }
}

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.

Headers

NameTypeDescription

authToken*

string

Token unique to every user account

apiKey*

string

Api Key unique to every dapp

Request Body

NameTypeDescription

contractName*

string

Name of the smart contract

contractAddress*

string

Address of the smart contract

abi*

string

Abi of the smart contract

contractType*

string

"SC" or "SCW" if it is a Smart Contract or Smart Contract Wallet

walletType*

string

For contractType "SCW", walletType is "GNOSIS", otherwise leave blank.

metaTransactionType*

string

"DEFAULT", "TRUSTED_FORWARDER", "ERC20_FORWARDER" based on type of meta transaction

{ "code" : 200, "message" : "SmartContract registered successfull", "responseCode" : 200 }

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.

Headers

NameTypeDescription

authToken*

string

Token unique to every user

apiKey*

string

Api Key unique to every dapp

Request Body

NameTypeDescription

contractType*

string

SC/SCW

contractAddress*

string

Address of the smart contract

{ "code" : 143, "message" : "Contract removed successfully", "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.

Headers

NameTypeDescription

authToken*

string

Token unique to every user account

apiKey*

string

Api Key unique to every dapp

Request Body

NameTypeDescription

apiType*

string

native/custom

methodType*

string

"read"/"write" based on the method type

name*

string

Placeholder name

contractAddress*

string

contract address

method*

string

Method name on smart contract

{
  "code": 200,
  "message": "Api registered successfully",
  "apiIds": [
    {
      "apiId": "xxxdf764-13a9-4adc-9181-4db4bexxxxxx",
      "method": "setQuote",
      "name": "setQuote"
    }
  ]
}

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.

Headers

NameTypeDescription

authToken*

string

Token unique to every user account

apiKey*

string

Api-Key unique to every dapp

Request Body

NameTypeDescription

contractAddress*

string

Address of the smart contract

method*

string

Method name on the smart contract

{ "code": 143, "message" : "Api removed successfully", "responseCode" : 143 }

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.

Headers

NameTypeDescription

authToken*

String

Token unique to every user account

apiKey*

String

Api-Key unique to every dapp

Request Body

NameTypeDescription

webHook*

String

webHook url

requestType*

String

post/get

{
  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' }
}

In case you want to activate or deactivate your current webhook

PATCH https://api.biconomy.io/api/v1/dapp/update-webhook

Headers

NameTypeDescription

authToken*

String

Token unique to every user account

apiKey*

String

Api-Key unique to every dapp

Request Body

NameTypeDescription

webHookId*

String

webHookId that you got while registering your webHook

active*

String

'true' or 'false'

{
  code: 200,
  message: 'WebHook: <YOUR WEBHOOK> set to false for dappId: 62ea418f2945e82d28dc5d26 with webHookId: d9a6e587-0fea-4e06-a1ea-bce0e5b9c410',
  responseCode: 200
}

Dashboard APIs from backend

Adding a Dapp

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

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

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

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

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

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

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));

Last updated