Skip to main content
POST
Apply template

POST /cards/apply

Activate a blank card or reconfigure an eligible existing card. Send Authorization: Bearer YOUR_API_KEY and X-Device-ID: YOUR_DEVICE_ID. Also send X-Employee-Token: YOUR_EMPLOYEE_TOKEN. See authentication. A blank card can receive its first template. An existing card must be activated and fully used before normal reconfiguration. To replace a freshly issued card, set cancelPrevious: true. This is rejected for blank cards, cards already used (422 CANNOT_CANCEL_USED_CARD), or cards already billed (422 CARD_ALREADY_BILLED). An unfinished card without cancellation returns 422 CARD_NOT_FINISHED. See card lifecycle. For coupon templates, isAmountSpecified: true uses the fixed template amount. When false, supply a positive amount in cents. Supplying a nonpositive amount returns 400. customer is optional. When supplied, it must use the nested customer format and satisfy the account’s mandatory fields. testCard defaults to false. Test issuance is subject to test-window and count limits. Activation can generate a billing event.

Example request

Example response

Authorizations

Authorization
string
header
required

Location API key. Also requires X-Device-ID.

X-Employee-Token
string
header
required

Employee session token from /employee/login.

Headers

X-Device-ID
string
required

Stable device identifier. API key binds to this value on first use.

Body

application/json
cardId
string
required
templateId
string
required

MongoDB object id.

Pattern: ^[a-fA-F0-9]{24}$
amount
integer

Positive coupon amount in cents. Required for variable-value coupon templates.

Required range: x >= 1
testCard
boolean

Request a test card, subject to the account test period and card limit.

customer
object
cancelPrevious
boolean

Response

Success

success
boolean
message
string