Get Or Create Holder
Endpoint: PUT /holder/:userId
| Auth: π Secret Key | Purpose: Create or retrieve holder wallet
π€ AI Implementation Summary:
- Usage: Call during user signup to create wallet for token operations
- Parameters:
userId
- Your internal user identifier (email, UUID, etc.) - Returns: Wallet address for future token operations
- Workflow: User signup β Call this endpoint β Store returned address
Get Or Create a Holder for your organization. Holder wallets can be created for your customers with an custom user id of your choice.
PUTapi.metal.build/holder/:userId
Get Or Create a Holder
This endpoint returns a user's holder address if the user exists. If the user does not exist, a wallet will be created for them using a custom external id of your choice.
β‘
AI Implementation Tip
This is typically called during user signup. The userId should be your internal user identifier (email, UUID, etc.). Store the returned wallet address for future token operations.
Required attributes
- Name
userId
- Type
- string
- Description
The external id for your holder (e.g., "1234567890"). Must be a stable string.
Request
PUT
api.metal.build/holder/:userIdconst response = await fetch(`https://api.metal.build/holder/1234567890`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_SECRET_API_KEY',
},
})
const holder = await response.json()
Response
{
"success": true,
"id": "1234567890",
"address": "0x38A7ff01f9A2318feA8AafBa379a6c2c18b5d1dc",
"totalValue": 0,
"tokens": []
}