API Documentation: Add Custom Asset (Coin/Token) to Portfolio
Overview
This endpoint allow user to add custom asset to particular wallet. User need to provide detail information for custom token.
- HTTP Method: POST
- Endpoint:
/api/v1/portfolios/custom
Request Body Parameters
walletId
(required): this will be used to determine where the asset will be added to.network
(required): The network of asset. Type : string.tokenSymbol
(required): The symbol of asset. Type : string.tokenName
(required): The name of asset. Type : string.tokenAddress
(required): The contract address of asset. Type : string.decimals
(required): The decimal of asset. Type : number.
Example Request Body
{
"walletId": "6105a1f8-abd2-4003-aaa7-e6cae3875acc",
"network": "ethereum",
"tokenSymbol": "myt",
"tokenName": "My Token",
"tokenAddress": "0xfd957f21bd95e723645c07c48a2d8acb8ffb3794",
"decimals": 18
}
Request
Request Headers
X-CLIENT-ID
: (required): Client ID which was generated when register in Xellar TSS API Service Dashboard.X-SIGNATURE
: (required): Calculated signature, please refer to Authorization section.X-TIMESTAMP
: (required): Request timestamp in RFC3339 format.
Example Request Syntax
curl -X POST -H "Content-Type: application/json" -H "x-client-id: $YOUR_CLIENT_ID" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{
"walletId": "6105a1f8-abd2-4003-aaa7-e6cae3875acc",
"network": "ethereum",
"tokenSymbol": "myt",
"tokenName": "My Token",
"tokenAddress": "0xfd957f21bd95e723645c07c48a2d8acb8ffb3794",
"decimals": 18
}' <BASE_URL>/api/v1/portfolios/custom
Response
The response will include a JSON object with the following properties:
status
(number): The HTTP status code of the response (e.g., 200 for success).message
(string): A message providing additional information about the operation.data
(object): An object containing asset information.data.key
(string): Unique identifier for asset on portfolio.data.id
(string): Coin/token id.data.symbol
(string): Coin/token symbol.data.name
(string): Coin/token name.data.network
(string): Coin/token network.data.wrapped
(boolean): Coin/token wrapped status.data.isNative
(boolean): Coin/token native status on particular network.data.logo
(boolean): Coin/token logo.data.contractAddress
(boolean): Coin/token contract address, only have value on non-native asset.data.deicmalPlace
(boolean): Coin/token decimal.data.isCustom
(boolean): Coin/token custom status.
Example Response
// Success : HTTP OK 200
{
"status": 200,
"message": "Add custom asset to portfolio successfully",
"data": {
"key": "fe5a5bd5-492b-462a-afd5-4f9f2688be7d",
"id": "2d914e88-7488-410c-a6b7-cec6fc914423",
"symbol": "myt",
"name": "My Token",
"network": "ethereum",
"wrapped": false,
"isNative": false,
"logo": "",
"contractAddress": "0xfd957f21bd95e723645c07c48a2d8acb8ffb3795",
"decimalPlace": 18,
"isCustom": true
}
}
// Asset exist on wallet : HTTP BAD REQUEST 400
{
"error": "asset already exists on portfolio"
}