Skip to main content

GetPeers

Retrieves a list of known peers with optional filtering.

Request

GET /nxt?requestType=getPeers

All endpoints use port 22024 by default.

Parameters

NameTypeDescriptionRequired
activebooleanOnly return active (non-NON_CONNECTED) peers (default: false)No
statestringFilter by peer state: CONNECTED, NON_CONNECTED, DISCONNECTED, CONNECTINGNo
servicestringFilter by service (repeatable: BLOCKS, TRANSACTIONS, etc.)No
includePeerInfobooleanInclude full peer info objects instead of just host strings (default: false)No
versionstringFilter by version prefixNo
includeNewerbooleanInclude newer versions than specified (default: false)No
connectbooleanAttempt to connect to all returned peers (default: false)No
adminPasswordstringAdmin password (required if connect=true)No

Response

{
"peers": [
{
"address": "192.168.1.100",
"port": 22025,
"state": 1,
"announcedAddress": "192.168.1.100:22025",
"shareAddress": true,
"downloadedVolume": 1024000,
"uploadedVolume": 512000,
"application": "Shamwari",
"version": "1.0.0",
"platform": "Linux",
"apiPort": 22024,
"apiSSLPort": 0,
"blacklisted": false,
"lastUpdated": 1700000000,
"lastConnectAttempt": 1700000000,
"inbound": false,
"services": ["BLOCKS", "TRANSACTIONS"],
"blockchainState": "UP_TO_DATE"
}
],
"errorCode": 0,
"errorDescription": ""
}

Example

curl "http://localhost:22024/nxt?requestType=getPeers&active=true&includePeerInfo=true&service=BLOCKS"