Skip to main content

REST API Overview

Programmatic management interface for AthenaBNG.

Overview

The REST API provides a FastAPI-based HTTP interface for managing AthenaBNG. It runs on HTTPS port 8443 by default and requires JWT authentication for all endpoints except /api/v1/health and /metrics.

Base URL

https://<bng-host>:8443/api/v1

Interactive Documentation

FastAPI auto-generates interactive docs from the endpoint docstrings:

  • Swagger UIhttps://<bng-host>:8443/api/docs
  • ReDochttps://<bng-host>:8443/api/redoc
  • OpenAPI JSONhttps://<bng-host>:8443/api/openapi.json

Endpoint Groups

Subscribers

MethodPathDescription
GET/api/v1/subscribersList active sessions (filter with ?type=pppoe or ?type=dhcp)
GET/api/v1/subscribers/summarySession counts by type
GET/api/v1/subscribers/{id}Detailed session information
DELETE/api/v1/subscribers/{id}Disconnect a session
PUT/api/v1/subscribers/{id}/rateChange session rate (CAKE QoS)
POST/api/v1/subscribers/disconnect-by-interfaceDisconnect all sessions on an interface

System & Configuration

MethodPathAuthDescription
GET/api/v1/system/versionanyVersion information
GET/api/v1/system/healthanyUptime, session count
GET/api/v1/system/configanyRunning config (secrets redacted)
POST/api/v1/system/config/setadminSet a candidate config value
POST/api/v1/system/config/deleteadminDelete a candidate config key
POST/api/v1/system/config/commitadminCommit candidate to running
POST/api/v1/system/config/rollbackadminLoad archived config as candidate
POST/api/v1/system/config/discardadminDiscard candidate changes
GET/api/v1/system/config/compareanyDiff running vs candidate

Interfaces

MethodPathDescription
GET/api/v1/interfacesAll network interfaces
GET/api/v1/interfaces/vlansDynamic VLAN sub-interfaces

QoS

MethodPathDescription
GET/api/v1/qosSessions with CAKE QoS applied
GET/api/v1/qos/profilesAvailable overhead profiles

Routing

MethodPathDescription
GET/api/v1/routing/bgp/summaryBGP neighbor summary from FRRouting
GET/api/v1/routing/routesKernel routing table

CGNAT

MethodPathDescription
GET/api/v1/cgnat/sessionsSessions using CGNAT addresses
GET/api/v1/cgnat/statsCGNAT vs public IP counts

Demux

MethodPathDescription
GET/api/v1/demux/configDemux configuration
GET/api/v1/demux/stateActive dynamic VLAN interfaces

Events & Webhooks

MethodPathDescription
GET/api/v1/events/subscribersSSE stream of session events
GET/api/v1/webhooksList registered webhooks
POST/api/v1/webhooksRegister a webhook (admin)
DELETE/api/v1/webhooks/{id}Delete a webhook (admin)

Monitoring

MethodPathDescription
GET/metricsPrometheus metrics (no auth)
GET/api/v1/healthHealth check (no auth)

Response Format

All responses follow a standard envelope:

{
"status": "ok",
"data": { ... }
}

Error responses:

{
"status": "error",
"message": "description of what went wrong"
}

Authentication

All endpoints except /api/v1/health and /metrics require a JWT bearer token:

# Obtain token
TOKEN=$(curl -sk -X POST https://localhost:8443/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"changeme"}' \
| jq -r '.access_token')

# Use token
curl -sk -H "Authorization: Bearer $TOKEN" \
https://localhost:8443/api/v1/subscribers

Configuration

api:
enabled: true
listen: "0.0.0.0"
port: 8443
tls_cert: "/opt/athena-bng/etc/cert.pem"
tls_key: "/opt/athena-bng/etc/key.pem"

Next Steps

  • Authentication — JWT authentication details
  • Endpoints — Full endpoint reference with request/response examples
  • Webhooks — Event webhook registration and delivery