Transfer Tokens

This endpoint allows you to transfer tokens from a holders account to a specified address.


POSTapi.metal.build/holder/:userId/transfer

Transfer tokens

This endpoint initiates a token transfer from a holders account to a specified address.


Required attributes

  • Name
    tokenAddress
    Type
    string
    Description

    The address of the token to transfer.

  • Name
    amount
    Type
    number
    Description

    The amount of tokens to transfer.

  • Name
    toAddress
    Type
    string
    Description

    The address to send the tokens to.

Request

POST
api.metal.build/holder/:userId/transfer
const response = await fetch(
  `https://api.metal.build/holder/holder_123/transfer`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_SECRET_API_KEY',
    },
    body: JSON.stringify({
        tokenAddress: '0x191d25c061C081583E616d8978eA670f45A803E5',
        amount: 123,
        toAddress: '0x191d25c061C081583E616d8978eA670f45A12345',
      }),
  }
)

const transfer = await response.json()

Response

{
  "success": true,
  "transactionHash": "0x370cb1ef71d269c045f29641a5e6731dac458a696694a1534cf642a034fbb400",
  "from": "0x0f88BFFBE6b521CD0E68C094F189D3cE6Ba5468d",
  "to": "0x191d25c061C081583E616d8978eA670f45A12345",
  "amount": 123,
  "tokenAddress": "0x191d25c061C081583E616d8978eA670f45A803E5"
}

Was this page helpful?