Aller au contenu
👋

CNRV API

Ce contenu n’est pas encore disponible dans votre langue.

api

Introduction

The CNRV server provides two types of APIs:

  1. Official CnR V API - A web API for getting server status and player information
  2. FiveM Server API - Direct server endpoints for detailed server information

Official CnR V API

The official API provides server status and player information through web endpoints.

Server Status

Get All Servers Status

Terminal window
curl https://api.gtacnr.net/cnr/servers

Response:

[
{
"Id": "EU2",
"Players": 34,
"MaxPlayers": 100,
"QueuedPlayers": 0,
"LastHeartbeatDateTime": "2025-03-24T17:05:12.1049978Z"
},
{
"Id": "US1",
"Players": 91,
"MaxPlayers": 100,
"QueuedPlayers": 0,
"LastHeartbeatDateTime": "2025-03-24T17:05:06.7868125Z"
},
{
"Id": "US2",
"Players": 24,
"MaxPlayers": 100,
"QueuedPlayers": 0,
"LastHeartbeatDateTime": "2025-03-24T17:05:09.8976388Z"
},
{
"Id": "EU1",
"Players": 99,
"MaxPlayers": 100,
"QueuedPlayers": 0,
"LastHeartbeatDateTime": "2025-03-24T17:05:06.5222571Z"
}
]

Example Usage

Get Total Players Across All Servers

Terminal window
curl https://api.gtacnr.net/cnr/servers | jq '[.[].Players] | add'

Response:

248

Find Least Populated Server

Terminal window
curl https://api.gtacnr.net/cnr/servers | jq 'min_by(.Players) | {Id, Players}'

Response:

{
"Id": "US2",
"Players": 24
}

Check Server Status

Terminal window
curl https://api.gtacnr.net/cnr/servers | jq '.[] | select(.Id == "EU1") | {Id, Players, MaxPlayers, IsFull: (.Players >= .MaxPlayers)}'

Response:

{
"Id": "EU1",
"Players": 99,
"MaxPlayers": 100,
"IsFull": false
}

Player Information

Get Players for a Specific Server

Terminal window
curl https://api.gtacnr.net/cnr/players?serverId=EU1

Response:

[
{
"Uid": "072D51B8FA964658AE9BBCA0B7766FA9",
"Username": {
"Username": "[CBÚP] Baldy",
"Timestamp": "2025-03-23T21:39:10.9279399+00:00"
}
},
{
"Uid": "usr-9E7353VT1USbrY8wy-d-Mg",
"Username": {
"Username": "[CBÚP] KETTAMA",
"Timestamp": "2025-03-24T14:55:53.7320299+00:00"
}
}
]

Example Usage

Get Player Count for a Specific Server

Terminal window
curl https://api.gtacnr.net/cnr/players?serverId=EU1 | jq '. | length'

Response:

2

Find Players by Username Pattern

Terminal window
curl https://api.gtacnr.net/cnr/players?serverId=EU1 | jq '.[] | select(.Username.Username | contains("CBÚP")) | .Username.Username'

Response:

"[CBÚP] Baldy"
"[CBÚP] KETTAMA"

Get Most Recent Player Join

Terminal window
curl https://api.gtacnr.net/cnr/players?serverId=EU1 | jq 'max_by(.Username.Timestamp) | {Username: .Username.Username, JoinTime: .Username.Timestamp}'

Response:

{
"Username": "[CBÚP] KETTAMA",
"JoinTime": "2025-03-24T14:55:53.7320299+00:00"
}

FiveM Server API

The FiveM server also exposes direct endpoints that provide detailed server information:

  • https://eu.gtacnr.net:30121/info.json - Server information and configuration
  • https://eu.gtacnr.net:30121/players.json - List of currently connected players

Server Information API

The /info.json endpoint provides detailed information about the server configuration, including:

  • Server version and build
  • Server rules and configuration
  • Available resources
  • In-game time
  • Server variables

Example Usage

Get Server Time

Terminal window
curl -v https://eu.gtacnr.net:30121/info.json -k | jq '.vars.Time'

Response:

"Friday 16:22"

Get Server Name

Terminal window
curl -v https://eu.gtacnr.net:30121/info.json -k | jq '.vars.sv_projectName'

Response:

"^4Cops and Robbers V EU #2 HARDCORE"

Get Server Description

Terminal window
curl -v https://eu.gtacnr.net:30121/info.json -k | jq '.vars.sv_projectDesc'

Response:

"Hardcore CnR V Gameplay ● 20% Bonus Money ● No Name Tags ● No Radar Blips ● Reduced Health and Armor ● Longer Healing Times"

Players API

The /players.json endpoint provides information about currently connected players, including:

  • Player names (these are usernames configured in FiveM, not the CnR V character name)
  • Player IDs
  • Ping values

Example Usage

Get List of Connected Players

Terminal window
curl -v https://eu.gtacnr.net:30121/players.json -k | jq

Response:

[
{
"endpoint": "127.0.0.1",
"id": 130,
"identifiers": [],
"name": "xBytez",
"ping": 42
},
{
"endpoint": "127.0.0.1",
"id": 128,
"identifiers": [],
"name": "Mihaaawk",
"ping": 69
}
]

Count Number of Players

Terminal window
curl -v https://eu.gtacnr.net:30121/players.json -k | jq '. | length'

Response:

2

Get Player Names Only

Terminal window
curl -v https://eu.gtacnr.net:30121/players.json -k | jq '.[].name'

Response:

"xBytez"
"Mihaaawk"