billing.topup
Build an unsigned USDC top-up transaction to sign.
Details
- Endpoint
- POST /v1/billing/topup
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
Returns base64 transaction bytes that send `usd` of USDC from your address to tide's treasury. Sign them with that address and either send them yourself or POST them with the signature to /v1/billing/topup/submit. Credits land when the transaction is in a checkpoint, about a second later: 333,333 credits per USDC. The transaction is gasless (no SUI needed) unless you pass gas: true. Minimum 1 USD. Any USDC transfer from your address to the treasury counts the same way, matched by sender.
Parameters
| Name | Type | Description |
|---|---|---|
| usdrequired | string or number | USD of USDC to pay, like 10 or 25.50. |
| address | string | The paying address, when you call without a key (with a key, the key's account pays). |
| gas | boolean | true to build a normal transaction that pays gas in SUI instead of a gasless one. |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl
curl -X POST "https://api.tide.ad/v1/billing/topup" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"usd": "10"
}'TypeScript
const res = await fetch("https://api.tide.ad/v1/billing/topup", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"usd": "10"
}),
});
const data = await res.json();Response
JSON
{
"txBytes": "AAAC...",
"gasless": true,
"sender": "0x7d20dcdb2bca4f508ea9613994683eb4e76e9c4ed371169677c1be02aaf0b58e",
"treasury": "0x3d651ddf154835f6cd20e107a9a957b05cc701b9a492a7f680a0a4c3b5d8b0f1",
"usd": "10",
"amountRaw": "10000000",
"credits": 3333333
}