API reference
Terminate a card
POST
/cards/{id}/terminatePermanently closes the card. Withdraw the balance first, down to the $5.00 minimum the issuer keeps on each card; a larger balance returns card_state_conflict. In the Sandbox the remaining minimum returns to your wallet immediately; in Live it is refunded once the issuer releases it (up to 45 days).
- Required scope
- cards:write
- Idempotency-Key
- Not used
- Environments
- Sandbox and Live
Parameters
idstring · pathrequiredmax length 64
Example request
curl -X POST "https://api.gloresend.com/sandbox/v1/cards/card_9f8e7d6c5b4a3f2e1d0c/terminate" \
-H "Authorization: Bearer $GLORESEND_TEST_KEY"Response · 200
200 · application/json
{
"id": "card_9f8e7d6c5b4a3f2e1d0c",
"object": "card",
"environment": "sandbox",
"product": "visa-404",
"network": "Visa",
"currency": "USD",
"status": "terminated",
"cardholder": {
"first_name": "Ada",
"last_name": "Example",
"email": "ada@example.com"
},
"last4": "4242",
"expiry_month": "10",
"expiry_year": "2029",
"balance": 5000,
"reference": "EMP-0042",
"metadata": {},
"created_at": "2026-10-15T09:30:00.000Z",
"test_data": true
}Response fields
idstringrequiredobjectenumrequired"card"
environmentenumrequired"sandbox", "live"
productstringrequirednetworkenumrequired"Visa", "Mastercard"
currencyenumrequired"USD"
statusenumrequired"active", "frozen", "terminated"
cardholderobjectrequiredcardholder.first_namestringrequiredmin length 1 · max length 50 · pattern ^[\p{L} '\-.]+$/u
cardholder.last_namestringrequiredmin length 1 · max length 50 · pattern ^[\p{L} '\-.]+$/u
cardholder.emailstringrequiredmax length 254 · email
last4stringrequiredexpiry_monthstringrequiredexpiry_yearstringrequiredbalanceintegerrequiredCard balance in USD cents, as of the last operation through GLORESEND.
referencestring | nullrequiredmetadatamap of stringrequiredcreated_atstringrequireddate-time
test_databooleanrequired
Errors
- 401authentication_requiredNo credentials were supplied. Send
Authorization: Bearer <api key>. - 401invalid_api_keyThe API key is unknown, revoked or expired.
- 401environment_mismatchThe API key belongs to a different environment than the base URL you called. Sandbox keys (
gs_test_) only work against the Sandbox base URL, Live keys (gs_live_) only against the Live base URL. - 429rate_limitedToo many requests. Wait for the number of seconds in the
Retry-Afterheader. - 403insufficient_scopeThe API key does not have the scope required for this endpoint.
- 404not_foundThe requested resource does not exist or is not visible to this API key.
- 409card_state_conflictThe operation is not allowed in the card's current state (for example funding a frozen or terminated card, or terminating a card that still has a balance).
- 403activation_requiredLive card programs require an activated account (business verification and setup fee).
- 503live_operations_disabledLive money movement is not enabled on this deployment. No provider has been authorized yet.
- 503provider_not_configuredNo payment provider is configured for this environment and operation.
- 502provider_errorThe downstream provider returned an error. The transfer was marked as failed and reserved funds were released.
- 504provider_timeoutThe downstream provider did not answer in time. The transfer was marked as failed and reserved funds were released.