# getMinimumBalanceForRentExemption

> Returns the minimum lamport balance an account of a given size needs to be rent-exempt.

Source: https://docs.constant-k.com/rpc/http/getminimumbalanceforrentexemption/

`getMinimumBalanceForRentExemption` takes an account data size in bytes and returns the lamport balance needed to be rent-exempt at that size. The runtime rejects creating an account funded below this threshold.

Programs that create accounts, including the System Program's `CreateAccount`, use this (or equivalent local Rent-sysvar math) to size the funding transfer.

- Transport: HTTP, JSON-RPC 2.0 `POST` to `https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY` (New York) or `https://rpc-frankfurt.constant-k.com/?api-key=YOUR_API_KEY` (Frankfurt) or `https://rpc-amsterdam.constant-k.com/?api-key=YOUR_API_KEY` (Amsterdam). The key also works as an `x-api-key` header.
- Category: Accounts
- Availability: All plans
- Rate limits: Free 5/s · Operator 50/s · Blade Runner 200/s · Nexus 500/s

## Parameters

`params` is a positional JSON array, in this order:

- `dataSize` (integer, required, min 0): Account data length, in bytes, to compute the rent-exempt minimum for.
- `config` (object, optional): Commitment configuration.
  - `commitment` (string, optional, one of `finalized`, `confirmed`, `processed`, default `"finalized"`): Bank state to read the current Rent sysvar parameters from.

## Result

- `result` (integer, optional): The minimum rent-exempt balance, in lamports. Unlike most Accounts-category calls, this is a plain integer — it is not wrapped in a context/value envelope.

## Example: Rent exemption for a 165-byte SPL Token account

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getMinimumBalanceForRentExemption",
    "params": [165]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": 1488440,
  "id": 1
}
```

## Example: Rent exemption for a 0-byte account

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getMinimumBalanceForRentExemption",
    "params": [0]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": 650240,
  "id": 1
}
```

## Notes

- 165 bytes is the fixed size of a standard SPL Token account (Token-2022 accounts with extensions are larger and cost more).
- This reflects the current Rent sysvar parameters, not a fixed constant; an account funded at a past minimum keeps that balance and is never retroactively topped up or refunded, so a hard-coded rent-exemption number in client code goes stale.

