Home

API Reference

The Openfort API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

You can use the Openfort API in test mode, which doesn't affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is live mode or test mode.

The Openfort API doesn't support bulk updates. You can work on only one object per request.

Authentication

The Openfort API uses API keys to authenticate requests. You can view and manage your API keys in the Openfort Dashboard.

Test mode secret keys have the prefix sk_test_ and live mode secret keys have the prefix sk_live_.

Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Use your API key by setting it in the initial configuration of Openfort. The Node.js library will then automatically send this key in each request.

All API requests must be made over HTTPS and must be authenticated. Calls made over plain HTTP will fail. Below, you can see how to send a GET request to the players endpoint to get a list of all your players.


_10
curl https://api.openfort.xyz/v1/players \
_10
-H "Authorization: Bearer sk_test_bdd0••••••••••••••••••••••••••••••••4f23"

All API requests must be authenticated and made over HTTPS.

Expanding Responses

Many objects allow you to request additional information as an expanded response by using the expand request parameter. This parameter is available on multiple API requests, and applies to the response of that request only.

In many cases, an object contains the ID of a related object in its response properties. For example, a Player can have multiple accounts. Those objects can be expanded inline with the expand request parameter. ID fields that can be expanded into objects are noted in this documentation with the expandable label.

You can use the expand param on any endpoint which returns expandable fields, including list, create, and update endpoints.

You can expand several objects at once by identifying multiple items in the expand array.


_47
{
_47
"object": "list",
_47
"url": "/v1/players",
_47
"data": [
_47
{
_47
"id": "pla_...",
_47
"object": "player",
_47
"createdAt": 1689869074,
_47
"name": "Frank McCallister",
_47
"email": "Frank@dMcCallister.com",
_47
"description": "Tutorial",
_47
"livemode": false,
_47
"metadata": null,
_47
"accounts": [
_47
{
_47
"id": "acc_...",
_47
"object": "account",
_47
"createdAt": 1689869074,
_47
"address": "0x0B49...cc73",
_47
"chainId": 80001,
_47
"custodial": true,
_47
"deployed": false
_47
},
_47
{
_47
"id": "acc_7ccae011-4f30-41c0-876f-27679d3e81ef",
_47
"object": "account",
_47
"createdAt": 1689869074,
_47
"address": "0x0B49...cc73",
_47
"chainId": 5,
_47
"custodial": true,
_47
"deployed": false
_47
}
_47
],
_47
"transactionIntents": [
_47
{
_47
"id":"tin_..."
_47
}
_47
]
_47
},
_47
{
_47
"id": "pla_...",
_47
"object": "player",
_47
...
_47
}
_47
]
_47
...
_47
}

Errors

In this guide, we will talk about what happens when something goes wrong while you work with the API. Let's look at some status codes and error types you might encounter.

You can tell if your request was successful by checking the status code when receiving an API response. If a response comes back unsuccessful, you can use the error type and error message to figure out what has gone wrong and do some rudimentary debugging.

Sign up a player.

post/auth/v1/signup

Body Parameters
  • email
    REQUIRED
    string

    The email address of the user.

  • password
    REQUIRED
    string

    The password of the user.

  • name
    REQUIRED
    string

    The name of the user.

  • description
    Optional
    string

    The description of the user.

Login a player.

post/auth/v1/login

Body Parameters
  • email
    REQUIRED
    string

    The email address of the user.

  • password
    REQUIRED
    string

    The password of the user.

Verify an auth token.

get/auth/v1/verify

Query Parameters
  • token
    REQUIRED
    string

    Specifies the auth token.

List authenticated players.

get/auth/v1/players

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • email
    Optional
    string

    Specifies the email address of the user.

Configure Google OAuth2.

post/auth/v1/config

Body Parameters
  • googleClientId
    REQUIRED
    string

    The Google client ID.

  • googleEnabled
    REQUIRED
    boolean

    Specifies whether Google Auth is enabled.

  • googleClientSecret
    REQUIRED
    string

    The Google client secret.

Get the google oauth signin url.

get/auth/v1/google/signin_url

Get the google oauth token.

get/auth/v1/google/token

Query Parameters
  • key
    REQUIRED
    string

    Specifies the oauth key.

List accounts of a player.

get/v1/accounts

Returns a list of accounts for the given player. The accounts are returned sorted by creation date, with the most recently created accounts appearing first. By default, a maximum of ten accounts are shown per page.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • expand
    Optional
    array

    An array with:

    transactionIntents

    Specifies the fields to expand in the response.

  • player
    REQUIRED
    string

    Specifies the unique player ID

{
  "object": "list",
  "url": "/v1/accounts",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
      "createdAt": 1689869074,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "chainId": 5,
      "deployed": true,
      "custodial": false,
      "object": "account",
      "accountType": "DEFAULT",
      "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "transactionIntents": [
        {
          "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
        }
      ]
    }
  ]
}

Create an account object.

post/v1/accounts

This endpoint allows you to add a new account to your Openfort player. Only one account can be active per chain per player.

Body Parameters
  • chainId
    REQUIRED
    integer

    The chain id

  • externalOwnerAddress
    Optional
    string

    The address of the external owner

  • accountType
    Optional
    string

    One of:

    Upgradeable

    Managed

    ERC6551

    Recoverable

    The type of account (Upgradeable, Managed or ERC6551)

  • tokenContract
    Optional
    string

    If ERC6551, the NFT contract to use

  • tokenId
    Optional
    number

    If ERC6551, the tokenID to serve as owner

  • player
    REQUIRED
    string

    The player ID

{
  "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deployed": true,
  "custodial": false,
  "object": "account",
  "accountType": "DEFAULT",
  "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "transactionIntents": [
    {
      "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
    }
  ]
}

Get existing account.

get/v1/accounts/{id}

Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    transactionIntents

{
  "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deployed": true,
  "custodial": false,
  "object": "account",
  "accountType": "DEFAULT",
  "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "transactionIntents": [
    {
      "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
    }
  ]
}

Request ownership transfer of an account.

post/v1/accounts/{id}/request_transfer_ownership

This endpoint allows you to perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Body Parameters
  • newOwnerAddress
    REQUIRED
    string

    The address of the new owner

  • policy
    REQUIRED
    string

    The policy ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Cancel request of ownership transfer of an account.

post/v1/accounts/{id}/cancel_transfer_ownership

This endpoint allows you to cancel a pending transfer of ownership.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Body Parameters
  • policy
    REQUIRED
    string

    The policy ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Sign a given payload

post/v1/accounts/{id}/sign_payload

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Body Parameters
  • domain
    REQUIRED
    object

    Domain. Specific to the dApp.

  • types
    REQUIRED
    object
  • primaryType
    REQUIRED
    string
  • value
    REQUIRED
    object
  • hash
    REQUIRED
    string

    Hash to verify and that will be signed

{
  "account": "acc_...",
  "hash": "0x25d3...005c",
  "object": "signature",
  "signature": "0x25d3...005c",
  "address": "0x8C5cedA46A2...36Ad2F6255BdBEa"
}

Sync account state with the blockchain

post/v1/accounts/{id}/sync

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

{
  "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deployed": true,
  "custodial": false,
  "object": "account",
  "accountType": "DEFAULT",
  "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "transactionIntents": [
    {
      "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
    }
  ]
}

Start a recovery process of a recoverable account.

post/v1/accounts/{id}/start_recovery

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Body Parameters
  • newOwnerAddress
    REQUIRED
    string

    Address of the new owner

  • policy
    REQUIRED
    string

    The policy ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Complete a recovery process of a recoverable account.

post/v1/accounts/{id}/complete_recovery

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Body Parameters
  • newOwnerAddress
    REQUIRED
    string

    Address of the new owner

  • signatures
    Optional
    array

    Signatures

  • policy
    REQUIRED
    string

    The policy ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

List contracts.

get/v1/contracts

List of all contracts per project. By default, a maximum of ten contracts are shown.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • name
    Optional
    string

    Specifies the name of the contract.

  • deleted
    Optional
    boolean

    Specifies whether to include deleted contracts.

  • chainId
    Optional
    integer

    The chain ID of the contract.

  • address
    Optional
    string

    Specifies the address of the contract.

{
  "object": "list",
  "url": "/v1/contracts",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "con_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
      "createdAt": 1689869074,
      "object": "contract",
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "chainId": 5,
      "deleted": false,
      "name": "MyContract",
      "publicVerification": true,
      "abi": [
        {
          "constant": false,
          "inputs": [
            {
              "name": "addr",
              "type": "address"
            }
          ]
        }
      ]
    }
  ]
}

Create contract object.

post/v1/contracts

Add a new contract to your project in Openfort

Body Parameters
  • name
    REQUIRED
    string

    Specifies the name of the contract (Only for display purposes).

  • chainId
    REQUIRED
    integer

    Specifies the chain ID of the contract.

  • address
    REQUIRED
    string

    Specifies the address of the contract.

  • abi
    Optional
    array

    Specifies the ABI of the contract.

  • publicVerification
    Optional
    boolean

    Specifies whether to verify the contract publicly.

{
  "id": "con_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "object": "contract",
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deleted": false,
  "name": "MyContract",
  "publicVerification": true,
  "abi": [
    {
      "constant": false,
      "inputs": [
        {
          "name": "addr",
          "type": "address"
        }
      ]
    }
  ]
}

Get a contract.

get/v1/contracts/{id}

Retrieve a contract by providing their contract id.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique contract ID.

{
  "id": "con_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "object": "contract",
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deleted": false,
  "name": "MyContract",
  "publicVerification": true,
  "abi": [
    {
      "constant": false,
      "inputs": [
        {
          "name": "addr",
          "type": "address"
        }
      ]
    }
  ]
}

Updates a contract object.

post/v1/contracts/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique contract ID.

Body Parameters
  • name
    Optional
    string

    Specifies the name of the contract (Only for display purposes).

  • chainId
    Optional
    integer

    Specifies the chain ID of the contract.

  • deleted
    Optional
    boolean

    Specifies whether to delete the contract.

  • address
    Optional
    string

    Specifies the address of the contract.

  • abi
    Optional
    array

    Specifies the ABI of the contract.

  • publicVerification
    Optional
    boolean

    Specifies whether to verify the contract publicly.

{
  "id": "con_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "object": "contract",
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deleted": false,
  "name": "MyContract",
  "publicVerification": true,
  "abi": [
    {
      "constant": false,
      "inputs": [
        {
          "name": "addr",
          "type": "address"
        }
      ]
    }
  ]
}

Deletes a contract object.

delete/v1/contracts/{id}

Delete a contract from the project by providing its contract id.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique contract ID.

{
  "id": "con_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "deleted": true,
  "object": "contract"
}

Get inventory of player.

get/v1/players/{id}/inventory

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • chainId
    REQUIRED
    integer

    Filter by chain id.

{
  "object": "inventory",
  "nativeAsset": {
    "assetType": 1,
    "amount": "1000000000000000000",
    "lastTransferredAt": 1689869074
  },
  "nftAssets": [
    {
      "assetType": 2,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "tokenId": 1,
      "lastTransferredAt": 1689869074
    }
  ],
  "tokenAssets": [
    {
      "assetType": 3,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "tokenId": 1,
      "amount": "1000000000000000000",
      "lastTransferredAt": 1689869074
    }
  ]
}

Get NFTs list of player.

get/v1/players/{id}/inventory/nft

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • contractId
    Optional
    array

    Filter by contract ID.

  • chainId
    REQUIRED
    integer

    Filter by chain id.

{
  "object": "list",
  "url": "/v1/players/pla_.../inventory/nft",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "assetType": "ERC1155",
      "amount": "1",
      "tokenId": 1,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "lastTransferredAt": 1689869074
    }
  ]
}

Get cryptocurrency list of player.

get/v1/players/{id}/inventory/cryptocurrency

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • contractId
    Optional
    array

    Filter by contract ID.

  • chainId
    REQUIRED
    integer

    Filter by chain id.

{
  "object": "list",
  "url": "/v1/players/pla_.../inventory/cryptocurrency",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "assetType": "ERC20",
      "amount": "1000000000000000000",
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "lastTransferredAt": 1689869074
    }
  ]
}

Get native token list of player.

get/v1/players/{id}/inventory/native

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • chainId
    REQUIRED
    integer

    Filter by chain id.

{
  "object": "inventory",
  "url": "/v1/players/pla_.../inventory/native",
  "data": {
    "assetType": "ETH",
    "amount": "1000000000000000000",
    "lastTransferredAt": 1689869074
  }
}

Get inventory of account.

get/v1/accounts/{id}/inventory

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Retrieves the NFT assets of an existing account.

get/v1/accounts/{id}/inventory/nft

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • contractId
    Optional
    array
{
  "object": "list",
  "url": "/v1/accounts/acc_.../inventory/nft",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "assetType": "ERC1155",
      "amount": "1",
      "tokenId": 1,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "lastTransferredAt": 1689869074
    }
  ]
}

Retrieves the cryptocurrency assets of an existing account.

get/v1/accounts/{id}/inventory/cryptocurrency

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • contractId
    Optional
    array
{
  "object": "list",
  "url": "/v1/accounts/acc_.../inventory/cryptocurrency",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "assetType": "ERC20",
      "amount": "1000000000000000000",
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "lastTransferredAt": 1689869074
    }
  ]
}

Retrieves the native asset of an existing account.

get/v1/accounts/{id}/inventory/native

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique account ID.

{
  "object": "inventory",
  "url": "/v1/accounts/acc_.../inventory/native",
  "data": {
    "assetType": "ETH",
    "amount": "1000000000000000000",
    "lastTransferredAt": 1689869074
  }
}

List players.

get/v1/players

By default, a maximum of ten players are shown.

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • expand
    Optional
    array

    An array with:

    transactionIntents

    accounts

    Specifies the fields to expand in the response.

  • name
    Optional
    string

    Filter by player name.

{
  "object": "list",
  "url": "/v1/players",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "pla_1234567890",
      "createdAt": 1689869074,
      "object": "player",
      "description": "My Player",
      "metadata": "{\"name\": \"My Player\"}",
      "name": "My Player",
      "accounts": [
        {
          "id": "acc_1234567890"
        }
      ],
      "transactionIntents": [
        {
          "id": "tin_1234567890"
        }
      ]
    }
  ]
}

Create a player object.

post/v1/players

Add a new player to your player list in Openfort.

Body Parameters
  • name
    REQUIRED
    string

    Specifies the player name.

  • description
    Optional
    string

    Specifies the player description.

{
  "id": "pla_1234567890",
  "createdAt": 1689869074,
  "object": "player",
  "description": "My Player",
  "metadata": "{\"name\": \"My Player\"}",
  "name": "My Player",
  "accounts": [
    {
      "id": "acc_1234567890"
    }
  ],
  "transactionIntents": [
    {
      "id": "tin_1234567890"
    }
  ]
}

Retrieves the details of an existing player.

get/v1/players/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    transactionIntents

    accounts

    Specifies the expandable fields.

{
  "id": "pla_1234567890",
  "createdAt": 1689869074,
  "object": "player",
  "description": "My Player",
  "metadata": "{\"name\": \"My Player\"}",
  "name": "My Player",
  "accounts": [
    {
      "id": "acc_1234567890"
    }
  ],
  "transactionIntents": [
    {
      "id": "tin_1234567890"
    }
  ]
}

Updates a player object.

post/v1/players/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • name
    Optional
    string

    Specifies the player name.

  • description
    Optional
    string

    Specifies the player description.

{
  "id": "pla_1234567890",
  "createdAt": 1689869074,
  "object": "player",
  "description": "My Player",
  "metadata": "{\"name\": \"My Player\"}",
  "name": "My Player",
  "accounts": [
    {
      "id": "acc_1234567890"
    }
  ],
  "transactionIntents": [
    {
      "id": "tin_1234567890"
    }
  ]
}

Request transfer ownership of account.

post/v1/players/{id}/request_transfer_ownership

This endpoint allows you to perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • policy
    REQUIRED
    string

    The policy ID

  • chainId
    REQUIRED
    integer

    The chain id where the account is.

  • newOwnerAddress
    REQUIRED
    string

    The address of the new owner

  • player
    Optional
    string

    The player ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Cancel request to transfer ownership of an account.

post/v1/players/{id}/cancel_transfer_ownership

This endpoint allows you to cancel a pending transfer of ownership.

Path Parameters
  • id
    REQUIRED
    string
Body Parameters
  • policy
    REQUIRED
    string

    The policy ID

  • chainId
    REQUIRED
    integer

    The chain id where the account is.

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Request transfer ownership of account.

post/v1/players/{id}/request_transfer_ownership

This endpoint allows you to perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • policy
    REQUIRED
    string

    The policy ID

  • chainId
    REQUIRED
    integer

    The chain id where the account is.

  • newOwnerAddress
    REQUIRED
    string

    The address of the new owner

  • player
    Optional
    string

    The player ID

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Cancel request to transfer ownership of an account.

post/v1/players/{id}/cancel_transfer_ownership

This endpoint allows you to cancel a pending transfer of ownership.

Path Parameters
  • id
    REQUIRED
    string
Body Parameters
  • policy
    REQUIRED
    string

    The policy ID

  • chainId
    REQUIRED
    integer

    The chain id where the account is.

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Create session object for a player.

post/v1/players/{id}/sessions

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • address
    REQUIRED
    string

    The address of the session key.

  • chainId
    REQUIRED
    integer

    The chain ID.

  • externalOwnerAddress
    Optional
    string

    If no account exists for a given player, create one with this address.

  • limit
    Optional
    integer

    Maximum number of times the session key can be used.

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • policy
    Optional
    string

    The policy ID.

  • validAfter
    REQUIRED
    integer

    The unix timestamp in seconds when the session key becomes valid.

  • validUntil
    REQUIRED
    integer

    The unix timestamp in seconds when the session key expires.

  • whitelist
    Optional
    array

    The list of whitelisted addresses (contracts the session key can interact with).

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

Revoke session object for a player.

post/v1/players/{id}/sessions/revoke

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • address
    REQUIRED
    string

    The address of the session key to revoke.

  • policy
    Optional
    string

    The policy ID

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • chainId
    REQUIRED
    integer

    The chain ID.

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

List of accounts of a player.

get/v1/players/{id}/accounts

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    transactionIntents

    Specifies the expandable fields.

{
  "object": "list",
  "url": "/v1/accounts",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
      "createdAt": 1689869074,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "chainId": 5,
      "deployed": true,
      "custodial": false,
      "object": "account",
      "accountType": "DEFAULT",
      "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "transactionIntents": [
        {
          "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
        }
      ]
    }
  ]
}

Create account object for a player.

post/v1/players/{id}/accounts

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique player ID.

Body Parameters
  • chainId
    REQUIRED
    integer

    The chain id

  • externalOwnerAddress
    Optional
    string

    The address of the external owner

  • accountType
    Optional
    string

    One of:

    Upgradeable

    Managed

    ERC6551

    Recoverable

    The type of account (Upgradeable, Managed or ERC6551)

  • tokenContract
    Optional
    string

    If ERC6551, the NFT contract to use

  • tokenId
    Optional
    number

    If ERC6551, the tokenID to serve as owner

{
  "id": "acc_c502d628-5bb3-42f2-b8d5-62ba46717f3a",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "chainId": 5,
  "deployed": true,
  "custodial": false,
  "object": "account",
  "accountType": "DEFAULT",
  "ownerAddress": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "transactionIntents": [
    {
      "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a"
    }
  ]
}

List policies.

get/v1/policies

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • expand
    Optional
    array

    An array with:

    transactionIntents

    policyRules

    Specifies the fields to expand in the response.

  • name
    Optional
    string

    Specifies the name of the policy.

  • deleted
    Optional
    boolean

    Specifies whether to include deleted contracts.

  • chainId
    Optional
    integer

    The chain ID of the policy.

{
  "object": "list",
  "url": "/v1/policies",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "pol_...",
      "createdAt": 1689869074,
      "name": "TEST",
      "chainId": 5,
      "strategy": {
        "sponsorSchema": "pay_for_user"
      },
      "deleted": false,
      "object": "policy",
      "transactionIntents": [
        {
          "id": "tin_..."
        }
      ],
      "policyRules": [
        {
          "createdAt": 1689869074,
          "id": "afu_...",
          "functionName": "mint"
        }
      ]
    }
  ]
}

Create a policy object.

post/v1/policies

Body Parameters
  • name
    REQUIRED
    string

    Specifies the name of the policy.

  • chainId
    REQUIRED
    integer

    The chain ID of the policy.

  • strategy
    REQUIRED
    object

    The sponsor schema of the policy.

{
  "id": "pol_...",
  "createdAt": 1689869074,
  "name": "TEST",
  "chainId": 5,
  "strategy": {
    "sponsorSchema": "pay_for_user"
  },
  "deleted": false,
  "object": "policy",
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "policyRules": [
    {
      "createdAt": 1689869074,
      "id": "afu_...",
      "functionName": "mint"
    }
  ]
}

Get a policy object.

get/v1/policies/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    transactionIntents

    policyRules

    Specifies the fields to expand.

{
  "id": "pol_...",
  "createdAt": 1689869074,
  "name": "TEST",
  "chainId": 5,
  "strategy": {
    "sponsorSchema": "pay_for_user"
  },
  "deleted": false,
  "object": "policy",
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "policyRules": [
    {
      "createdAt": 1689869074,
      "id": "afu_...",
      "functionName": "mint"
    }
  ]
}

Update a policy object.

post/v1/policies/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

Body Parameters
  • name
    Optional
    string

    Specifies the name of the policy.

  • chainId
    Optional
    integer

    The chain ID of the policy.

  • strategy
    Optional
    object

    The sponsor schema of the policy.

  • deleted
    Optional
    boolean

    Specifies whether to delete the policy.

{
  "id": "pol_...",
  "createdAt": 1689869074,
  "name": "TEST",
  "chainId": 5,
  "strategy": {
    "sponsorSchema": "pay_for_user"
  },
  "deleted": false,
  "object": "policy",
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "policyRules": [
    {
      "createdAt": 1689869074,
      "id": "afu_...",
      "functionName": "mint"
    }
  ]
}

Delete a policy object.

delete/v1/policies/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

{
  "id": "pol_...",
  "deleted": true,
  "object": "policy"
}

List policy rules of a policy.

get/v1/policies/{id}/policy_rules

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    contract

    Specifies the fields to expand.

{
  "object": "list",
  "url": "/v1/policy_rules",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "createdAt": 1689869074,
      "id": "afu_...",
      "object": "policyRule",
      "type": "contract_functions",
      "contract": {
        "id": "con_..."
      },
      "functionName": "mint"
    }
  ]
}

Create a policy rule object for a policy.

post/v1/policies/{id}/policy_rules

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

Body Parameters
  • type
    REQUIRED
    string

    One of:

    contract_functions

    account_functions

    rate_limit

  • functionName
    Optional
    string

    Name of the function in the contract to allow.

  • contract
    Optional
    string

    Contract ID to allow.

  • gasLimit
    Optional
    string

    Gas limit in WEI.

  • countLimit
    Optional
    integer

    Number of times the function will be sponsored.

  • timeIntervalType
    Optional
    string

    One of:

    minute

    hour

    day

    week

    month

    Time interval between sponsorships.

  • timeIntervalValue
    Optional
    integer

    Time interval value.

{
  "createdAt": 1689869074,
  "id": "afu_...",
  "object": "policyRule",
  "type": "contract_functions",
  "contract": {
    "id": "con_..."
  },
  "functionName": "mint"
}

Update a policy rule object of a policy.

post/v1/policies/{policy}/policy_rules/{policy_rule}

Path Parameters
  • policy
    REQUIRED
    string
  • policy_rule
    REQUIRED
    string
Body Parameters
  • type
    REQUIRED
    string

    One of:

    contract_functions

    account_functions

    rate_limit

  • functionName
    Optional
    string

    Name of the function in the contract to allow.

  • contract
    Optional
    string

    Contract ID to allow.

  • gasLimit
    Optional
    string

    Gas limit in WEI.

  • countLimit
    Optional
    integer

    Number of times the function will be sponsored.

  • timeIntervalType
    Optional
    string

    One of:

    minute

    hour

    day

    week

    month

    Time interval between sponsorships.

  • timeIntervalValue
    Optional
    integer

    Time interval value.

{
  "createdAt": 1689869074,
  "id": "afu_...",
  "object": "policyRule",
  "type": "rate_limit",
  "functionName": "count_per_interval",
  "countLimit": 100,
  "timeIntervalType": "day",
  "timeIntervalValue": 1
}

List all gas reports of a policy.

get/v1/policies/{id}/reports

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

{
  "data": [
    {
      "periodNumber": 0,
      "period": {
        "start": 1690848000,
        "end": 1693526399
      },
      "averageTransactionFee": "0.002721745",
      "totalTransactionFee": "0.00544349",
      "totalTransactionFeeInUSD": "0.00191",
      "transactionIntents": [
        {
          "transactionIntentId": "tin_47eed6b7-273c-480e-b5eb-ce4a602c5f17",
          "gasFee": "0.00421644",
          "gasPrice": "0.34918179665034244",
          "gasUsed": "0.000000000000421644",
          "gasFeeInUSD": "0.00148"
        },
        {
          "transactionIntentId": "tin_6d3b4a95-fb49-47b0-92f9-f63927018815",
          "gasFee": "0.00122705",
          "gasPrice": "0.34918179665034244",
          "gasUsed": "0.000000000000122705",
          "gasFeeInUSD": "0.00043"
        }
      ]
    }
  ],
  "object": "list"
}

List policy rules of a policy.

get/v1/policies/{id}/policy_rules

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    contract

    Specifies the fields to expand.

{
  "object": "list",
  "url": "/v1/policy_rules",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "createdAt": 1689869074,
      "id": "afu_...",
      "object": "policyRule",
      "type": "contract_functions",
      "contract": {
        "id": "con_..."
      },
      "functionName": "mint"
    }
  ]
}

Create a policy rule object.

post/v1/policy_rules

Body Parameters
  • type
    REQUIRED
    string

    One of:

    contract_functions

    account_functions

    rate_limit

  • functionName
    Optional
    string

    Name of the function in the contract to allow.

  • contract
    Optional
    string

    Contract ID to allow.

  • gasLimit
    Optional
    string

    Gas limit in WEI.

  • countLimit
    Optional
    integer

    Number of times the function will be sponsored.

  • timeIntervalType
    Optional
    string

    One of:

    minute

    hour

    day

    week

    month

    Time interval between sponsorships.

  • timeIntervalValue
    Optional
    integer

    Time interval value.

  • policy
    REQUIRED
    string

    The unique Policy ID to add the rule to.

{
  "createdAt": 1689869074,
  "id": "afu_...",
  "object": "policyRule",
  "type": "contract_functions",
  "contract": {
    "id": "con_..."
  },
  "functionName": "mint"
}

Update a policy rule object.

post/v1/policy_rules/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy rule ID.

Body Parameters
  • type
    REQUIRED
    string

    One of:

    contract_functions

    account_functions

    rate_limit

  • functionName
    Optional
    string

    Name of the function in the contract to allow.

  • contract
    Optional
    string

    Contract ID to allow.

  • gasLimit
    Optional
    string

    Gas limit in WEI.

  • countLimit
    Optional
    integer

    Number of times the function will be sponsored.

  • timeIntervalType
    Optional
    string

    One of:

    minute

    hour

    day

    week

    month

    Time interval between sponsorships.

  • timeIntervalValue
    Optional
    integer

    Time interval value.

{
  "createdAt": 1689869074,
  "id": "afu_...",
  "object": "policyRule",
  "type": "rate_limit",
  "functionName": "count_per_interval",
  "countLimit": 100,
  "timeIntervalType": "day",
  "timeIntervalValue": 1
}

Deletes a policy rule object.

delete/v1/policy_rules/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique policy rule ID.

{
  "id": "afu_...",
  "object": "policyRule",
  "deleted": true
}

Create a session key.

post/v1/sessions

Body Parameters
  • address
    REQUIRED
    string

    The address of the session key.

  • chainId
    REQUIRED
    integer

    The chain ID.

  • externalOwnerAddress
    Optional
    string

    If no account exists for a given player, create one with this address.

  • limit
    Optional
    integer

    Maximum number of times the session key can be used.

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • policy
    Optional
    string

    The policy ID.

  • validAfter
    REQUIRED
    integer

    The unix timestamp in seconds when the session key becomes valid.

  • validUntil
    REQUIRED
    integer

    The unix timestamp in seconds when the session key expires.

  • whitelist
    Optional
    array

    The list of whitelisted addresses (contracts the session key can interact with).

  • player
    REQUIRED
    string

    The player ID.

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

List session keys of a player.

get/v1/sessions

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • player
    REQUIRED
    string

    The player ID

  • expand
    Optional
    array

    An array with:

    transactionIntents

    Specifies the fields to expand in the response.

{
  "object": "list",
  "url": "/v1/sessions",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "ses_...",
      "createdAt": 1689869074,
      "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
      "updatedAt": 1689869074,
      "isActive": true,
      "validAfter": "1650000000",
      "validUntil": "1700000000",
      "whitelist": [],
      "limit": 100,
      "nextAction": {
        "type": "sign_with_wallet",
        "payload": {
          "userOpHash": "0x..."
        }
      },
      "transactionIntents": [
        {
          "id": "tin_..."
        }
      ],
      "object": "session"
    }
  ]
}

Revoke the session session key.

post/v1/sessions/revoke

Body Parameters
  • address
    REQUIRED
    string

    The address of the session key to revoke.

  • policy
    Optional
    string

    The policy ID

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • chainId
    REQUIRED
    integer

    The chain ID.

  • player
    REQUIRED
    string

    The player ID.

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

Confirms the creation of a session with an external owner.

post/v1/sessions/{id}/signature

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique session ID.

Body Parameters
  • signature
    REQUIRED
    string

    signed userOperationHash by the owner or valid session key

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

Returns a player session by session id

get/v1/sessions/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique session ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    transactionIntents

    Specifies the fields to expand.

{
  "id": "ses_...",
  "createdAt": 1689869074,
  "address": "0x8C5cedA46A26214A52A9D7BF036Ad2F6255BdBEa",
  "updatedAt": 1689869074,
  "isActive": true,
  "validAfter": "1650000000",
  "validUntil": "1700000000",
  "whitelist": [],
  "limit": 100,
  "nextAction": {
    "type": "sign_with_wallet",
    "payload": {
      "userOpHash": "0x..."
    }
  },
  "transactionIntents": [
    {
      "id": "tin_..."
    }
  ],
  "object": "session"
}

List transaction intents.

get/v1/transaction_intents

Query Parameters
  • limit
    Optional
    number

    Specifies the maximum number of records to return.

  • skip
    Optional
    number

    Specifies the offset for the first records to return.

  • order
    Optional
    string

    One of:

    asc

    desc

    Specifies the order in which to sort the results.

  • expand
    Optional
    array

    An array with:

    nextAction

    policy

    player

    account

    Specifies the fields to expand in the response.

  • chainId
    Optional
    integer

    The chain ID.

  • accountId
    Optional
    array

    Filter by account ID.

  • playerId
    Optional
    array

    Filter by player ID.

  • policyId
    Optional
    array

    Filter by policy ID.

{
  "object": "list",
  "url": "/v1/transaction_intents",
  "start": 0,
  "end": 1,
  "total": 1,
  "data": [
    {
      "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
      "createdAt": 1689869074,
      "object": "transactionIntent",
      "userOperationHash": "0x25d3...005c",
      "userOperation": {
        "sender": "0x63B7...484f",
        "nonce": 0,
        "initCode": "0x",
        "callData": "0x940d...0000",
        "callGasLimit": {
          "type": "BigNumber",
          "hex": "0x0352db"
        },
        "verificationGasLimit": {
          "type": "BigNumber",
          "hex": "0x0186a0"
        },
        "maxFeePerGas": {
          "type": "BigNumber",
          "hex": "0x9cca659e7c"
        },
        "maxPriorityFeePerGas": {
          "type": "BigNumber",
          "hex": "0x59682f00"
        },
        "paymasterAndData": "0x8076...931c",
        "signature": "0xbdf8...e81b",
        "preVerificationGas": {}
      },
      "chainId": 5,
      "updatedAt": 1689869074,
      "policy": {
        "id": "pol_..."
      },
      "player": {
        "id": "pla_..."
      },
      "account": {
        "id": "acc_..."
      },
      "response": {
        "createdAt": 1689869074,
        "logs": [],
        "blockNumber": 8789286,
        "transactionHash": "0x25d3...005c",
        "to": "0x0576...1B57",
        "gasUsed": 336730,
        "status": 1,
        "error": null
      },
      "interactions": [
        {
          "functionName": "mint",
          "value": "100000000000000",
          "contract": "0x0576...1B57",
          "functionArgs": [
            "0x63B7...484f"
          ]
        }
      ]
    }
  ]
}

Create a transaction intent object.

post/v1/transaction_intents

Retrieve a transaction intent by providing their id on Openfort. Transaction intents that have not been processed yet, have the `response` attribute as undefined.

Body Parameters
  • player
    REQUIRED
    string

    The player ID.

  • chainId
    REQUIRED
    integer

    The chain ID.

  • policy
    Optional
    string

    The policy ID.

  • externalOwnerAddress
    Optional
    string

    If no account exists for a given player, create one with this address.

  • optimistic
    REQUIRED
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • confirmationBlocks
    Optional
    integer

    Specify the number of blocks after the block with transaction to be assured that transaction is in block. It is possible to use only with optimistic=true

  • interactions
    REQUIRED
    array
{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Get a transaction intent object.

get/v1/transaction_intents/{id}

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique transaction intent ID.

Query Parameters
  • expand
    Optional
    array

    An array with:

    nextAction

    policy

    player

    account

    Specifies the expandable fields.

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}

Estimate gas cost of creating a transaction

post/v1/transaction_intents/estimate_gas_cost

Estimate the gas cost of creating a transaction intent and putting it onchain.

Body Parameters
  • player
    REQUIRED
    string

    The player ID.

  • chainId
    REQUIRED
    integer

    The chain ID.

  • policy
    Optional
    string

    The policy ID.

  • externalOwnerAddress
    Optional
    string

    If no account exists for a given player, create one with this address.

  • optimistic
    REQUIRED
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

  • confirmationBlocks
    Optional
    integer

    Specify the number of blocks after the block with transaction to be assured that transaction is in block. It is possible to use only with optimistic=true

  • interactions
    REQUIRED
    array
{
  "preVerificationGas": "55637",
  "verificationGas": "375974",
  "callGasLimit": "79646",
  "verificationGasLimit": "375974",
  "estimatedTXGas": "444793"
}

Confirms the creation of a transaction intent with an external owner.

post/v1/transaction_intents/{id}/signature

This endpoint is used to put a userOperationHash signature on-chain. This means players that have informed (and use) an [externally-owned account (EOA)](https://ethereum.org/en/developers/docs/accounts/) to authorize operations, such as registering a session key, for their gaming accounts. Given that players with non-custodial accounts are the only ones in possession of the private key, they must sign the information inside the `nextAction` value received from the `POST` API endpoint that creates a transaction_intent, even with their session-keys. Once signed, the client needs to send the signed message using the `/signature` endpoint or use one of the available client-side libraries to do so.

Path Parameters
  • id
    REQUIRED
    string

    Specifies the unique transaction intent ID.

Body Parameters
  • signature
    REQUIRED
    string

    signed userOperationHash by the owner or valid session key

  • optimistic
    Optional
    boolean

    Whether the transactionIntent is optimistic (resolve before it arrives on chain) or not.

{
  "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
  "createdAt": 1689869074,
  "object": "transactionIntent",
  "userOperationHash": "0x25d3...005c",
  "userOperation": {
    "sender": "0x63B7...484f",
    "nonce": 0,
    "initCode": "0x",
    "callData": "0x940d...0000",
    "callGasLimit": {
      "type": "BigNumber",
      "hex": "0x0352db"
    },
    "verificationGasLimit": {
      "type": "BigNumber",
      "hex": "0x0186a0"
    },
    "maxFeePerGas": {
      "type": "BigNumber",
      "hex": "0x9cca659e7c"
    },
    "maxPriorityFeePerGas": {
      "type": "BigNumber",
      "hex": "0x59682f00"
    },
    "paymasterAndData": "0x8076...931c",
    "signature": "0xbdf8...e81b",
    "preVerificationGas": {}
  },
  "chainId": 5,
  "updatedAt": 1689869074,
  "policy": {
    "id": "pol_..."
  },
  "player": {
    "id": "pla_..."
  },
  "account": {
    "id": "acc_..."
  },
  "response": {
    "createdAt": 1689869074,
    "logs": [],
    "blockNumber": 8789286,
    "transactionHash": "0x25d3...005c",
    "to": "0x0576...1B57",
    "gasUsed": 336730,
    "status": 1,
    "error": null
  },
  "interactions": [
    {
      "functionName": "mint",
      "value": "100000000000000",
      "contract": "0x0576...1B57",
      "functionArgs": [
        "0x63B7...484f"
      ]
    }
  ]
}