Create a Token

You can create a token by sending a POST request to the /token endpoint of Playfix API. This is similar to how you create a project.

Unlike projects, the Playfix Token API provides many token configuration options.

Create a Token

POST https://api.playfix.io/token/tokens

Headers

NameTypeDescription

Authorization*

String

Bearer <your_access_token>

Request Body

NameTypeDescription

project*

String

The name of the project that will contain the token.

title*

String

The title of the token.

config*

Object

Configuration options for the token.

config.symbol*

String

A shorthand symbol to refer to the token. Choose a short, uppercase word between 3-5 characters that is unique within your project.

config.decimals

Integer

A non-negative integer that specifies the number of digits after the decimal point of a unit token. 18 is the standard and recommended decimal for ERC-20 tokens, but you can choose any number from 0 upwards.

config.initialSupply*

Integer

A positive integer specifying the number of tokens that will be minted for a start.

config.totalSupply*

Integer

A positive integer specifying the fixed total number of tokens that can ever exist. The value can either be greater than or equal to the initialSupply.

config.mintable

boolean

Set to true to allow minting of new tokens.

config.burnable

boolean

Set to true to allow burning of tokens.

config.permit

boolean

Set to true to allow gasless approval of tokens.

config.pausable

boolean

Set to true to allow the pausing of token transfers.

config.votes

boolean

Set to true to enable using token for voting.

config.flashMinting

boolean

Set to true to allow flash minting.

config.snapshots

boolean

Set to true to allow snapshots of token balances for easy querying in the future.

config.ownerAddress

String

Wallet address of the contract owner. Which receives the initial token supply.

network*

String

Name of the network where the token will be deployed. Accepted values include:

NETWORK_ETHEREUM,

NETWORK_ETHEREUM_RINKERBY,

NETWORK_POLYGON, or NETWORK_POLYGON_MUMBAI .

{
  "name": "tokens/01gfrf15n9hqw3v08sqearsgh9",
  "project": "<project_name>", 
  "title": "Block Party Game Token",
  "config": {
    "name": "Blocc", 
    "symbol": "BTK", 
    "decimals": "18", 
    "initialSupply": "1000", 
    "totalSupply": "10000", 
    "mintable": true, 
    "burnable": false, 
    "pausable": false, 
    "permit": false, 
    "votes": false, 
    "flashMinting": false, 
    "snapshots": false, 
    "ownerAddress": "<your_wallet_address>"
    },
  "network": "NETWORK_POLYGON_MUMBAI",
  "address": "", 
  "deployTxHash": ""
}

Example cURL API Call

curl --request POST \
  --url https://api.playfix.io/token/tokens \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
    "project": "<project_name>",
    "title": "Block Party Game Token",
    "config": {
        "name": "Blocc",
        "symbol": "BTK",
        "decimals": "18",
        "initialSupply": "1000",
        "totalSupply": "10000",
        "mintable": true,
        "burnable": false,
        "pausable": false,
        "permit": false,
        "votes": false,
        "flashMinting": false,
        "snapshots": false,
        "ownerAddress": "<your_wallet_address>"
        },
    "network": "NETWORK_POLYGON_MUMBAI"
    }'

Example Python API Call

import requests
import json

payload = {
    "project": "<project_name>",
    "title": "Block Party Game Token",
    "config": {
        "name": "Blocc",
        "symbol": "BTK",
        "decimals": "18",
        "initialSupply": "1000",
        "totalSupply": "10000",
        "mintable": True,
        "burnable": False,
        "pausable": False,
        "permit": False,
        "votes": False,
        "flashMinting": False,
        "snapshots": False,
        "ownerAddress": "<your_wallet_address>"
        },
    "network": "NETWORK_POLYGON_MUMBAI",
    }

r = requests.post(
    "https://api.playfix.io/token/tokens",
    headers = {
        "Authorization": "Bearer <your_access_token>",
        "Accept": "application/json",
        "Content-Type": "application/json"
        },
    data = json.dumps(payload)
    )

print(r.text)

Request Body

  • project - The name of the project that will contain the token. This should be the value of name from the project you created earlier.

  • title - The title of the token.

  • config - Configuration options for the token.

    • symbol - A shorthand symbol to refer to the token. Choose a short, uppercase word between 3-5 characters that is unique within your project.

    • decimals - A non-negative integer that specifies the number of digits after the decimal point of a unit token. Decimals are the number of subunits, the smallest unit, that 1 unit of a token contains. For example, ETH has 18 decimals. Therefore, 1 ETH contains 0.000000000000000001 subunits (WEI) of ETH. 18 is the standard and recommended decimal for ERC-20 tokens, but you can choose any number from 0 upwards.

    • initialSupply - A positive integer specifying the number of tokens that will be minted for a start.

    • totalSupply - A positive integer specifying the fixed total number of tokens that can ever exist. This value can either be greater than or equal to the initialSupply. A low supply typically creates scarcity, increasing demand and the token's value.

    • mintable (boolean)- Set to true allow new token minting.

    • burnable (boolean)- Set to true to allow token burning.

    • permit (boolean)- Set to true to allow gasless approval of tokens.

    • pausable (boolean)- Set to true to allow pausing of token transfer.

    • votes (boolean)- Set to true to enable using token for voting.

    • flashMinting (boolean)-Flash minting enables the creation of new tokens that will destroy at the end of the transaction. Set to true to allow flash minting.

    • snapshots (boolean)- Set to true to allow token balances snapshots for easy future querying.

    • ownerAddress - The wallet address of the contract owner. The owner address receives the initial supply and has additional privileges.

  • network - Name of the network where the token contract will be deployed. You can set this to any of the following network values, depending on your preference:

    • NETWORK_ETHEREUM: Ethereum mainnet.

    • NETWORK_ETHEREUM_RINKEBY: Ethereum Gorli testnet. For testing purposes only.

    • NETWORK_POLYGON: Polygon mainnet.

    • NETWORK_POLYGON_MUMBAI: Polygon Mumbai testnet. For testing purposes only.

Except boolean, all values of the payload parameter are passed as strings.

Response

{
  "name": "tokens/01gfrf15n9hqw3v08sqearsgh9",
  "project": "<project_name>", 
  "title": "Block Party Game Token",
  "config": {
    "name": "Blocc", 
    "symbol": "BTK", 
    "decimals": "18", 
    "initialSupply": "1000", 
    "totalSupply": "10000", 
    "mintable": true, 
    "burnable": false, 
    "pausable": false, 
    "permit": false, 
    "votes": false, 
    "flashMinting": false, 
    "snapshots": false, 
    "ownerAddress": "<your_wallet_address>"
    },
  "network": "NETWORK_POLYGON_MUMBAI",
  "address": "", 
  "deployTxHash": ""
}

Response Fields

  • name: A unique name of the token, automatically generated by Playfix. It begins with "tokens/" followed by a ULID.

  • project: Name of the project that contains the token, as specified in the API request.

  • title: Title of the token, as supplied in the API request.

  • config: The configuration options of the token, as supplied in the API request.

  • network: Your selected network where the token will be deployed.

  • address: Address of the token contract when it is deployed. This will be empty for now.

  • deployTxHash: The transaction hash of the token deployment. This will be empty for now.

Last updated