// API Reference
Vault
Store a card and receive its vault token.
How card data reaches the vault
In production integrations, card data never transits your servers. It reaches Card Vault through one of the secure capture surfaces:
- Hosted form / card request -- Card Vault-hosted pages; nothing to build.
- Embedded fields -- iframe-isolated inputs inside your checkout (see JS fields).
- Native SDKs -- the SDK encrypts card fields on-device and calls the endpoint below.
POST /v1/vault
The SDK vault endpoint. Card fields arrive encrypted by the SDK's field-level encryption (RSA-OAEP against the account's SDK public key) -- the values below are produced by the SDK's secure fields, not assembled by your code.
REQUESTHTTP
POST /v1/vault Authorization: Bearer <session JWT> Content-Type: application/json { "encryptedPan": "<SDK secure field>", // required "encryptedExpiry": "<SDK secure field>", // required, MM/YY "encryptedCvv": "<SDK secure field>", "encryptedName": "<SDK secure field>", "usageCode": 0, // card usage; see Card usage & lifecycle "usageExpiry": "2027-03-31", // optional authorization window "segmentCode": "PROP-A", // optional; targets a segment "fullName": "Jamie Cardholder", "company": "Acme Stays", "email": "jamie@example.com", "phone": "5555550100", "notes": "Booking #4821" }
Vaulting runs the full validation pipeline: PAN format and Luhn check, and -- when card verification is enabled on your account -- a zero-value network verification before the card is accepted.
RESPONSE200
{
"token": "<vault token>", // store this; see Tokens
"brand": "visa",
"last4": "1111",
"expiry": "12/28"
}
Errors
Errors follow RFC 7807 problem+json with a machine-readable type.
400-- missing required fields, invalid PAN length, invalid expiry, or field decryption failure (wrong SDK key).422 Card Not Accepted(type: https://api.cardvault.dev/errors/card-not-accepted) -- the card's BIN (funding type or brand) is refused by the tenant's Card Policy (account portal, Settings > Card Policy; per-segment overrides apply).detailcarries the tenant's own message. The card is not stored. Unknown BINs follow the policy's unknown-BIN action (default: allow).403 Account Past Due(type: https://api.cardvault.dev/errors/account-past-due) -- your CardVault subscription is 30 or more days past due, so new cards cannot be vaulted. Cards already in the vault keep working (charges, tokens, retrieval). The card is not stored. Update the billing card in the CardVault portal (Billing > Credit Card) to restore vaulting.503 Service Configuration Error-- the account's SDK encryption material is not configured; contact support.
Which token comes back? The vault call returns the long
vault token. To charge the card later you use its short
charge token -- see Tokens for why
the two exist and how to avoid the classic 404.