> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bringin.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Top-up Debit Card

> Deposit USDC/BTC, convert to EUR, spend on debit card

This is the fastest way to let your users spend funds from your wallet in the real world with minimal integration effort.

Bringin issues and manages non-branded black debit cards. Once integrated, you can fund these cards directly from your platform using the APIs below. Your users deposit crypto (USDC on Polygon), it's converted to EUR, and the balance is available on their Bringin debit card to spend anywhere or withdraw to their bank.

<Info>Your users will need to install the [Bringin app](https://bringin.xyz) to manage their card lifecycle, set spending limits, and view transactions.</Info>

## 1. Get User ID

This API returns the `userId`, which you'll need for some admin operations.

```bash theme={null}
GET /api/v0/user/user-id
```

```json Response theme={null}
{
  "userId": "34c3b5a7-ae2d-4390-9f46-2c4e246149cf"
}
```

## 2. Get Rates

Returns the latest market rate. When creating an order, use the latest rate. We account for minor slippage and slight delays. The rate includes the fee from Bringin plus any additional markup you wish to add.

```bash theme={null}
POST /api/v0/offramp/rates
```

```json Request theme={null}
{
  "ticker": "USDCEUR"
}
```

```json Response theme={null}
{
  "ticker": "USDCEUR",
  "price": "0.91",
  "bringinPrice": "0.9018",
  "currency": "EUR",
  "timestamp": 1742911487157
}
```

| Field          | Description                                      |
| -------------- | ------------------------------------------------ |
| `price`        | Market rate                                      |
| `bringinPrice` | The price at which the swap happens (after fees) |

<Note>We currently support `USDCEUR` and `BTCEUR`. More pairs coming soon.</Note>

## 3. Get Deposit Address

Creates an offramp order and returns a deposit address.

```bash theme={null}
POST /api/v0/offramp/address
```

<Tabs>
  <Tab title="USDC (Polygon)">
    ```json Request theme={null}
    {
      "ipAddress": "212.30.36.15",
      "sourceCurrency": "USDC",
      "sourceBlockchain": "POLYGON"
    }
    ```

    ```json Response theme={null}
    {
      "maximumDepositAmount": "1666667",
      "minimumDepositAmount": "15",
      "address": "0x7D162a2B5e88277F8b51D8548B2BC1a2E89558E7"
    }
    ```

    <Warning>Amounts are in USDC cents (6 decimals). `15` = 0.000015 USDC minimum, `1666667` = 1,666.667 USDC maximum.</Warning>
  </Tab>

  <Tab title="BTC (Lightning)">
    ```json Request theme={null}
    {
      "sourceCurrency": "BTC",
      "sourceBlockchain": "LIGHTNING"
    }
    ```

    ```json Response theme={null}
    {
      "maximumDepositAmount": "500000",
      "minimumDepositAmount": "500",
      "address": "alice@bringin.xyz",
      "blockchain": "LIGHTNING"
    }
    ```

    <Warning>Amounts are in **satoshis**. `500` = 500 sats minimum, `500000` = 500,000 sats maximum.</Warning>
  </Tab>

  <Tab title="BTC (On-chain)">
    ```json Request theme={null}
    {
      "ipAddress": "212.30.36.15",
      "sourceCurrency": "BTC",
      "sourceBlockchain": "BITCOIN"
    }
    ```

    ```json Response theme={null}
    {
      "maximumDepositAmount": "10000000",
      "minimumDepositAmount": "10000",
      "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
    }
    ```
  </Tab>
</Tabs>

The user sends crypto to the returned address. Once received, we swap to EUR at market rate. The EUR balance is then available on their Bringin debit card.

## 4. Check Balance

```bash theme={null}
POST /api/v0/account/get-balance
```

```json Request theme={null}
{
  "currency": "EUR"
}
```

```json Response theme={null}
{
  "balance": "12992"
}
```

<Warning>Balance is in **EUR cents**. `12992` = €129.92</Warning>

## 5. List Transactions

```bash theme={null}
POST /api/v0/account/transactions/
```

```json Request theme={null}
{
  "startDate": 1705587099046,
  "endDate": 1704047400000,
  "limit": "100",
  "offset": "0"
}
```

All fields are optional. Dates are Unix timestamps in milliseconds.

```json Response theme={null}
{
  "transactions": [
    {
      "orderId": "3521154c-30b4-480c-834d-38f80d507963",
      "type": "OFFRAMP_WITHOUT_FIAT_WITHDRAWAL",
      "subType": "ONCHAIN",
      "sourceAmount": "100000",
      "sourceCurrency": "USDC",
      "destinationAmount": "3816",
      "destinationCurrency": "EUR",
      "status": "SUCCESSFUL",
      "createdAt": "2024-01-18T14:02:59.709Z"
    }
  ],
  "number": 1,
  "totalCount": 4
}
```
