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