API Documentation

REST API documentation, help articles, and FAQs for IRC4Fun

Home / Help / API Documentation

Overview

The IRC4Fun API provides programmatic access to IRC network data, account management, and WebServ integration. All endpoints return JSON responses and follow REST conventions.

Base URL: https://irc4fun.net/api/

Authentication

Endpoints are organised into three security tiers. Public endpoints need no authentication. Token and staff endpoints require an API token sent via the Authorization header:

Header
Authorization: Token your-token-here

Obtaining a Token

  1. Go to Account SettingsAPI Tokens.
  2. Create a new token. Copy the full token immediately — it is shown only once.
  3. Your token starts with zero endpoint access. An administrator must grant your token permission to specific endpoints via the admin panel.

Even after a token is created, each individual endpoint must be approved before the token can use it. This ensures administrators retain full control over what every integration can access.

Security Tiers

Tier Auth Required Description
PUBLIC None General network info — channels, servers, commands, stats
TOKEN API token + admin approval Sensitive data — user lists, opers, credential checks

Public Endpoints

No authentication required. Available to everyone.

MethodEndpointDescription
GET /api/irc/stats/ Network statistics (users, channels, opers online)
GET /api/irc/latency/ Server latency measurements
GET /api/irc/channels/ List all visible channels
GET /api/irc/channels/{name}/ Details for a specific channel
GET /api/irc/servers/ List linked servers
GET /api/irc/servers/{name}/ Details for a specific server
GET /api/irc/commands/ Available IRC service commands

Token-Required Endpoints

Require a valid API token with the endpoint explicitly enabled by an administrator. These expose sensitive information such as user hostmasks, IP addresses, and operator identities.

MethodEndpointDescription
GET /api/irc/opers/ List IRC operators
GET /api/irc/opers/{name}/ Details for a specific operator
GET /api/irc/users/ List connected users (includes hostmasks)
GET /api/irc/users/{nick}/ Details for a specific user
POST /api/irc/check-credentials/ Verify NickServ password for a nick

NetStats Endpoints

NetStats exposes public JSON endpoints used by the website, and a token-protected API surface for external integrations.

Public (website)

No authentication required. These are used by the /network/* pages.

MethodEndpointDescription
GET /network/netstats/api/index.json Machine-readable NetStats endpoint index
GET /network/data/status/ Network snapshot + top users/channels today + recent history
GET /network/data/channel/{channel}/ Channel profile payload (URL-encode # as %23)
GET /network/data/user/{nick}/ User profile payload
GET /network/data/countries/ Country distribution
GET /network/data/clients/ IRC client distribution
GET /network/data/history/ Recent network history points
GET /network/data/operators/ IRC operators (from services)
GET /network/data/servers/ Linked servers (from services)

Token-protected (external integrations)

Requires Authorization: Token <your-token> and admin-approved endpoint access.

MethodEndpointDescription
GET /api/netstats/ NetStats API index (token)
GET /api/netstats/status/ Network snapshot + leaderboards + recent history (token)
GET /api/netstats/channel/{channel}/ Channel profile payload (token)
GET /api/netstats/user/{nick}/ User profile payload (token)
GET /api/netstats/countries/ Country distribution (token)
GET /api/netstats/clients/ IRC client distribution (token)
GET /api/netstats/history/ Recent network history points (token)
GET /api/netstats/operators/ IRC operators (token)
GET /api/netstats/servers/ Linked servers (token)

check-credentials Request Body

JSON
{ "nick": "ExampleUser", "password": "secret" }

Usage Examples

Fetch Network Stats (no auth)

Terminal
# curl $ curl https://irc4fun.net/api/irc/stats/ # Python import requests r = requests.get("https://irc4fun.net/api/irc/stats/") print(r.json())

Fetch NetStats Status (token required)

Terminal
# curl $ curl -H "Authorization: Token YOUR_TOKEN" \ https://irc4fun.net/api/netstats/status/ # Python import requests HEADERS = {"Authorization": "Token YOUR_TOKEN"} r = requests.get("https://irc4fun.net/api/netstats/status/", headers=HEADERS) print(r.json())

List Channels (no auth)

Terminal
$ curl https://irc4fun.net/api/irc/channels/

List Users (token required)

Terminal
$ curl -H "Authorization: Token YOUR_TOKEN" \ https://irc4fun.net/api/irc/users/

Check Credentials (token required)

Terminal
$ curl -X POST \ -H "Authorization: Token YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"nick": "ExampleUser", "password": "secret"}' \ https://irc4fun.net/api/irc/check-credentials/

Python Bot Example

Python
import requests TOKEN = "your-api-token" BASE = "https://irc4fun.net/api/irc" HEADERS = {"Authorization": f"Token {TOKEN}"} # List online users users = requests.get(f"{BASE}/users/", headers=HEADERS).json() # Get a specific channel chan = requests.get(f"{BASE}/channels/%23general/").json() # Verify credentials result = requests.post( f"{BASE}/check-credentials/", headers=HEADERS, json={"nick": "MyBot", "password": "s3cret"}, ).json()

Rate Limits & Notes

  • All responses are application/json.
  • Channel names containing # must be URL-encoded as %23.
  • Tokens that have been revoked will return 401 Unauthorized.
  • If your token lacks permission for an endpoint, you will receive 403 Forbidden.
  • Tokens can be created from your Account Settings page. An administrator must then approve endpoint access.

Frequently Asked Questions

All Help Categories