# cards

Cards module (feature flag `cards`, D-25/Q-27): virtual and physical cards, lifecycle, PIN, 3DS decisions, card transactions.

## GET /cards

operationId: `listCards`
Summary: List cards
API key scopes: `cards:read`
Callable by: customer keys
Parameters: `X-Tenant-Id` (header, required), `X-Request-Id` (header), `cursor` (query), `limit` (query), `sort` (query), `filter` (query), `q` (query)
Responses: 200 `CardPage`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

Members see only their own cards; owners and admins see every card of the customer. `q` searches the card name and last four digits.

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:read` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## POST /cards

operationId: `createCard`
Summary: Create card
API key scopes: `cards:write`
Callable by: customer keys
Parameters: `X-Tenant-Id` (header, required), `X-Request-Id` (header), `Idempotency-Key` (header, required)
Request body: `CardCreate`
Responses: 201 `Card`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 422 `Problem`, 429 `Problem`, default `Problem`

Issues a virtual (active at once) or physical (pending until activated; `shippingAddress` required) card on the connection holding the spending balance (capability `cards`, else `404 feature-disabled`). Members may create cards for themselves only. A `card_issuance` fee is charged when priced.

**Idempotency:** `Idempotency-Key` is required. Replays within 24 h return the original response with `Idempotency-Replayed: true`.

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:write` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## GET /cards/{cardId}

operationId: `getCard`
Summary: Get card
API key scopes: `cards:read`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-None-Match` (header)
Responses: 200 `Card`, 304, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:read` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## PATCH /cards/{cardId}

operationId: `updateCard`
Summary: Update card (name, balance, limits)
API key scopes: `cards:write`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `If-Match` (header, required)
Request body: `CardUpdate`
Responses: 200 `Card`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 412 `Problem`, 422 `Problem`, 428 `Problem`, 429 `Problem`, default `Problem`

Limits and controls are sent to the card processor (`controlsEnforcement`). Members may change only their own cards and cannot move them to another balance.

**Concurrency:** `If-Match` with the current `ETag` is required (`428` if absent, `412` if stale).

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:write` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## POST /cards/{cardId}/activate

operationId: `activateCard`
Summary: Activate a received physical card
API key scopes: `cards:write`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `Idempotency-Key` (header)
Responses: 200 `Card`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 429 `Problem`, default `Problem`

Only the cardholder; physical cards in `pending`.

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:write` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## POST /cards/{cardId}/freeze

operationId: `freezeCard`
Summary: Freeze card
API key scopes: `cards:write`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `Idempotency-Key` (header)
Responses: 200 `Card`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 429 `Problem`, default `Problem`

Members may act only on their own cards.

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:write` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## GET /cards/{cardId}/transactions

operationId: `listCardTransactions`
Summary: Card transactions
API key scopes: `cards:read`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `cursor` (query), `limit` (query), `sort` (query), `filter` (query)
Responses: 200 `CardTransactionPage`, 400 `Problem`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 429 `Problem`, default `Problem`

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:read` (customer-level keys (`X-Tenant-Id` = the key's customer)).

## POST /cards/{cardId}/unfreeze

operationId: `unfreezeCard`
Summary: Unfreeze card
API key scopes: `cards:write`
Callable by: customer keys
Parameters: `cardId` (path, required), `X-Tenant-Id` (header, required), `X-Request-Id` (header), `Idempotency-Key` (header)
Responses: 200 `Card`, 401 `Problem`, 403 `Problem`, 404 `Problem`, 409 `Problem`, 429 `Problem`, default `Problem`

Members may act only on their own cards. A card frozen by the operator (`frozenBy: operator`) is unfrozen by operator staff only (`409 invalid-transition`).

**Feature flag:** `cards`; returns `404` with problem type `feature-disabled` when the flag is off for the operator.

**API key scopes:** `cards:write` (customer-level keys (`X-Tenant-Id` = the key's customer)).
