Token API offers the transfer, querying, and delegation of the FT (Fungible Token).

Get Token Information

Returns the token contract information of a contract address (contract).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.name the token name string
data.symbol the symbol of the token string
data.decimals the maximum decimal places of the token number
data.totalSupply the total amount of supply string

Request Sample

Response Sample

Get Token Balance

Returns the current token balance of the token owner account (from).

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/balance
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/balance
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y
from the token owner string Y

Query Parameters

Field Name Description Type Required
details whether to return the balance details boolean N

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.value the token balance string
data.rawValue the token balance not applying data.decimals string
data.symbol the symbol of the token string
data.decimals the maximum decimal places of the token number

Request Sample

Response Sample

Get Token Amount Available for Approved Transfer

Returns the amount of tokens that the token owner account from has approved the spender account to send on behalf of the owner.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/allowance/{spender}
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/account/{from}/allowance/{spender}
HTTP Method GET
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y
from the token owner string Y
spender the account that is granted to send tokens string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.allowance the amount of tokens can be sent string

Request Sample

Response Sample

Send Token

Creates a transaction that sends tokens to a specific address. from must be the token owner. If the receiver account (to) is a contract, this contract can do additional tasks with data.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}/transfer
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/transfer
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Request Body

Field Name Description Type Required
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N
from the account address that sends the token string Y
to the account address that receives the token string Y
amount the amount of tokens to be sent string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Send Token on behalf of Owner

Creates a transaction that sends tokens to a specific address on behalf of the token owner. from must be the account that is delegated with the right to send tokens from the token owner (owner). If the receiver account (to) is a contract, this contract can do additional tasks with data.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}/transfer-from
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/transfer-from
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the contract address string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Request Body

Field Name Description Type Required
from the wallet address of the account that is granted to send tokens string Y
to the wallet address that receives the token string Y
amount the amount of tokens to be sent string Y
data the data that will be sent if the receiver is a contract string Y
owner the wallet address of the token owner account string Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Grant the Right to Send Tokens

Creates a transaction that the from account approves to account to send the amount of tokens on behalf of the from account. from must be the token owner.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/{contract}/approve
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/{contract}/approve
HTTP Method POST
Content-Type application/json

Path Parameters

Field Name Description Type Required
contract the address of the token contract string Y

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Request Body

Field Name Description Type Required
from the wallet address of the token owner account string Y
to the wallet address of the account that receives the right to send tokens string Y
amount the amount of tokens to be sent string Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample

Deploy Token Contract

Creates a transaction that deploys the standard token contract.

Request URL

Live URL https://bc-api.qpyou.cn/core/v1/ft/contract
Sandbox URL https://sandbox-bc-api.qpyou.cn/core/v1/ft/contract
HTTP Method POST
Content-Type application/json

Header Parameters

Field Name Description Type Required
x-network the blockchain networks {ploygon, xpla} string Y
Authorization Authentication token required to call the API string Y

Request Body

Field Name Description Type Required
from the wallet address that deploys the token contract string Y
name the token name string Y
symbol the symbol of the token string Y
decimals the maximum decimal places of the token number Y
initialSupply the initial amount of the tokens minted string Y
encoded whether the returned transaction is encoded or not

  • true: Receive the encoded raw transaction string (data.rawTx).
  • false: Receive the decoded data.rawTx (JSON).
boolean N

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message String
data API response data json
data.rawTx the transaction data string or json
data.hashedTx This is hashed data.rawTx. This value is only returned when the API header x-network is “polygon” and the Request Body from is an multi sig wallet address. string
data.requestId the unique value that can identify each API request string

Request Sample

Response Sample