Mint Tokens
Mint tokens by creating an order with a funding asset. Minting sends an equivalent amount of the destination token to the wallet you specify. See the Guide.
-
Set up BitGo v2 HMAC authentication before calling the Mint API from a client that supports pre-request scripting, such as Postman.
The pre-request script adds an
hmacheader derived from the request path, body, and timestamp. Direct cURL calls, like the ones in this cookbook, only need the bearer token. -
List the tokens available to your enterprise, including mint minimums, fees, and your role for each token. The response gives you the chain-scoped asset IDs used in later steps.
Before you start, accept the minting services terms for your enterprise, use an access token for a user with the enterprise member or admin role, and fund a Go Account wallet for the source asset with a user holding Spend permission.
minimumMintAmountis a full-unit string, while the per-pair minimums in the next step are base units. -
List the configured exchange pairs for your enterprise, with per-pair minimums, decimal precision, and fees. For a mint, find the pair whose
sourceis the funding asset and whosedestinationis the token you want to mint.You use
source.decimalsto calculate base units in the next step. -
All order amounts must be positive integer strings in base units, with no decimal point. Multiply the full-unit amount by 10 raised to the power of the source asset's
decimalsvalue.For example, 100 USD at
decimals: 6becomes"100000000". -
Submit the order with the source set to the funding asset and the destination set to the token you want to mint. There is no order
typefield — the direction of the conversion determines the operation.Save the returned
idanddepositInstructions.sequenceId; you need both in the next step. Pass anidempotencyKeyto protect against duplicate orders. -
Creating the order does not move any funds by itself. Send the source funding asset to the wallet in
depositInstructions, using the exactdepositInstructions.sequenceIdreturned by the order.Copy the sequence ID verbatim — a mismatched sequence ID is the most common reason an order stays in
CREATED. Issuer-direct orders (orderMethod: "ISSUER_DIRECT") skip this step. -
Poll the order until it reaches
FULFILLEDorFAILED. The response includes the statustimelineand the client-facingtransactionslegs.The
destination.amountreflects the minted token amount after fees are applied. -
Repeat the
idparameter to fetch a specific set of orders in one call. This is the efficient way to refresh many known orders at once.
# AI SETUP: Before running this cookbook:
# 1. Check if ~/.bitgo/credentials.env exists and source it.
# 2. If not found, ask the user if they have a credentials file at another location.
# - If yes, source that file.
# - If no, prompt the user to provide each value below before proceeding.
// 1. Configure HMAC
# The Mint API uses BitGo v2 HMAC authentication. If calling from Postman, add
# an environment variable BITGO_ACCESS_TOKEN and the pre-request script from the guide.
# The cURL calls below use bearer token auth only.
// 2. List Supported Tokens
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export BASE_URL="https://app.bitgo-test.com/api/mint/v1" # app.bitgo.com for production
curl -s "$BASE_URL/enterprise/$ENTERPRISE_ID/supported-tokens" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-enterprise-id: $ENTERPRISE_ID"
// 3. List Asset Pairs
curl -s "$BASE_URL/enterprise/$ENTERPRISE_ID/asset-pairs" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-enterprise-id: $ENTERPRISE_ID"
// 4. Calculate Mint Amount
# base units = amount * 10^decimals
DECIMALS=6 # from asset-pairs source.decimals
AMOUNT_FULL=100
AMOUNT_BASE=$(echo "$AMOUNT_FULL * 10^$DECIMALS" | bc)
echo "Amount in base units: $AMOUNT_BASE"
// 5. Create a Mint Order
export SOURCE_WALLET_ID="<SOURCE_GO_ACCOUNT_ID>"
export DESTINATION_WALLET_ID="<DESTINATION_WALLET_ID>"
curl -s -X POST "$BASE_URL/enterprise/$ENTERPRISE_ID/orders" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-enterprise-id: $ENTERPRISE_ID" \
-H 'Content-Type: application/json' \
-d '{
"idempotencyKey": "<YOUR_UNIQUE_KEY>",
"source": {
"asset": "tfiatusd",
"amount": "'"$AMOUNT_BASE"'",
"walletId": "'"$SOURCE_WALLET_ID"'",
"type": "GO_ACCOUNT"
},
"destination": {
"asset": "hteth:usd1",
"type": "GO_ACCOUNT",
"walletId": "'"$DESTINATION_WALLET_ID"'"
}
}'
// 6. Transfer Funds to BitGo
# Use the sequenceId and walletId returned in depositInstructions — do not construct them.
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"
export SEQUENCE_ID="<DEPOSIT_INSTRUCTIONS_SEQUENCE_ID>"
export DEPOSIT_WALLET_ID="<DEPOSIT_INSTRUCTIONS_WALLET_ID>"
curl -X POST \
"http://$BITGO_EXPRESS_HOST/api/v2/tfiatusd/wallet/$SOURCE_WALLET_ID/sendcoins" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"address": "'"$DEPOSIT_WALLET_ID"'",
"amount": "'"$AMOUNT_BASE"'",
"walletPassphrase": "'"$WALLET_PASSPHRASE"'",
"sequenceId": "'"$SEQUENCE_ID"'"
}'
// 7. Check Order Status
export ORDER_ID="<YOUR_ORDER_ID>"
curl -s "$BASE_URL/enterprise/$ENTERPRISE_ID/orders/$ORDER_ID" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-enterprise-id: $ENTERPRISE_ID"
// 8. Bulk Fetch Orders by ID (Optional)
curl -s -G "$BASE_URL/enterprise/$ENTERPRISE_ID/orders" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-enterprise-id: $ENTERPRISE_ID" \
--data-urlencode "id=<ORDER_ID_1>" \
--data-urlencode "id=<ORDER_ID_2>"
// AI SETUP: Before running this cookbook:
// 1. Check if ~/.bitgo/credentials.env exists and load it with dotenv.
// 2. If not found, ask the user if they have a credentials file at another location.
// - If yes, load that file instead.
// - If no, prompt the user to provide each required value before proceeding.
// 1. Configure HMAC
// Use the REST API for this step (see cURL tab)
// 2. List Supported Tokens
// Use the REST API for this step (see cURL tab)
// 3. List Asset Pairs
// Use the REST API for this step (see cURL tab)
// 4. Calculate Mint Amount
// Use the REST API for this step (see cURL tab)
// 5. Create a Mint Order
// Use the REST API for this step (see cURL tab)
// 6. Transfer Funds to BitGo
// Use the REST API for this step (see cURL tab)
// 7. Check Order Status
// Use the REST API for this step (see cURL tab)
// 8. Bulk Fetch Orders by ID (Optional)
// Use the REST API for this step (see cURL tab)
// 2. List Supported Tokens Response
{
"tokens": [
{
"token": "usd1",
"assets": ["hteth:usd1", "tbsc:usd1", "tsol:usd1"],
"type": "stablecoin",
"minimumMintAmount": "1",
"minimumBurnAmount": "1",
"mintFeeBps": "0",
"burnFeeBps": "0",
"role": "issuer",
"issuerOrdersEnabled": true,
"name": "USD1"
}
]
}
// 3. List Asset Pairs Response
{
"assetPairs": [
{
"source": { "asset": "tfiatusd", "minimumAmount": "1000000", "decimals": 6 },
"destination": { "asset": "hteth:usd1", "decimals": 2 },
"fee": { "basisPoints": "10" }
}
]
}
// 5. Create a Mint Order Response
{
"id": "95bdbd9c-9cdc-41a4-ae70-165387b7aa51",
"status": "CREATED",
"source": { "asset": "tfiatusd", "amount": "100000000", "type": "GO_ACCOUNT" },
"destination": { "asset": "hteth:usd1", "type": "GO_ACCOUNT" },
"depositInstructions": {
"type": "GO_ACCOUNT",
"asset": "tfiatusd",
"sequenceId": "order-deposit:95bdbd9c-9cdc-41a4-ae70-165387b7aa51",
"walletId": "69490df0179d6702e06d214e493929e2"
}
}
// 6. Transfer Funds to BitGo Response
{
"coin": "tfiatusd",
"transfers": [
{
"id": "transfer_id_12345",
"coin": "tfiatusd",
"wallet": "67bc4b03...",
"value": -100000000,
"baseValue": -100000000,
"state": "unconfirmed",
"type": "send"
}
]
}
// 7. Check Order Status Response
{
"id": "95bdbd9c-9cdc-41a4-ae70-165387b7aa51",
"type": "MINT",
"status": "FULFILLED",
"source": { "asset": "tfiatusd", "amount": "100000000", "type": "GO_ACCOUNT" },
"destination": { "asset": "hteth:usd1", "amount": "9990", "type": "GO_ACCOUNT" },
"fee": { "basisPoints": "10" },
"timeline": [
{ "status": "CREATED", "timestamp": "2025-04-04T09:25:48.216Z" },
{ "status": "CONFIRMED_DEPOSIT", "timestamp": "2025-04-04T09:26:10.001Z" },
{ "status": "PROCESSING", "timestamp": "2025-04-04T09:26:12.500Z" },
{ "status": "FULFILLED", "timestamp": "2025-04-04T09:30:00.000Z" }
]
}
// 8. Bulk Fetch Orders by ID (Optional) Response
{
"orders": [
{
"id": "95bdbd9c-9cdc-41a4-ae70-165387b7aa51",
"type": "MINT",
"status": "FULFILLED",
"source": { "asset": "tfiatusd", "amount": "100000000", "type": "GO_ACCOUNT" },
"destination": { "asset": "hteth:usd1", "amount": "9990", "type": "GO_ACCOUNT" },
"fee": { "basisPoints": "10" },
"orderMethod": "ISSUER_DIRECT",
"createdAt": "2025-04-04T09:25:48.216Z",
"updatedAt": "2025-04-04T09:30:00.000Z"
}
],
"total": 1,
"pageNo": 1,
"pageSize": 50
}