getBalance

Returns the lamport balance of the account of provided Pubkey.

https://api.1inch.com/web3/501
Supported on:
Solana

Parameters

Pubkey (required)

Pubkey
* string

Configuration

Configuration
object
commitment
string (Enum)
processed
confirmed
finalized
minContextSlot
integer
additionalProperties
none

Request

Request
object
jsonrpc
* string (Enum)
2.0
method
* string
params
array
items
any
oneOf[0]
string
oneOf[1]
object
commitment
string (Enum)
processed
confirmed
finalized
minContextSlot
integer
additionalProperties
none
id
* number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const response = await fetch('https://api.1inch.com/web3/501', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${API_KEY}`,
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'getBalance',
    params: [
      'string',
      {
        commitment: 'processed',
        minContextSlot: 0,
      },
    ],
    id: 1,
  }),
});

const data = await response.json();
console.log(data);

Response

Balance Response

Balance Response
object
context
* object
slot
* integer
apiVersion
string
additionalProperties
none
value
* integer
additionalProperties
none
JSON
1
2
3
4
5
6
7
{
  "context": {
    "slot": 1
  },
  "value": 0
}

Did you find what you need?