Sign in

Cancel Cards in Batch

POST https://{organization}.myguper.com/api/loyalty/cards/cancel

Cancels up to 100 cards in one call. Same rules as Cancel Card - a card leaves circulation, stops counting as balance and reads as canceled, with no money moved and no line written to the card flow ledger.

Partial failure is normal, not an error. In a batch of 100 it is expected that a few cards are already canceled, one does not exist and another holds an open redemption reservation. The call answers 200 with the outcome of each item; 400 is reserved for a malformed request (no ids, above the limit, or a non-numeric id).

Possible outcomes per item:

outcome Meaning
canceled The card was canceled by this call
already_canceled It was already canceled - nothing was done, canceledAt is returned
has_open_reservation Refused: reserved value is waiting to be settled or returned (reservedTotal, in cents)
not_found No card with this id in the organization

Run it with dryRun first. It returns exactly what would happen per item plus amountRemoved - how much balance would leave circulation - and writes nothing.

Ids repeated in the same call are processed once. A range never crosses organizations: an id that belongs to another account comes back not_found and is left untouched - every query here is scoped by organization, and not_found is also the right answer so the call cannot be used to probe whether a card exists somewhere else.

Try-it values populated from environment ACME (Demo)


Authentication

Token

Send your user token in the x-guper-authorization header. Endpoints that support a Public mode (e.g. acúmulo and resgate previews) accept the same request without the header — Private mode adds customer data and a confirmation token to the response.

Headers

Name Type Description
x-guper-authorization * string User token issued by Guper. Omit only on endpoints that explicitly support a Public mode.
Content-Type * string Always `application/json` for endpoints that accept a JSON body.

Request body

Content-Type: application/json

{
    "ids": "1512200:1512299;1512305;1512310",
    "dryRun": false                                             // optional
}

Responses

{
    "batchId": "cb_6f2e91a4c3d1",
    "dryRun": false,
    "summary": {
        "requested": 4,
        "canceled": 1,
        "reactivated": 0,
        "already_canceled": 1,
        "not_canceled": 0,
        "has_open_reservation": 1,
        "not_found": 1,
        "amountRemoved": 31200
    },
    "results": [
        { "id": 1512200, "outcome": "canceled", "amount": 31200 },
        { "id": 1512201, "outcome": "already_canceled", "canceledAt": "2026-11-09T18:02:11-03:00" },
        { "id": 1512207, "outcome": "has_open_reservation", "reservedTotal": 5000 },
        { "id": 9999999, "outcome": "not_found" }
    ]
}

Related

Copied to clipboard