Skip to content

Revoke a card grant

POST/v1/businesses/{id}/memberships/{membershipId}/card-grants/{grantId}/revoke

Requires an API client bearer token.

Ends an active grant (409 grant_not_active otherwise). Without effective_at, or with one not after now, the grant ends at once: its card is terminated, card.closing announces it with closes_at now, and card_grant.ended is emitted. With a later effective_at the end is scheduled: card.closing announces that date for the grant's card, and the grant ends then. A scheduled revoke is never rescheduled (409 revoke_already_scheduled, whatever the date; revoke now to end it sooner), and never at or after the grant's own valid_until (409 revoke_after_grant_end), so no closure is announced later than the real one. A grant whose card is already lost, stolen or terminated ends at once whatever the effective_at, since its card has already closed. Requires an Idempotency-Key. An API client names its acting person in X-Rigid-Acting-Person (400 acting_person_required without it); the person needs an active membership of the business with can_grant_cards, else 403 acting_person_not_permitted. Every call the route decides (the release flag on, a well-formed body, and a valid Idempotency-Key not already used with a different body), allowed or refused, writes one audit intent with the API client, the asserted person, the business and the decision; a replay of a stored outcome writes none, and neither does a 5xx. While the `business-cards` release flag is off for the caller's mode this route answers 404 to every authenticated, well-formed request not replaying an outcome stored while it was on, as if absent.

Parameters

Path parameters

NameRequiredDescription
idrequired
membershipIdrequired
grantIdrequired

Header parameters

NameRequiredDescription
Idempotency-Keyrequired

Client-chosen. An identical retry with the same key returns the stored response; reusing the key with a different payload returns 409.

X-Rigid-Acting-Personoptional

Request body

effective_atstring (date-time)

Example

curl -X POST https://api.rigid.fi/v1/businesses/{id}/memberships/{membershipId}/card-grants/{grantId}/revoke \
  -H "Authorization: Bearer $RIGID_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "effective_at": "date-time"
}'

Responses

200

The grant, ended or with its end scheduled.

idstring (uuid)required
business_idstring (uuid)required
membership_idstring (uuid)required
state"active" | "revoked" | "expired"required
valid_fromstring (date-time)required
valid_untilstring (date-time) | nullrequired
screening_idstringrequired
card_idstring (uuid) | nullrequired
ends_atstring (date-time) | nullrequired
ended_atstring (date-time) | nullrequired
end_reasonone ofrequired
+ show properties

One of

Option 1

{
  "type": "string",
  "enum": [
    "revoked",
    "expired",
    "membership_removed",
    "business_closed"
  ]
}

Option 2

{
  "type": "null"
}

Option 3

{
  "type": "null"
}
created_atstring (date-time)required
400

Validation error

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring
401

Authentication required

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring
403

The acting person is not permitted; admin_kyc_not_complete

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring
404

Business or grant not found, or the business routes are not released

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring
409

Idempotency-Key reused with a different payload; grant_not_active; revoke_already_scheduled; revoke_after_grant_end; business_closed

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring
500

Internal server error

typestringrequired
titlestringrequired
statusintegerrequired
detailstring
instancestring