Management API Reference

Server

Backend wallet with Rest API

Use a backend wallet to transfer an asset using Rest API.

You can also request Openfort's REST API directly to use backend wallets. When requesting the REST API directly, you must set certain headers on your requests.

1

Get your API Keys

Open your project in the Openfort Dashboard and grab your secret key from the project settings.

All API requests must be authenticated using your secret key. Include it in the Authorization header using Basic auth.

Terminal

_10
# Export your secret key as an environment variable
_10
export YOUR_SECRET_KEY=sk_test_...
_10
_10
# Test the API connection
_10
curl https://api.openfort.xyz/v1/tokens \
_10
-u "$YOUR_SECRET_KEY:"

2

Create a backend wallet

Backend wallet (dac) can be used for escrow, minting, and transferring assets. Create a new custodial Backend wallet using the API.

The response will include the backend wallet ID (starts with dac_) and its blockchain address.

Terminal

_10
curl https://api.openfort.xyz/v1/settings/developer_accounts \
_10
-u "$YOUR_SECRET_KEY:" \
_10
-d name="Transfer Account"

3

Add a contract to Openfort

Add your token contract to Openfort. This example uses a simple ERC-20 contract with transfer functionality.

Save the returned contract ID (starts with con_) for the next step.

Terminal

_31
curl https://api.openfort.xyz/v1/contracts \
_31
-u "$YOUR_SECRET_KEY:" \
_31
-d chainId=80002 \
_31
-d address="0x2522F4Fc9aF2E1954a3D13f7a5B2683A00a4543A" \
_31
-d abi=[
_31
{
_31
"inputs": [
_31
{
_31
"internalType": "address",
_31
"name": "to",
_31
"type": "address"
_31
},
_31
{
_31
"internalType": "uint256",
_31
"name": "amount",
_31
"type": "uint256"
_31
}
_31
],
_31
"name": "transfer",
_31
"outputs": [
_31
{
_31
"internalType": "bool",
_31
"name": "",
_31
"type": "bool"
_31
}
_31
],
_31
"stateMutability": "nonpayable",
_31
"type": "function"
_31
}
_31
] \
_31
-d name="Example Token"

4

Create a Transfer Transaction

Create a transaction intent to transfer tokens using your backend wallet. Replace:

  • dac_... with your Backend wallet ID
  • con_... with your contract ID
  • pla_... with the recipient's player ID
  • The amount with your desired transfer amount in wei (the example shows 1 token with 18 decimals)

Setting optimistic=true means the response will be returned after simulation but before on-chain confirmation.

Terminal

_10
curl https://api.openfort.xyz/v1/transaction_intents \
_10
-u "$YOUR_SECRET_KEY:" \
_10
-d chainId=80002 \
_10
-d 'account=dac_...' \
_10
-d optimistic=true \
_10
-d 'interactions[0][contract]=con_....' \
_10
-d 'interactions[0][functionName]=transfer' \
_10
-d 'interactions[0][functionArgs][0]=pla_...' \
_10
-d 'interactions[0][functionArgs][1]=1000000000000000000'

5

Check Transaction Status

You can check the status of your transaction using the transaction intent ID returned in the previous step.

The response will include the transaction hash and status once the transaction is processed.

Terminal

_10
curl https://api.openfort.xyz/v1/transaction_intents/tin_... \
_10
-u "$YOUR_SECRET_KEY:"