Skip to content

Delete a saved card

DELETE /api/v2/billing/cards/{id}

Removes a saved card from the account. When you delete the default card, the newest other saved card becomes the default. When it was the only card, card auto-charge has no card to use until a new one is saved. Deleting a card of this account that is already gone also returns 204.

Authentication: An API key with the scope write:billing. About keys and scopes

Request

Path parameters

idstringrequired
The card ID (card_…).

Example

DELETE /api/v2/billing/cards/{id}
curl -X DELETE "https://cloud.hostup.se/api/v2/billing/cards/card_01hxa3b4c5d6e7f8g9h0j1k2m3" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

204 The card is removed.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403The API key lacks write:billing. A session that is not the account owner gets it too.
404The ID is not a card ID of this account.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502The card could not be removed. Try again shortly.