# Common Backend Flows

#### Issuance Flow

1. Collect KYC data from your frontend and validate it against your compliance rules.
2. Call `cardClient.createCard(...)` with the validated payload.
3. Store the returned card ID alongside your internal user record.
4. Present the masked card details to the user in your UI.

#### Secure Reveal Flow

1. Authenticate the user on your backend and confirm they own the requested card ID.
2. Call `cardClient.revealCard("card-id")`.
3. Stream the PAN, CVV, and expiry to the frontend over a short-lived secure channel (e.g. an encrypted WebSocket frame or a one-time-use endpoint).
4. Display the credentials in a non-copyable, auto-dismissing overlay.

#### Freeze / Replace Flow

1. Read the current card status from your internal records.
2. If the user requests a temporary hold, call `cardClient.setFreeze("card-id", true)`.
3. If the card is compromised or expired, call `cardClient.replaceCard("card-id", { renewOption })` and update your records with the new card ID.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://city-protocol.gitbook.io/docs/software-development-kit/card/common-backend-flows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
