Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Guides Cards Withdraw from card

Withdraw from card

Move money off a card back to its linked card account or linked wallet, with one call for every card.

4 min read

Withdrawing moves money from a card back to where the card is linked: its card account (account_id), or, for a card issued without one, its linked wallet (wallet_id). One call works for every card. Gravv picks how to move the money, and the answer tells you which.

You can withdraw from an active, frozen (freeze) or blocked card. Only an inactive card is refused.

A money example. Tunde leaves his employer, and his card holds 435.80 USD. His employer blocks the card so it cannot spend, then withdraws 435.80 USD. The money lands in the business's card account, or in its linked wallet as 435.80 USDC, and the card holds 0 USD.

Note

If the card's balance is shared (see Check card balance), it belongs to several cards. Withdrawing takes money the other cards can spend.

Note

After a block, Gravv may return a card's balance to its linked account or wallet by itself, once every card sharing that balance is blocked and the amount is at least 1 USD. Read the balance before you withdraw from a blocked card, and withdraw only what is still available.

POST /v1/cards/withdraw

withdraw from a card
curl --request POST \
--url https://api.gravv.xyz/v1/cards/withdraw \
--header 'Api-Key: <API_KEY>' \
--header 'Idempotency-Key: 4f1d2ed4-a24c-42fe-be07-f4af741a6f90' \
--header 'Content-Type: application/json' \
--data '
{
"card_id": "e7b1c2d3-4f5a-4b6c-8d7e-9f0a1b2c3d4e",
"amount": 435.8
}
'

amount is a JSON number in US dollars with at most 2 decimals, and not more than the card's available balance. The money always goes to the card's linked account or wallet. You cannot send it anywhere else.

The answer

Some cards pay the money out straight away. The answer is then completed, with the chain transaction:

paid out straight away
{
"data": {
"tx_hash": "0x2e5d0af9189b4b4c23bc64b96295e730609ec91e50e452a5da0a4af4bfe5c192",
"status": "completed",
"route": "card"
},
"error": null
}

Other cards pay the money out with a transfer. The answer is then pending, and the money arrives a few seconds later:

paid out by transfer
{
"data": {
"tx_hash": "",
"transfer_id": "8a65408c-868c-4e7e-92e0-41d342b172c5",
"status": "pending",
"route": "transfer"
},
"error": null
}

Either way, Gravv sends the cards.transaction.withdraw webhook when the withdrawal ends, and the card's balance drops by the amount.

Retrying

Send a new Idempotency-Key for each withdrawal. Gravv keeps the answer to a key for 24 hours, errors included, so sending the same key again returns the same answer and does not run the withdrawal again.

Warning

A withdrawal can answer with an error and still go through. Before you retry with a new key, read the card's balance and check for the cards.transaction.withdraw webhook. Retry only if the money did not move. Otherwise you withdraw twice.

What can go wrong

ResponseWhyFix
400 cannot withdraw from an inactive cardThe card was never activatedActivate the card first
400 insufficient balanceThe amount is more than the card's balance. On a blocked card, Gravv may have returned it alreadyRead the balance again, and check for cards.transaction.withdraw
400 you can withdraw up to 1.02 USD; the other 43.98 USD is refund credit, which stays on the card and cannot be withdrawnThe amount is within the card's balance, but part of that balance is merchant refunds, which can be spent on an active card but never withdrawn. The two figures are the card's ownWithdraw no more than the card's available balance. See Refunds can be spent, not withdrawn
503 unable to verify the card's withdrawable balance, please try againGravv could not read how much can leave the cardNothing moved, so retry with a new Idempotency-Key
400 amount must be greater than zeroThe amount is 0 or negativeSend a positive amount
400 card has no account or wallet to withdraw toThe card has neither a card account nor a linked walletContact support
400 a withdrawal for this idempotency key is already in progress; retry shortlyAn earlier call with this key is still runningWait for the webhook or read the balance. Do not start another withdrawal until you know the outcome
400 card withdrawal did not start, retry with the same idempotency keyGravv could not start the transferRead the balance. If the money did not move, retry with a new key
400 the card withdrawal could not be confirmed in time and may still complete; check the card's transactions before trying again with a new idempotency keyGravv started the withdrawal but could not confirm it within about 40 seconds. The money may still moveWait a minute, then read the balance and your webhooks. Retry with a new key only if the money did not move
400 the request could not be completed or internal server errorThe call failed or timed out. The money may still have movedRead the balance and your webhooks before you retry. If the money did not move, retry with a new key
Was this page helpful? Yes No