> For the complete documentation index, see [llms.txt](https://docs.brahma.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brahma.fi/developer/console-cards-for-integrators-and-vendors.md).

# Console Cards for Integrators and Vendors

## Getting Started

#### Prerequisites

* Grant dashboard access to `eng@brahma.fi` for Rain and Sumsub platforms with developer-level privileges. This access excludes sensitive user data but enables webhook configuration management and case-specific debugging capabilities.
* Share Rain and Sumsub API key via email to `eng@brahma.fi`&#x20;

Once done, please get in touch with the team to get the following details

For Integrators who wish to offer their cards to users, make sure you have the following

* Tenant ID
* API Key
* Solver Configuration
* Cards Delegation Address

### Service Endpoints

`PROD` : `https://api.console.fi`

`DEV` : `https://dev.console.fi`

***

## User Onboarding Flow

1. Logging in a user
2. Initiating their KYC
3. Checking KYC Status
4. Creating a card if KYC approved
5. Delegating user DeFi position

##

## Onboarding New User

### Logging In

Start by requesting an EIP712 signature from the user. Use that signature to call the login endpoint along with `tenantId`  . This should provide you with an `accessToken` and `refreshToken` .

```
{
    EIP712Domain: [
        { name: "name", type: "string" },
        { name: "version", type: "string" },
      ],
      Login: [
        { name: "timestamp", type: "uint256" },
        { name: "tenantID", type: "string" },
      ],
    },
    primaryType: "Login",
    domain: {
      name: "BrahmaCards",
      version: "1",
    },
    message: {
      timestamp,
      tenantID,
    },
}
```

## Login with cryptographic signature

> Authenticates a user using a cryptographic signature and returns JWT access and refresh tokens

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"paths":{"/auth/sig/login":{"post":{"description":"Authenticates a user using a cryptographic signature and returns JWT access and refresh tokens","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Authentication successful with tokens","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.StandardToken"}},"type":"object"}]}}}},"400":{"description":"Invalid signature format or malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Authentication failed - invalid signature or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Login with cryptographic signature","tags":["authentication"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/entity.VerifySigPayload"}}},"description":"Signature verification payload","required":true}}}},"components":{"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.StandardToken":{"properties":{"accessToken":{"type":"string"},"expiresIn":{"type":"integer"},"refreshToken":{"type":"string"},"tokenType":{"type":"string"}},"type":"object"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"entity.VerifySigPayload":{"description":"Request payload for user authentication via signature verification","properties":{"eoa":{"type":"string"},"sig":{"type":"string"},"timestamp":{"type":"integer"},"version":{"type":"string"}},"type":"object"}}}}
```

This API is called when `accessToken` expires. This can be called with expired `accessToken` and `refreshToken` to generate new keys without requesting user login signature again. If this doesnt work then both are expires and we need to go back to logging in user via fresh 712 signature

## Refresh JWT tokens

> Refreshes expired access tokens using a valid refresh token and returns new JWT tokens

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"paths":{"/auth/token/refresh":{"post":{"description":"Refreshes expired access tokens using a valid refresh token and returns new JWT tokens","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Tokens refreshed successfully","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.StandardToken"}},"type":"object"}]}}}},"400":{"description":"Invalid token format or malformed request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Invalid or expired refresh token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Refresh JWT tokens","tags":["authentication"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/entity.StandardToken"}}},"description":"Refresh token payload","required":true}}}},"components":{"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.StandardToken":{"properties":{"accessToken":{"type":"string"},"expiresIn":{"type":"integer"},"refreshToken":{"type":"string"},"tokenType":{"type":"string"}},"type":"object"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"}}}}
```

***

> **Please note that after login, every API call should contain `Authorization` Header with`Bearer <accessToken>` as the value**

***

### Checking User Status

Once the JWT is generated, we can start by fetching the user's status. Calling this endpoint will provide us with user's `kycStatus` and `rainStatus`

## Get user KYC status

> Retrieves the Rain KYC status of the authenticated user

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.UserKycAndRainStatus":{"description":"Response structure containing user KYC status and Rain card provider status","properties":{"errorDetails":{"type":"string"},"kycStatus":{"allOf":[{"$ref":"#/components/schemas/entity.ApplicantStatus"}]},"rainStatus":{"allOf":[{"$ref":"#/components/schemas/entity.RainAccountStatus"}]}},"type":"object"},"entity.ApplicantStatus":{"enum":["requested","approved","rejected","resubmitted","onhold","pending"],"type":"string"},"entity.RainAccountStatus":{"enum":["initiated","pending","approved","review","rejected"],"type":"string"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"}}},"paths":{"/users/status":{"get":{"description":"Retrieves the Rain KYC status of the authenticated user","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"User KYC status","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.UserKycAndRainStatus"}},"type":"object"}]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Get user KYC status","tags":["kyc"]}}}}
```

Based on KYC status, we can decide wether to start KYC for user / let the user know they are pending approval / let them know they are rejected or they are approved and proceed with card creation

| kycStatus      | rainStatus | Action                       |
| -------------- | ---------- | ---------------------------- |
| not\_requested | \*         | Start KYC Modal              |
| requested      | \*         | Start KYC Modal              |
| rejected       | \*         | Show Rejected screen         |
| resubmit       | \*         | Raise issue with Brahma team |
| onhold         | \*         | Raise issue with Brahma team |
| pending        | \*         | Show Pending Screen          |
| \*             | review     | Show Pending Screen          |
| \*             | pending    | Show Pending Screen          |
| \*             | initiated  | Show Pending Screen          |
| \*             | approved   | Proceed with card creation   |

### Creating New User

If user's `kycStatus` is `not_requested` or `requested` then we should initiate their KYC.

We need to create a new sumsub access token for the user by passing ownerAddress as connected wallet EOA of the user. This should return `token` and `userId`

## Create SumSub access token

> Generates a SumSub access token for a given owner address

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"paths":{"/sumsub/token":{"post":{"description":"Generates a SumSub access token for a given owner address","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Success response with access token","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.SumSubAccessTokenResponse"}},"type":"object"}]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Create SumSub access token","tags":["kyc"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1.sumSubAccessTokenRequest"}}},"description":"Request body with owner address","required":true}}}},"components":{"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.SumSubAccessTokenResponse":{"description":"Response structure containing SumSub access token and user ID","properties":{"token":{"type":"string"},"userId":{"type":"string"}},"type":"object"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"v1.sumSubAccessTokenRequest":{"description":"Request structure for generating SumSub KYC access token","properties":{"ownerAddress":{"type":"string"}},"type":"object"}}}}
```

We use both `token` and `userId` to initialize SumsubWebSDK on frontend

REF: <https://docs.sumsub.com/docs/get-started-with-web-sdk#set-up-frontend-integration>

Once the user completes their KYC flow, fetching the KYC status again would show `kycStatus` as `pending` . If documents are submitted correctly,  user's `rainStatus` should turn to `approved` in a few minutes, so user can be asked to check back again later.

### Creating a Card for approved user

Once `rainStatus` shows as approved in KYC status endpoint, we can proceed with creating card.

Notice here while creating card, you need to provide `chainId` {ex 999 for hyperevm, 8541 for base..etc}

`hookConfig` and `hookType` are optional and can be left as `{}` and `""` empty respectively

`cardSolverConfig` , `solverType` should be provided to you by brahma team

`creditProviderAddress` is user's wallet address also known as their EOA

Once executed, you should be able to receive their card details including last 4 digits, expiry and an `id` which is a unique identifier for their card.

> Note: Sensitive card details including full 16 digit card number and CVV are only available in encrypted format via dedicated endpoint. For ease of integration, they will be available in brahma's swype SDK&#x20;

## Create a new card for user

> Creates a card for a user and assigns a credit provider.

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.CardResponse":{"description":"Response structure containing card information","properties":{"expirationMonth":{"type":"string"},"expirationYear":{"type":"string"},"id":{"type":"string"},"last4":{"type":"string"},"limit":{"$ref":"#/components/schemas/entity.Limit"},"status":{"type":"string"},"type":{"type":"string"},"userId":{"type":"string"}},"type":"object"},"entity.Limit":{"properties":{"amount":{"type":"integer"},"frequency":{"$ref":"#/components/schemas/entity.CardFrequency"}},"type":"object"},"entity.CardFrequency":{"enum":["per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime","perAuthorization"],"type":"string"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"v1.createCardWithCreditProviderReq":{"description":"Request structure for creating a card with credit provider assignment","properties":{"cardSolverConfig":{"type":"object"},"chainID":{"type":"integer"},"creditProviderAddress":{"type":"string"},"hookConfig":{"type":"object"},"hookType":{"allOf":[{"$ref":"#/components/schemas/entity.HookKind"}],"description":"Optional hook configuration"},"solverType":{"allOf":[{"$ref":"#/components/schemas/entity.SolverType"}]}},"type":"object"},"entity.HookKind":{"enum":["swap"],"type":"string"},"entity.SolverType":{"enum":["aave-v3","euler","hypurrFi","hypurrFi-withdraw","felix-withdraw","hyperBeat-withdraw","hyperLend-withdraw"],"type":"string"}}},"paths":{"/create":{"post":{"description":"Creates a card for a user and assigns a credit provider.","parameters":[{"schema":{"type":"string"},"description":"Optional card type","in":"query","name":"card_type"},{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Card successfully created","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.CardResponse"}},"type":"object"}]}}}},"400":{"description":"Invalid request or input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Create a new card for user","tags":["Cards"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1.createCardWithCreditProviderReq"}}},"description":"Credit Provider Assignment","required":true}}}}}
```

Once a user has a card created, we can call the GET endpoint to fetch their card details. This can also be called when the user logs in to quickly identify if they are an existing card holder.

Note that this endpoint will rely on JWT token as well as Partner ID and API key to identify user and their card details if any

## Get user's cards with configurations

> Retrieves all cards owned by the authenticated user along with their solver and hook configurations

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.CardWithSolverAndHook":{"description":"Complete card information including solver and hook configurations","properties":{"cardID":{"type":"string"},"chainID":{"type":"integer"},"expirationMonth":{"type":"string"},"expirationYear":{"type":"string"},"hookChainID":{"type":"integer"},"hookConfig":{"type":"object"},"hookType":{"allOf":[{"$ref":"#/components/schemas/entity.HookKind"}]},"last4":{"type":"string"},"solverConfig":{"type":"object"},"solverCreditProviderAddress":{"type":"string"},"solverType":{"allOf":[{"$ref":"#/components/schemas/entity.SolverType"}]},"status":{"type":"string"},"type":{"type":"string"}},"type":"object"},"entity.HookKind":{"enum":["swap"],"type":"string"},"entity.SolverType":{"enum":["aave-v3","euler","hypurrFi","hypurrFi-withdraw","felix-withdraw","hyperBeat-withdraw","hyperLend-withdraw"],"type":"string"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"}}},"paths":{"/":{"get":{"description":"Retrieves all cards owned by the authenticated user along with their solver and hook configurations","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"List of user cards with configurations","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"items":{"$ref":"#/components/schemas/entity.CardWithSolverAndHook"},"type":"array"}},"type":"object"}]}}}},"400":{"description":"Invalid tenant context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"User authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"404":{"description":"No cards found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Get user's cards with configurations","tags":["cards"]}}}}
```

### Integrating Cards SDK for decrypting sensitive card info

Brahma Cards provides a react SDK which can be integrated into client frontend. This exposes methods like `showCardDetails` which will take care of decrypting sensitive card info and let you show the details to user in plaintext \
\
&#x20;[https://www.npmjs.com/package/@brahmafi/cards-sdk](https://www.npmjs.com/package/@brahmafi/cards-sdk?)&#x20;

###

### Delegating User Assets to make them spendable

Now that user has a card, we can let user delegate their defi positions to  the `Cards Delegation Address` provided by team.&#x20;

The integrator frontend can check onchain balances / ask user how much tokens/assets they would like to delegate and let them sign transaction to delegate their assets

Delegation transactions can be as simple as ERC20 token approvals for tokens like aave's aTokens, 4626 vault tokens.

In case of more complex defi positions like lending and borrowing tokens, please contact team to get exact information on supported delegation transactions. Once delegated, user should be able to start spending from their card

###

### Managing a user's card configuration

Console cards exposes endpoints which can be used to set card details like setting spend limits&#x20;

## Update card limits

> Updates spending limits for a specific card (e.g. daily, weekly, monthly).

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"v1.updateCardLimitsReq":{"description":"Request structure for updating card spending limits and frequency","properties":{"cardID":{"type":"string"},"frequency":{"allOf":[{"$ref":"#/components/schemas/entity.CardFrequency"}]},"limit":{"type":"integer"}},"type":"object"},"entity.CardFrequency":{"enum":["per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime","perAuthorization"],"type":"string"}}},"paths":{"/limits":{"patch":{"description":"Updates spending limits for a specific card (e.g. daily, weekly, monthly).","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Card limits updated successfully"},"400":{"description":"Invalid input or invalid card operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Update card limits","tags":["cards"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1.updateCardLimitsReq"}}},"description":"Card Limits Update Request","required":true}}}}}
```

## Update card PIN

> Updates the PIN of a specific card. Requires a valid session ID header.

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"v1.updateCardPinReq":{"description":"Request structure for updating card PIN with encrypted data","properties":{"cardID":{"type":"string"},"pin":{"$ref":"#/components/schemas/entity.EncryptedCardPin"}},"type":"object"},"entity.EncryptedCardPin":{"properties":{"encryptedPin":{"properties":{"data":{"type":"string"},"iv":{"type":"string"}},"type":"object"}},"type":"object"}}},"paths":{"/pin":{"patch":{"description":"Updates the PIN of a specific card. Requires a valid session ID header.","parameters":[{"schema":{"type":"string"},"description":"Session ID","in":"header","name":"sessionID","required":true},{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Card PIN updated successfully"},"400":{"description":"Invalid input, missing sessionID, or invalid card operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Update card PIN","tags":["cards"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1.updateCardPinReq"}}},"description":"Card PIN Update Request","required":true}}}}}
```

## Get card transactions

> Retrieves paginated transactions for a specific card of the authenticated user

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.CursorPaginationResponse":{"properties":{"pagination":{"$ref":"#/components/schemas/entity.CursorPaginationMeta"},"transactions":{"items":{"$ref":"#/components/schemas/entity.TransactionResponse"},"type":"array"}},"type":"object"},"entity.CursorPaginationMeta":{"properties":{"has_next":{"type":"boolean"},"limit":{"type":"integer"},"next_cursor":{"type":"string"}},"type":"object"},"entity.TransactionResponse":{"properties":{"amount":{"type":"integer"},"authorized_at":{"type":"string"},"created_at":{"type":"string"},"currency":{"type":"string"},"declined_reason":{"type":"string"},"flow":{"$ref":"#/components/schemas/entity.TransactionFlow"},"id":{"type":"string"},"local_amount":{"type":"integer"},"local_currency":{"type":"string"},"merchant":{"$ref":"#/components/schemas/entity.MerchantInfo"},"posted_at":{"type":"string"},"status":{"$ref":"#/components/schemas/entity.TransactionStatus"},"type":{"$ref":"#/components/schemas/entity.TransactionType"}},"type":"object"},"entity.TransactionFlow":{"enum":["debit","refund","declined"],"type":"string"},"entity.MerchantInfo":{"properties":{"category":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"icon":{"type":"string"},"name":{"type":"string"}},"type":"object"},"entity.TransactionStatus":{"enum":["requested","pending","declined","reversed","completed","refunded"],"type":"string"},"entity.TransactionType":{"enum":["spend","withdraw","refund"],"type":"string"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"}}},"paths":{"/transactions/{cardID}":{"get":{"description":"Retrieves paginated transactions for a specific card of the authenticated user","parameters":[{"schema":{"type":"string"},"description":"Card ID","in":"path","name":"cardID","required":true},{"schema":{"type":"integer"},"description":"Maximum number of transactions to return","in":"query","name":"limit"},{"schema":{"type":"string"},"description":"Cursor for pagination","in":"query","name":"cursor"},{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Paginated list of transactions","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.CursorPaginationResponse"}},"type":"object"}]}}}},"400":{"description":"Invalid card ID or query parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Get card transactions","tags":["transactions"]}}}}
```

### Generating delegation transaction for user to sign and submit

\
For specific types of solver such as aave, console-cards can build calldata for you. In example below, we are delegating 3 cents from user's spend position.&#x20;

```
{
    "creditType": "hypurrFi-withdraw",
    "creditLimit": 3,
    "chainID": 999,
    "userParams": {
        "aTokenAddress": "0x1Ca7e21B2dAa5Ab2eB9de7cf8f34dCf9c8683007",
        "purchaseBaseTokenAddress": "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb"
    }
}
```

## Get delegation transaction

> Generates a delegation transaction for the authenticated user based on credit limit and type

```json
{"openapi":"3.1.1","info":{"title":"Console Cards","version":"1.0"},"servers":[{"url":"http://api.console.fi/v1/vendor/cards"}],"security":[{"JWTAuth":[]}],"components":{"securitySchemes":{"JWTAuth":{"description":"Bearer token for JWT authentication (format: \"Bearer {token}\")","in":"header","name":"Authorization","type":"apiKey"}},"schemas":{"v1.DataResponse":{"properties":{"data":{}},"type":"object"},"entity.EncodedTransaction":{"properties":{"callData":{"type":"string"},"chainID":{"type":"integer"},"from":{"type":"string"},"operation":{"type":"integer"},"simulationSuccessful":{"type":"boolean"},"to":{"type":"string"},"value":{"type":"string"}},"type":"object"},"utils.ErrorResponse":{"properties":{"data":{"properties":{"error":{"type":"string"}},"type":"object"}},"type":"object"},"v1.getDelegationTransactionReq":{"description":"Request structure for generating delegation transaction data","properties":{"chainID":{"type":"integer"},"creditLimit":{"type":"integer"},"creditType":{"allOf":[{"$ref":"#/components/schemas/entity.SolverType"}]},"userParams":{"type":"object"}},"type":"object"},"entity.SolverType":{"enum":["aave-v3","euler","hypurrFi","hypurrFi-withdraw","felix-withdraw","hyperBeat-withdraw","hyperLend-withdraw"],"type":"string"}}},"paths":{"/users/credit/delegate":{"post":{"description":"Generates a delegation transaction for the authenticated user based on credit limit and type","parameters":[{"schema":{"type":"string"},"description":"Partner identifier","in":"header","name":"X-Partner-ID","required":true},{"schema":{"type":"string"},"description":"API Key for authentication","in":"header","name":"X-API-Key","required":true}],"responses":{"200":{"description":"Delegation transaction details","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/v1.DataResponse"},{"properties":{"data":{"$ref":"#/components/schemas/entity.EncodedTransaction"}},"type":"object"}]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResponse"}}}}},"summary":"Get delegation transaction","tags":["credit"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1.getDelegationTransactionReq"}}},"description":"Delegation transaction request","required":true}}}}}
```
