billing.allowanceConfirm
Turn on auto top-up after your allowance grant is on chain.
Details
- Endpoint
- POST /v1/billing/allowance/confirm
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
Pass the digest of the grant transaction (or the allowance id). tide reads the allowance on chain, checks that you are the funder, that tide's key is the spender and that it is over USDC, then turns auto top-up on with the threshold and draw amount from /v1/billing/allowance (change them with PUT /v1/billing/autotopup). With neither, tide looks for the newest allowance you granted it. Needs the funder's API key or dashboard session.
Parameters
| Name | Type | Description |
|---|---|---|
| digest | string | Digest of the grant transaction. |
| allowanceId | string | The allowance object id. |
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/allowance/confirm" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"digest": "5ajkuHAnivMiKRne6EYS2bzvHpCHWYx849cmoSHN89Vm"
}'TypeScript
const res = await fetch("https://api.tide.ad/v1/billing/allowance/confirm", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"digest": "5ajkuHAnivMiKRne6EYS2bzvHpCHWYx849cmoSHN89Vm"
}),
});
const data = await res.json();Response
JSON
{
"autoTopup": {
"enabled": true,
"allowanceId": "0x5058e8b9664d2a451664d3f90a8ade0a5bab68a8f3bf2db97e61daa4e76589c0",
"thresholdCredits": 3333333,
"drawUsd": "10"
}
}