Viewing sensitive details
Card responses do not include full card numbers (pan) or security codes (cvv) by default. To retrieve these fields, follow the reveal-session process below.
Access must be enabled by Flex for the organizations your integration accesses. Your API key must also have both cards:read and cards:reveal permissions for those organizations.
1. Create a reveal session
Call Create a reveal session using your API key and a unique idempotencyKey. Save the returned session details. Keep the same idempotency key if you need to retry this creation request.
const apiKey = '<YOUR_API_KEY>';
const idempotencyKey = crypto.randomUUID();
const response = await fetch('https://api.flex.one/reveal-sessions', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ idempotencyKey }),
});
if (!response.ok) {
throw new Error(`Could not create a reveal session: HTTP ${response.status}`);
}
const revealSession = await response.json();
if (!revealSession.token) {
throw new Error(
'This is a replay. Use the original token or create a new session with a new idempotency key.',
);
}
The response includes token, revealBaseUrl, organizationIds, and expiresAt. Confirm that your intended organization is included in organizationIds.
The token is returned only when the session is first created. A successful retry with the same idempotency key returns the session metadata without the token. If you no longer have the original token, create a new session with a new idempotency key. See Idempotency for retry guidance.
2. Request the card details
Append /cards or /cards/{cardId} to the returned revealBaseUrl, then authenticate the request with the returned token in the Authorization: Bearer … header.
These are the same List cards and Get card operations, with the same parameters and response shapes. Through the reveal URL, each card can additionally include pan and cvv when those values are available. List responses still contain data and metadata; get responses return the card directly.
Both fields are optional. Physical-card details are not currently available through this flow. A virtual card must have been activated, must not be closed, and must have the requested sensitive values available. Treat pan and cvv as strings, including any leading zeros.
The following examples reuse revealSession from step 1. Use the same API version as your ordinary card requests.
Reveal a list of cards
const cardsUrl = new URL(`${revealSession.revealBaseUrl}/cards`);
cardsUrl.searchParams.set('organizationIds', '<ORGANIZATION_ID>');
cardsUrl.searchParams.set('pageSize', '100');
const cardsResponse = await fetch(cardsUrl, {
headers: {
Authorization: `Bearer ${revealSession.token}`,
'flex-version': '2026-10-23',
},
});
if (!cardsResponse.ok) {
throw new Error(`Could not read cards: HTTP ${cardsResponse.status}`);
}
const cardsPage = await cardsResponse.json();
See Pagination & filtering for retrieving subsequent pages and List cards for supported filters.
Reveal one card
const cardId = '<CARD_ID>';
const cardUrl = `${revealSession.revealBaseUrl}/cards/${cardId}`;
const cardResponse = await fetch(cardUrl, {
headers: {
Authorization: `Bearer ${revealSession.token}`,
'flex-version': '2026-10-23',
},
});
if (!cardResponse.ok) {
throw new Error(`Could not read the card: HTTP ${cardResponse.status}`);
}
const card = await cardResponse.json();
3. Create another session when needed
You can reuse the reveal token until expiresAt. Sessions last five minutes. Create another session with a new idempotency key when it expires. Replaying creation of an expired session returns 409.
Handle credentials and sensitive data
Send your API key only to the API host and the reveal token only to the returned reveal URL. The reveal URL shown in the API example, https://example.secure.url.flex.one, is illustrative; always use the revealBaseUrl returned by your request.
Keep credentials, full card numbers, and security codes out of logs. See Errors for handling unsuccessful requests.