Spend Tokens

This endpoint allows you to spend tokens from a holders account.


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

Spend tokens

This endpoint initiates a token spend from a holders account back to the merchant account.


Required attributes

  • Name
    tokenAddress
    Type
    string
    Description

    The address of the token to spend.

  • Name
    amount
    Type
    number
    Description

    The amount of tokens to spend.

Request

POST
api.metal.build/holder/:userId/spend
const response = await fetch(
  `https://api.metal.build/holder/${userId}/spend`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR-API-KEY',
    },
    body: JSON.stringify({
      tokenAddress: '0x191d25c061C081583E616d8978eA670f45A803E5',
      amount: 123,
    }),
  }
)

const spend = await response.json()

Response

{ "success": true }

Was this page helpful?