REST API Reference¶
Ferrous DNS exposes a REST API for managing all aspects of the server. The API is served on the same port as the web dashboard (web_port, default 8080).
Base URL¶
The Ferrous API answers at /ferrous/api/v1 whether or not pihole_compat is on. With pihole_compat = true, the Pi-hole v6 API takes /api.
Versioning¶
The v1 in the base URL is the API's major version.
- Until 1.0.0, v1 can still change while its contract is settled.
- From 1.0.0, v1 only changes in ways existing clients keep working with: new endpoints, new optional request fields or query parameters, and new response fields. Clients should ignore response fields they do not know.
- A breaking change ships as a new major version at
/ferrous/api/v2. v1 keeps answering for at least one minor release after v2 ships.
The Pi-hole v6 API at /api is not versioned by Ferrous DNS: it follows Pi-hole FTL's v6 API. See Pi-hole Compatibility.
Migrating from /api and /ferrous/api¶
Before v0.10.0 the Ferrous API answered at /api, or at /ferrous/api with pihole_compat = true. Both bases are deprecated and will be removed in 2.0. Until then they answer 307 Temporary Redirect to the same route and query under /ferrous/api/v1:
| Old request | Redirected to |
|---|---|
GET /api/queries?limit=50 (Pi-hole compat off) | /ferrous/api/v1/queries?limit=50 |
POST /ferrous/api/blocklist-sources (either mode) | /ferrous/api/v1/blocklist-sources |
A 307 keeps the method and the body, so clients that follow redirects keep working, such as browsers, Python requests and JavaScript fetch. curl follows them only with -L. Update scripts and integrations to the new base anyway. With pihole_compat = true, /api belongs to the Pi-hole API and is never redirected.
Changes in v0.10.0¶
v0.10.0 settles the v1 contract. Besides the new base above, these responses changed:
GET /healthis public and answers JSON. It used to need a login when authentication was on and answered a plainOK. It now answers{"status": "ok", "version": "…"}, or503with"status": "unavailable"while the DNS listener is down. See Health Check.- Config saves that fail answer an error status.
POST /config,POST /settingsandPOST /config/reloadused to answer200withsuccess: falsewhen a valid request could not be carried out. They now answer409(no writable config file) or500(the save or reload failed), with the same body. See Update Config. GET /clientsanswers the page envelope instead of a bare array, with atotal. It also honoursoffsettogether withactive_days; it used to ignore it.- Every paged list answers the
limitit used.limitis clamped between 1 and the endpoint's maximum, so/queries?limit=5000answers"limit": 1000./clientsand/managed-domainsnow have a maximum of 1000. A/queriespage fetched withcursoranswers"offset": 0. GET /blocklistandGET /whitelistare gone. They listed legacy tables that nothing writes, and always answered an empty list. Managed domains are at/managed-domains, and the list sources at/blocklist-sourcesand/whitelist-sources.
Interactive Documentation (OpenAPI / Scalar)¶
Both APIs publish an OpenAPI 3.x specification and ship a built-in Scalar UI for interactive exploration. Scalar is embedded in the binary, so the explorer works without internet access. The endpoints are public — no authentication is required to read the spec or open the UI.
| API | OpenAPI spec | Interactive docs |
|---|---|---|
| Ferrous (every mode) | GET /ferrous/api/v1/openapi.json | GET /ferrous/api/v1/docs |
Pi-hole v6 (pihole_compat = true) | GET /api/openapi.json | GET /api/docs |
The spec describes every handler, request/response schema, parameter and security scheme (session_cookie + X-Api-Key for the native API, X-FTL-SID for the Pi-hole layer). Each spec names the base it is served under as its server, so Scalar's Try it and generated clients call the right URLs. It can be fed into any OpenAPI-aware tool (Postman, openapi-generator, schemathesis, …) to produce clients or contract tests — see Integrations for examples.
Authentication¶
When authentication is enabled ([auth] section in config), all API endpoints require either a valid session cookie or an API token — except the public auth endpoints listed below.
Session Authentication¶
Authenticate via the login endpoint to receive a session cookie:
POST /ferrous/api/v1/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "your-password"
}
The server sets a ferrous_session cookie on successful login. The cookie is sent automatically with subsequent requests from the dashboard.
API Token Authentication¶
For programmatic access, include an API token in the X-Api-Key header:
Create and manage tokens via the API Token endpoints below.
Both methods accepted
The auth guard accepts either a valid session cookie or an X-Api-Key header. You do not need both.
Response Format¶
Responses are JSON, except a 204 or the blocklist sync's 202 (no body) and the backup export (a file download). A success answers with the status of what the request did:
| Request | Success |
|---|---|
| Read | 200 with the object, a list or a page |
| Create | 201 with the created object |
Update (PUT, PATCH) | 200 with the updated object |
| Delete | 204, no body |
| Action (a test, a backtest, a save) | 200 with its result; 202 when a blocklist sync starts in the background |
Config save and reload, TLS upload and generate, and backup import answer with a success field, described with each of them. Config save and reload keep that body on failure too; backup import keeps it only for a partial import, which is a 200. No other route uses success.
An error answers with a status and, except for the two noted below, a JSON body:
| Status | When |
|---|---|
400 Bad Request | A field is invalid: a malformed name, URL, comment, CIDR, regex, action, and so on. Length limits count characters, not bytes. |
401 Unauthorized | A protected route got no valid session or API token, or a login step got a wrong password or code. |
403 Forbidden | The [auth.admin] user cannot be deleted. |
404 Not Found | The resource does not exist, or a group or profile the request names does not. |
409 Conflict | The name is taken, or the server's state blocks the change: a group with assigned clients or routed by an upstream pool, a sync already running, no writable config file. |
429 Too Many Requests | Too many failed login attempts. |
500 Internal Server Error | The request failed inside the server. The body only says internal error; the details go to the log. Config save and reload keep their message. |
503 Service Unavailable | GET /health while the DNS listener is down. |
The 401 of a protected route called without credentials, and the 409 of a blocklist sync already running, have no body.
A body that is not JSON, or lacks a required field, is refused before the route runs: 400, 415 (no Content-Type: application/json) or 422, with a plain-text message. The login, second-factor and passkey routes answer 400 with the JSON error body instead.
Under each route, a contract line gives:
- Auth:
public,session or API key, orsession only. Asession onlyroute acts on the signed-in user, so an API key alone gets401. - Returns: the success status and the schema in the OpenAPI spec, where the full field list lives.
- Errors: the statuses particular to the route. Any protected route can also answer
401, and any route500.
Pagination¶
A list that grows with traffic is paged: the query log, the clients, the cache entries and the managed domains. Each takes limit and offset and answers the same envelope:
| Field | Meaning |
|---|---|
data | The items on this page, in the endpoint's order |
total | Items matching the request's filters, across every page |
limit | The page size used: the requested limit, clamped between 1 and the endpoint's maximum |
offset | Items skipped before this page |
| Endpoint | Default limit | Maximum |
|---|---|---|
GET /ferrous/api/v1/queries | 100 | 1000 |
GET /ferrous/api/v1/clients | 100 | 1000 |
GET /ferrous/api/v1/managed-domains | 100 | 1000 |
GET /ferrous/api/v1/cache/entries | 25 | 500 |
Two endpoints add fields to the envelope:
records_total(/queries,/cache/entries): the size of the collection the list is drawn from, before the request's filters. For/queriesit is every logged query inperiod; for/cache/entries, every entry the cache holds, including expired ones not yet removed, which the listing leaves out.next_cursor(/queries): pass it ascursorto get the next page, ornullon the last one. A cursor keeps its place while new queries are logged, which anoffsetdoes not. Withcursor,offsetis ignored and answered as0.
Every other list answers a plain JSON array with all of its items: groups, users, API tokens, sessions, blocklist and allowlist sources, client subnets, DoH IDs, regex filters, custom and blocked services, Safe Search configs, local records and schedule profiles. These grow only as fast as someone configures them. Top-N lists, such as the dashboard's top domains, take a limit but are not paged.
A new endpoint follows the same rule. It is paged when traffic feeds its list, or a bulk import can grow it without a practical bound. It then uses the envelope above, with a default limit of 100 and a maximum of 1000 unless its rows are heavy, as cache entries are. Otherwise it answers a plain array.
Health & System¶
Health Check¶
Auth: public · Returns: 200 HealthResponse · Errors: 503 DNS listener down
It needs no session or API token, even with authentication on, so an uptime monitor or a load balancer can call it:
| Status | status | When |
|---|---|---|
200 OK | ok | The web server is up and the plain DNS listener (dns_port) is serving. |
503 Service Unavailable | unavailable | The plain DNS listener is down: its port could not be bound (another resolver holds port 53, for example) or every worker exited. |
The Docker image's health check calls it through ferrous-dns --healthcheck.
System Info¶
Auth: session or API key · Returns: 200 SystemInfoResponse
Returns system information: kernel version, load averages, memory usage.
Hostname¶
Auth: session or API key · Returns: 200 HostnameResponse
Returns the server hostname.
Statistics¶
Dashboard¶
Auth: session or API key · Returns: 200 DashboardResponse
Returns a single aggregated payload for the dashboard view: summary counts, the query timeline, top blocked domains, top clients and the query-type breakdown. Use the optional period_hours parameter to change the look-back window (defaults to 24 hours). malware_detection_enabled says whether the malware detectors run, which is the master switch as of the last restart, not a saved change still waiting for one.
Summary counts, cache stats, DNSSEC stats and the timeline are served from per-minute rollups, so their windows are minute-aligned: a window includes the whole minute it starts in. The query log, top-N lists and the query rate read the raw log and use the exact cutoff.
The top blocked domains and top clients are only served inside this payload (top_blocked_domains, top_clients); there is no separate route for them.
Summary Stats¶
Auth: session or API key · Returns: 200 StatsResponse
Returns aggregated query statistics: total queries, blocked queries, block rate.
Query Rate¶
Auth: session or API key · Returns: 200 QueryRateResponse
Returns the current query rate. Supports unit=second or unit=minute.
Query Timeline¶
Auth: session or API key · Returns: 200 TimelineResponse
Returns query volume over time for dashboard graphs.
DNSSEC Stats¶
Auth: session or API key · Returns: 200 DnssecStatsResponse
Counts the client queries of the period by DNSSEC outcome: secure, insecure, bogus and indeterminate. validated is the number that got any outcome, and total the number of client queries. ds_denials_unproven counts empty DS answers that came without an authenticated denial, a sign that the upstreams strip DNSSEC proofs. Unlike the other fields, it counts since the server started, not over period. period is a number and a unit (30m, 24h, 7d, 2w), capped at 30 days, and defaults to 24h.
Query Log¶
List Queries¶
Auth: session or API key · Returns: 200 PaginatedQueries · Errors: 400 unknown category, type, dnssec_status, protocol or cookie
Returns recent DNS queries with filtering support, newest first, as a page with records_total and next_cursor.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Rows per page (default: 100, max: 1000) |
offset | integer | Rows to skip |
cursor | integer | next_cursor of the previous page; takes the place of offset |
protocol | string | Transport the client used: udp, tcp, dot, doh or doq. Case-insensitive; any other value returns 400 |
cookie | string | The query's DNS Cookie: any (it carried one), valid, client, invalid, or none (it carried none, which includes rows logged before cookies were recorded). Case-insensitive; any other value returns 400 |
Each entry carries its query-log id: stable across reads, and higher for newer rows. A client that polls the log can match rows by it, and a next_cursor is one of these ids.
Each entry carries a protocol field with the same values in lowercase, or null for internally generated queries and for rows logged before the transport was recorded.
cookie says what the query's DNS Cookie showed: client for a client cookie alone (a first query, or a client that did not keep ours), valid for a server cookie this server issued to that client in the current or previous rotation window, and invalid for any other server cookie: one from before a restart or older than two windows, or a forged one. It is null when the query carried none. A strict-mode refusal is logged as blocked, with block_source dns_cookie and response_status BADCOOKIE, or REFUSED for a query that carried no cookie.
coalesced marks a query's part in in-flight coalescing: leader when identical queries that arrived while it was in flight shared its answer, follower when it got such a query's answer with no upstream request of its own, and null otherwise. A follower carries its leader's cache_hit, upstream_server and upstream_pool, and its own response time.
group_id is the client group the query was decided in, whose rules applied to it, or null for rows logged before the group was recorded and rows whose group has since been deleted. A managed-domain rule that should change the outcome for that client belongs in that group.
doh_client_id is the <ClientID> segment from /dns-query/<ClientID> for DoH queries that carried one, or null otherwise. When present, client_hostname resolves to the registered DoH ID's name (or the raw doh_client_id when unregistered).
Configuration¶
Get Config¶
Auth: session or API key · Returns: 200 ConfigResponse
Returns the full current configuration including server, DNS, blocking, logging, and database settings.
restart_required is true while a saved change is waiting for a server restart to take effect — set by POST /ferrous/api/v1/config (anything but upstream pools and server.encrypted_dns.doh_allow_unregistered_ids), POST /ferrous/api/v1/settings, and the TLS certificate upload/generate endpoints. It is held in memory, so restarting the server resets it; the web UI's restart banner follows it.
web_certificate_expires_at is when the certificate the web server loaded at start expires, in Unix seconds, or null while it serves plain HTTP. A certificate replaced on disk counts after the restart that loads it. The dashboard's certificate banner follows it.
Update Config¶
Auth: session or API key · Returns: 200 ConfigSaveResponse · Errors: 400 invalid value, 409 no writable config file, 500 save or pool reload failed
Partial update — only include the sections you want to change:
Server settings (require restart):
Upstream pools (hot-applied). pools replaces the whole list. A pool with domains is a conditional pool; groups and internal only apply to one:
{
"dns": {
"pools": [
{ "name": "public", "strategy": "parallel", "priority": 1,
"servers": ["https://cloudflare-dns.com/dns-query"] },
{ "name": "office-a", "strategy": "failover", "priority": 1,
"servers": ["udp://10.1.0.10:53"],
"domains": ["corp.example"], "groups": [2], "internal": true }
]
}
}
GET /ferrous/api/v1/config returns domains, groups and internal on every pool, empty or false for a default pool. When a save changes where some name is routed, the DNS cache is cleared.
Malware detection (require restart). The master switch and the rebinding switch sit in dns; each engine is a nested object with the keys of its ferrous-dns.toml section (reference), and any subset of them can be sent:
{
"dns": {
"malware_detection_enabled": true,
"rebinding_protection_enabled": true,
"tunneling_detection": { "action": "alert", "max_label_length": 40 },
"dga_detection": { "confidence_threshold": 0.7 },
"nxdomain_hijack": { "probes_per_round": 3 },
"response_ip_filter": {
"enabled": true,
"ip_list_urls": ["https://feodotracker.abuse.ch/downloads/ipblocklist.txt"]
}
}
}
GET /ferrous/api/v1/config returns all of them, every key of every engine included.
Exemptions are not config keys: a domain is exempted with an allow in Managed Domains, and a client with a group whose malware_detection_enabled is false (Groups). Both apply at once, with no restart. The rebinding_allowlist, domain_whitelist and client_whitelist keys of earlier releases are ignored in a request and no longer returned.
The merged configuration is validated before anything is applied. An invalid value — an unknown block_mode, dnssec_mode or malware detection action, an unparseable server or sinkhole address, a local_dns_server that is not an IP address or IP:port, a zero interval, timeout or capacity such as cache_compaction_interval: 0, a malware detection threshold outside its range such as confidence_threshold: 1.5, a feed URL without http:// or https://, response IP filtering enabled without a feed URL, a session lifetime whose expiry is past the latest representable date such as session_ttl_hours: 4294967295, or pools that cannot route (an invalid domain, groups or internal without domains, no pool without domains, a domain routed to two pools for the same clients, a client group that does not exist) — returns 400 with { "success": false, "error": "…" } naming the key, and neither the live server nor the file changes.
A request that is valid but cannot be carried out answers with an error status and the same { "success": false, "error": "…" } body:
| Status | When |
|---|---|
409 Conflict | There is no writable config file: the server was started without one, or the file's permissions mark it read-only. Nothing was applied. |
500 Internal Server Error | The save was attempted and failed: the file could not be written (on a read-only mount, for example), the client groups could not be read, or the upstream pools could not be applied. If the pools went live but the file could not be written, error says so: retry the save, since a restart would revert them. |
The file is rewritten atomically (a synced temp file renamed over it), so a crash mid-save leaves the old or the new file, never a truncated one. The new file keeps the old one's mode, owner and group. When the file cannot be replaced — a Docker single-file bind mount, a directory the server cannot write, or an owner or group the server cannot give the new file — it is rewritten in place instead.
Reload Config¶
Auth: session or API key · Returns: 200 ConfigSaveResponse · Errors: 409 no config file, 500 the file fails to load or validate, or its pools fail to apply
Reloads the configuration from the TOML file without restarting the server. DNS, blocking, and cache settings take effect immediately. Server-level settings (ports, pihole_compat) require a full restart. A file that fails to load, parse or validate answers 500 with { "success": false, "error": "…" }, and the running configuration is kept. A server started without a config file answers 409.
The file is loaded the way startup loads it: command-line overrides the server was started with (--dns-port, --web-port, --bind, --database, --log-level) still win over the file. Changed upstream pools are rebuilt and swapped in live, as with POST /ferrous/api/v1/config; if that fails, nothing changes. A reload waits for any config save or backup import in progress, so it never interleaves with one. The Pi-hole POST /api/action/restartdns runs the same reload.
Get Settings¶
Auth: session or API key · Returns: 200 SettingsDto
Returns DNS-specific settings (non-FQDN blocking, PTR blocking, local domain).
Update Settings¶
Auth: session or API key · Returns: 200 ConfigSaveResponse · Errors: 400 invalid setting, 409 no writable config file, 500 the file could not be written
Full replace — unlike POST /ferrous/api/v1/config (a partial update), this endpoint overwrites the entire DNS settings form. Any field you omit reverts to its default: an omitted sinkhole_ipv4 clears a previously-set sinkhole, an omitted block_mode resets it to null_ip. Send the complete object:
{
"never_forward_non_fqdn": true,
"never_forward_reverse_lookups": true,
"local_domain": "lan",
"local_dns_server": "192.168.1.1:53",
"block_mode": "null_ip",
"block_ttl": 60,
"sinkhole_ipv4": "192.168.1.2",
"sinkhole_ipv6": "fd00::2"
}
sinkhole_ipv4 / sinkhole_ipv6 set a custom block target for null_ip mode (empty string = the null address 0.0.0.0 / ::). A non-empty value that is not a valid address of the matching family is rejected with 400 and { "success": false, "error": "Invalid IPv4 sinkhole address: …" }, and nothing is saved. See Custom Sinkhole IP. The same 400 applies to an unknown block_mode (null_ip, nxdomain, nodata or refused), a local_dns_server that is not an IP address or IP:port, and a DNS64 prefix that is not a /96. A local_dns_server given as a bare IP is saved as IP:53.
The response carries restart_required: true when the save changed a setting (these only take effect after a restart), false when the form was saved unchanged. A save that cannot be carried out answers 409 or 500 as POST /ferrous/api/v1/config does.
TLS Certificates¶
Manage the certificate used for the HTTPS web interface.
TLS Status¶
Auth: session or API key · Returns: 200 TlsStatusResponse
Returns the current certificate status: whether TLS is enabled, whether the cert and key files exist, the certificate subject, expiry (cert_not_after) and whether it is currently valid.
Upload Certificates¶
Auth: session or API key · Returns: 200 TlsUploadResponse · Errors: 400 missing part, invalid PEM or over 64 KB
Uploads a PEM cert and key pair via multipart form fields. They are written to tls_cert_path and tls_key_path from ferrous-dns.toml; the API cannot move those paths.
Generate Self-Signed¶
Auth: session or API key · Returns: 200 TlsUploadResponse · Errors: 400 the files exist and force is not set
Generates a self-signed certificate/key pair. Pass ?force=true to overwrite existing files.
Configuration Backup¶
Export and import the Ferrous DNS configuration as a JSON snapshot. A backup holds:
- the server, DNS, blocking, DNS64, logging and auth settings, including the upstream pools and their conditional-forwarding routes, rate limiting and the Malware Detection settings;
- the client groups, the blocklist sources and the local DNS records.
It holds no secrets (password hash, API tokens, TLS key contents) and nothing else: clients, managed domains and regex filters, for example, are not in it.
Export Config¶
Auth: session or API key · Returns: 200 backup file (application/json attachment)
Returns a backup JSON document as a download (Content-Disposition: attachment, filename ferrous-backup-YYYY-MM-DD.json).
Import Config¶
Auth: session or API key · Returns: 200 ImportSummaryResponse, success: false on a partial import · Errors: 400 no file part, invalid JSON or unsupported version
Restores configuration from a previously exported backup file uploaded as a multipart field (file). Returns an import summary describing what was applied.
| Parameter | Type | Description |
|---|---|---|
keep_host_settings | boolean | true keeps this server's dns_port, web_port, bind_address, web_bind_address, [server.web_tls] enabled, and [auth.webauthn] rp_id and rp_origin, instead of the backup's. Use it to copy a setup to a second server; leave it off to restore a server from its own backup (default: false). tls_cert_path and tls_key_path are never restored: they stay as this server's config file sets them |
- Groups are created by name; one that already exists is kept. A pool's routes and a blocklist source follow each group by name, so a backup from another server lands on the right groups even though their ids differ.
- Blocklist sources and local records that already exist are skipped.
- The settings are validated as a whole: if they fail, none are restored and
errorssays why. - A backup taken before pools, rate limiting, the Malware Detection settings and
web_bind_addresswere exported leaves this server's own values for them. - Restored settings take effect after a restart. When they differ from the running ones,
restart_requiredistrueand the dashboard shows the restart banner. - An import can turn authentication and the login lockout on but never off. A backup with either off leaves it on here, and
warningssays so.
{
"success": true,
"restart_required": true,
"summary": {
"config_updated": true,
"groups_imported": 1,
"groups_skipped": 1,
"blocklist_sources_imported": 2,
"blocklist_sources_skipped": 0,
"local_records_imported": 3,
"local_records_skipped": 0
},
"errors": [],
"warnings": []
}
A partial import still answers 200: the import is not transactional, so what was restored stays applied. success is then false, and errors names each item that was not restored, such as a local record with an invalid address or a blocklist source routed for a group the backup does not have.
warnings names each setting this server kept on where the backup had it off: authentication, or the login lockout (login_rate_limit_attempts = 0). Warnings do not make success false.
Auth Endpoints¶
Auth Status¶
Auth: public · Returns: 200 AuthStatusResponse
Returns whether authentication is enabled and whether a password has been configured.
First-Run Setup¶
Auth: public · Returns: 204 · Errors: 400 invalid password, 409 password already set
Sets the admin password on first run (when no password is configured).
Warning
This endpoint is only available when password_hash is empty. Once a password is set, it returns 409 Conflict.
Login¶
Auth: public · Returns: 200 LoginResponse and the session cookie, or "mfa_required": true and a challenge_token · Errors: 401 wrong username or password, 429 too many attempts
Authenticates with username and password. Returns a session cookie (ferrous_session).
| Field | Type | Default | Description |
|---|---|---|---|
username | str | — | Admin username |
password | str | — | Admin password |
remember_me | bool | false | Extend session lifetime to remember_me_days |
Logout¶
Auth: public · Returns: 204
Invalidates the current session, if there is one, and clears the cookie.
Change Password¶
Auth: session only · Returns: 204 · Errors: 400 invalid new password, 401 wrong current password
Changes the password of the signed-in user, whom the session cookie names. A wrong current_password changes nothing.
Every other session of that user is revoked, so a device signed in with the old password has to log in again. The session that made the change stays signed in.
List Sessions¶
Auth: session or API key · Returns: 200 [SessionResponse]
Returns all active sessions. A session's id is its handle, the SHA-256 of the token its cookie carries, so it cannot be sent back as a cookie. ip_address is the address the login came from: the TCP peer, or the client a reverse proxy in trusted_proxies names in X-Forwarded-For or X-Real-IP.
Revoke Session¶
Auth: session or API key · Returns: 204, also for an unknown id
Revokes a specific session by the id the list shows; the session's own token is accepted too. Any authenticated caller — any user's session or any API token — can revoke any user's session, including the admin's; there is no ownership or role check.
Two-Factor Authentication (TOTP)¶
The signed-in user's authenticator app and recovery codes. The flows and the rules behind them are in Two-Factor Authentication.
Auth: session only · Returns: 200 MfaStatusResponse
Returns totp_enabled, recovery_codes_remaining, webauthn_configured and the user's passkeys (id, label, created_at, last_used_at).
Auth: session only · Returns: 200 SetupTotpResponse · Errors: 409 TOTP already enabled
Starts TOTP enrollment and returns the material for the authenticator app: secret, otpauth_uri and a qr_svg. Nothing is enabled until the code is confirmed.
Auth: session only · Returns: 200 RecoveryCodesResponse · Errors: 400 setup not started, 401 wrong code, 409 TOTP already enabled
Confirms enrollment with the app's current code and enables TOTP. The response carries the recovery_codes, shown only this once.
Auth: session only · Returns: 204 · Errors: 401 wrong password
Turns off every second factor of the user, after checking the password:
Auth: public · Returns: 200 LoginResponse and the session cookie · Errors: 400 no second factor enrolled, 401 wrong code or expired challenge, 429 too many attempts
The second step of a login. When POST /auth/login answers "mfa_required": true, it also returns a challenge_token and the methods the user has. Send the token with a TOTP code or a recovery code; the answer is the same as a login's, with the session cookie.
Passkeys (WebAuthn)¶
Each passkey ceremony is a start that returns options for the browser's WebAuthn API and a token, then a finish that takes the browser's response with that token. Passkeys need [auth.webauthn] configured; without it the start routes answer 400. See Passkeys.
POST /ferrous/api/v1/auth/webauthn/register/start
POST /ferrous/api/v1/auth/webauthn/register/finish
Auth: session only · Returns: start 200 WebauthnRegisterStartResponse; finish 204 · Errors: start 400 passkeys not configured; finish 400 attestation rejected, 401 ceremony expired
Registers a passkey for the signed-in user. start returns challenge (for navigator.credentials.create) and a ceremony_token; finish takes ceremony_token, the browser's response and an optional label.
POST /ferrous/api/v1/auth/webauthn/authenticate/start
POST /ferrous/api/v1/auth/webauthn/authenticate/finish
Auth: public · Returns: start 200 WebAuthn request options; finish 200 LoginResponse and the session cookie · Errors: start 400 passkeys not configured or none registered, 401 expired challenge; finish 400 assertion rejected, 401 expired challenge
A passkey as the second step of a login. start takes the login's challenge_token and returns the options for navigator.credentials.get; finish takes the same challenge_token and the browser's response, and answers like a login, with the session cookie.
POST /ferrous/api/v1/auth/webauthn/discoverable/start
POST /ferrous/api/v1/auth/webauthn/discoverable/finish
Auth: public · Returns: start 200 DiscoverableStartResponse; finish 200 LoginResponse and the session cookie · Errors: start 400 passkeys not configured, 429 too many passwordless logins pending; finish 400 assertion rejected, 401 expired challenge or unknown passkey
Passwordless login with a resident passkey: no username or password. start takes no body and returns challenge and a challenge_token; finish takes challenge_token, the browser's response and an optional remember_me, and answers like a login. Anyone can call start, so about 1024 of these logins can be pending at once; each lasts mfa_challenge_ttl_secs.
Auth: session only · Returns: 204 · Errors: 404 unknown passkey
Removes one of the signed-in user's passkeys.
API Tokens¶
Named API tokens for programmatic access. Tokens are stored as SHA-256 hashes — the full token is only shown once at creation.
List Tokens¶
Auth: session or API key · Returns: 200 [ApiTokenResponse]
Returns all tokens. Only the token prefix is shown in the listing: 8 characters of a generated key, and at most a quarter of a custom one.
Create Token¶
Auth: session or API key · Returns: 201 CreatedApiTokenResponse · Errors: 400 empty or too long name, or a token shorter than 32 characters or with whitespace at either end, 409 name taken
Send a token to bring an existing key instead of generating one; it needs at least 32 characters.
Response includes the full token value — save it immediately:
Update Token¶
Auth: session or API key · Returns: 200 ApiTokenResponse · Errors: 400 invalid name, or a token shorter than 32 characters or with whitespace at either end, 404 unknown token, 409 name taken
Send the name, which is required, and token to import a custom key of at least 32 characters:
The response never carries the key, not even one you just sent.
Pi-hole migration
Use the token field to import existing API keys from Pi-hole or other tools.
Delete Token¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown token
User Management¶
Roles are informational
Every user has a role (admin or viewer), stored on the account and its sessions and shown in the UI and API responses. Nothing enforces it: a viewer can call every protected endpoint, including configuration changes, user management and API tokens. Give accounts only to people you would trust with full access.
List Users¶
Auth: session or API key · Returns: 200 [UserResponse]
Returns all users.
Create User¶
Auth: session or API key · Returns: 201 UserResponse · Errors: 400 invalid field or role, 409 username taken
| Field | Type | Default | Description |
|---|---|---|---|
username | str | — | 1–64 alphanumeric characters, -, _ or . |
display_name | str | — | Optional, up to 100 characters |
password | str | — | 8–256 characters |
role | str | viewer | admin or viewer (informational, see above); any other value is 400 |
A username that is already taken returns 409. The [auth.admin] username is always taken, even before its password is set in the setup wizard.
Delete User¶
Auth: session or API key · Returns: 204 · Errors: 403 the [auth.admin] user, 404 unknown user
Cache¶
Cache Stats¶
Auth: session or API key · Returns: 200 CacheStatsResponse
Returns cache hit/miss counts, hit rate, and total entries. Counts come from the query log over period (default 24h); the hit rate is hits ÷ (hits + misses), so blocked queries, which never reach the cache, count in neither. /stats reports the same figure as cache_hit_rate.
Cache Metrics¶
Auth: session or API key · Returns: 200 CacheMetricsResponse
Returns detailed cache metrics: hits, misses, evictions, insertions, optimistic refreshes, lazy deletions, compactions, expirations, hit rate. expirations counts the positive entries their timer removed past their TTL; compactions also counts expired negative answers. hits, misses and hit_rate count cache lookups since the server started, not queries, so they differ from the query-log figures in /cache/stats.
Cache Overview¶
Auth: session or API key · Returns: 200 CacheOverviewResponse
What the dashboard's Cache Refreshes card shows, from one pass over the cache:
{
"top_refreshed": [{ "domain": "github.com", "type": "A", "refreshes": 12 }],
"expiring_soon": 37,
"expiring_window_secs": 60,
"inserted": 5120,
"expired": 1830
}
top_refreshed— the five entries renewed most since they were stored, most renewed first; entries never renewed are left out. The counts matchrefreshesin the listing below.expiring_soon— entries whose TTL ends within the nextexpiring_window_secs(60 s, the lead with which renewal starts, so an entry still inside it is not being renewed).insertedandexpired— entries stored and entries removed past their TTL since the server started. The cache lives in memory, so both start from zero on every restart.
List Cache Entries¶
Auth: session or API key · Returns: 200 PaginatedCacheEntries
Returns the entries currently held in the positive cache, with filtering, ordering, and pagination.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Max results (default: 25, max: 500) |
offset | integer | Pagination offset |
domain | string | Case-insensitive substring match on the cached domain |
type | string | Record type name, e.g. A, AAAA, CNAME |
sort | string | hits, refreshes, cached_at, expires_at, domain, or type (default: cached_at) |
order | string | asc or desc (default: desc) |
The response is a page with records_total: total counts the entries matching the filters, and records_total every entry in the cache. Each item carries domain, type, group_id, answers, canonical_name, dnssec_status, ttl, remaining_ttl, cached_at, expires_at, hits, refreshes, last_access, permanent, and stale. Timestamps are UNIX epoch seconds; remaining_ttl and expires_at are null for permanent entries. group_id is null for the entries every client shares; a split-horizon answer from a conditional pool routed for one client group carries that group's id, and the same name can be listed once per group.
hits counts lookups served from the cache, the per-thread L1 copies of hot A/AAAA records included. L1 hands its hits over in batches, at most once per second per thread, so the count can trail by the last second of them.
refreshes counts the times the cache renewed the entry from upstream, ahead of expiry or as a serve-stale repair. Like hits, it starts over when a new answer replaces the entry.
Delete Cache Entry¶
Auth: session or API key · Returns: 204 · Errors: 400 unknown record type or a permanent local record, 404 not cached
Removes a single cache entry. Add group_id to remove a client group's split-horizon entry (&group_id=2); without it, the entry every client shares is removed.
Upstream Health¶
Health Summary¶
Auth: session or API key · Returns: 200 map of upstream to status
Returns health status per upstream server (Healthy / Unhealthy).
Health Detail¶
Auth: session or API key · Returns: 200 [UpstreamGroupResponse]
Returns detailed health information per upstream: pool name, strategy, latency metrics, failure counts.
Each entry in resolved has no_route, true for an address this host has no route to, as in a container without IPv6. Such an entry reads Unhealthy, is never dialed, and does not count toward the server's status.
Clients¶
List Clients¶
Auth: session or API key · Returns: 200 PaginatedClients
Returns the detected clients with IP, MAC, hostname, group, query count, and last seen, most recently seen first, as a page.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Clients per page (default: 100, max: 1000) |
offset | integer | Clients to skip |
active_days | integer | Only clients seen within the last N days; total then counts only those |
Client Stats¶
Auth: session or API key · Returns: 200 ClientStatsResponse
Returns per-client query statistics.
Create Manual Client¶
Auth: session or API key · Returns: 201 ClientResponse · Errors: 400 invalid ip_address, 404 unknown group
hostname, group_id and mac_address are optional.
Update Client¶
Auth: session or API key · Returns: 200 ClientResponse · Errors: 404 unknown client or group
Both fields are optional; an absent field keeps its value.
Delete Client¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown client
Assign Client to Group¶
Auth: session or API key · Returns: 200 ClientResponse · Errors: 404 unknown client or group
Client Subnets¶
Subnets auto-assign clients matching a CIDR range to a group.
List Subnets¶
Auth: session or API key · Returns: 200 [ClientSubnetResponse]
Create Subnet¶
Auth: session or API key · Returns: 201 ClientSubnetResponse · Errors: 400 invalid CIDR, 404 unknown group, 409 subnet exists
The subnet is stored in canonical form: host bits are cleared and IPv6 is lowercased and compressed, so 192.168.1.5/24 is stored as 192.168.1.0/24 and conflicts with an existing 192.168.1.0/24 (409).
Subnets stored before canonicalisation are rewritten the same way at startup. If two stored rows name the same network, the older row is kept and the other is deleted, with a WARN naming both rows' ids and groups; clients in that subnet then belong to the kept row's group.
Delete Subnet¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown subnet
DoH IDs¶
Per-device DNS-over-HTTPS identifiers mapped to client groups.
List DoH IDs¶
Auth: session or API key · Returns: 200 [DohIdResponse]
Get DoH ID¶
Auth: session or API key · Returns: 200 DohIdResponse · Errors: 404 unknown DoH ID
Create DoH ID¶
Auth: session or API key · Returns: 201 DohIdResponse · Errors: 400 invalid name, client ID or comment, 404 unknown group, 409 duplicate name or client ID
{
"name": "Alice's iPhone",
"client_id": "alice-iphone",
"group_id": 2,
"comment": "Personal phone"
}
When client_id is omitted or null, the server generates a random UUID v4. A custom client_id must be 1–63 characters of lowercase ASCII (a-z), digits (0-9) and hyphens (-), and cannot start or end with a hyphen.
Update DoH ID¶
Auth: session or API key · Returns: 200 DohIdResponse · Errors: 400 invalid name, client ID or comment, 404 unknown DoH ID or group, 409 duplicate name or client ID
Omitting client_id (or passing null) preserves the existing identifier; passing a string replaces it. Passing "comment": null clears the stored comment.
Delete DoH ID¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown DoH ID
Groups¶
List Groups¶
Auth: session or API key · Returns: 200 [GroupResponse]
Create Group¶
Auth: session or API key · Returns: 201 GroupResponse · Errors: 400 invalid name or comment, 409 name taken
{
"name": "Kids",
"comment": "Children's devices",
"enabled": true,
"malware_detection_enabled": true
}
enabled is optional and defaults to true. The clients of a disabled group, matched by IP, subnet or DoH ID, are handled as clients of the default group: its blocklists, managed domains, regex filters, blocked services, Safe Search, schedules, Malware Detection switch and pool routes apply to them instead of their own group's. See Disabled Groups. A change applies to the next query, with no restart.
malware_detection_enabled is optional and defaults to true. With false, the five malware detectors skip the queries of the group's clients; its blocklists, allows and CNAME cloaking checks still apply. Every response carries the field, and the change applies to the next query, with no restart.
Get Group¶
Auth: session or API key · Returns: 200 GroupResponse · Errors: 404 unknown group
Update Group¶
Auth: session or API key · Returns: 200 GroupResponse · Errors: 400 invalid field or disabling the default group, 404 unknown group, 409 name taken
Takes the fields of Create Group, all optional; an omitted field keeps its value. The default group cannot be disabled, but its malware_detection_enabled can be switched off.
Delete Group¶
Auth: session or API key · Returns: 204 · Errors: 400 the default group, 404 unknown group, 409 clients or DoH IDs assigned or an upstream pool routes for it
Returns 409 if the group still has assigned clients or DoH IDs, or if an upstream pool routes domains for it (its groups in a conditional pool); remove the group from the pool first. Managed domains (including the rules generated for a blocked service), regex filters, blocklist and allowlist memberships, blocked services, Safe Search settings, client subnets and schedule assignments are removed with the group, and the block filter is reloaded so they stop applying immediately; query-log entries keep their data but lose the group attribution.
Get Group Clients¶
Auth: session or API key · Returns: 200 [ClientResponse], empty for an unknown group
Blocklist Sources¶
List Sources¶
Auth: session or API key · Returns: 200 [BlocklistSourceResponse]
Create Source¶
Auth: session or API key · Returns: 201 BlocklistSourceResponse · Errors: 400 invalid name, URL or comment, 404 unknown group, 409 name taken
{
"name": "HaGeZi Pro",
"url": "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt",
"enabled": true
}
The new source is downloaded and the block index rebuilt as part of the request, so it takes effect on the next query.
Get Source¶
Auth: session or API key · Returns: 200 BlocklistSourceResponse · Errors: 404 unknown source
Update Source¶
Auth: session or API key · Returns: 200 BlocklistSourceResponse · Errors: 400 invalid name, URL or comment, 404 unknown source or group, 409 name taken
Delete Source¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown source
Sync Sources¶
Auth: session or API key · Returns: 202, no body: the sync runs in the background · Errors: 404 unknown source, 409 a sync is already running
Refreshes the given source. The compiled index is a single snapshot keyed by a global source bitset, so one list cannot be re-downloaded on its own: this rebuilds the index and therefore re-downloads every enabled source. The id records which list the operator asked for and yields 404 when it does not exist.
Returns 202 Accepted as soon as the rebuild starts; it then runs in the background, since refreshing large lists can take minutes.
Every other change, to a source, managed domain, regex filter, service or group, rebuilds from the lists already downloaded and fetches only a list the server does not hold yet. This endpoint, the daily sync job and the Pi-hole POST /api/action/gravity download every list again. A list that fails to download keeps its previous copy in the index, and its last_synced_at does not change; the log line Failed to fetch blocklist source gives the reason.
Whitelist Sources¶
List Sources¶
Auth: session or API key · Returns: 200 [WhitelistSourceResponse]
Create Source¶
Auth: session or API key · Returns: 201 WhitelistSourceResponse · Errors: 400 invalid name, URL or comment, 404 unknown group, 409 name taken
Get / Update / Delete¶
GET /ferrous/api/v1/whitelist-sources/{id}
PUT /ferrous/api/v1/whitelist-sources/{id}
DELETE /ferrous/api/v1/whitelist-sources/{id}
Auth: session or API key · Returns: GET 200 WhitelistSourceResponse; PUT 200 WhitelistSourceResponse; DELETE 204 · Errors: GET 404 unknown source; PUT 400 invalid name, URL or comment, 404 unknown source or group, 409 name taken; DELETE 404 unknown source
Creating, updating or deleting a whitelist source rebuilds the block filter, as blocklist source changes do, so the change applies without waiting for the daily sync. The rebuild re-downloads every enabled list.
Managed Domains¶
Individual domains added to the blocklist or allowlist via the dashboard.
List Domains¶
Auth: session or API key · Returns: 200 PaginatedManagedDomains
Returns the managed domains sorted by name, then by group, as a page.
| Parameter | Type | Description |
|---|---|---|
limit | integer | Domains per page (default: 100, max: 1000) |
offset | integer | Domains to skip |
search | string | Case-insensitive substring match on the domain or the name; total then counts only the matches. Blank means no filter |
Create Domain¶
Auth: session or API key · Returns: 201 ManagedDomainResponse · Errors: 400 invalid name, domain, comment, action or expiry, 404 unknown group, 409 name taken in the group
{
"name": "Popup ads",
"domain": "ads.example.com",
"action": "deny",
"comment": "Annoying popup ads"
}
action is deny (block) or allow. group_id defaults to the default group, enabled to true.
expires_in_secs (60 to 2592000, i.e. 30 days) makes a temporary rule: it stops applying when it expires and is deleted at most 30 seconds later. The response's expires_at holds that time in UTC (YYYY-MM-DD HH:MM:SS), or null for a rule that never expires; PUT leaves it as it is.
Create Domains in Bulk¶
Auth: session or API key · Returns: 200 BulkCreateManagedDomainsResponse · Errors: 400 invalid action or comment, or domains empty or longer than 10000 entries, 404 unknown group
{
"domains": ["ads.example.com", "*.tracker.example.net", "x..com"],
"action": "allow",
"group_id": 1,
"comment": "bulk import"
}
Adds every domain as a permanent rule with the same action, group, comment and enabled state, in one write, and rebuilds the block filter once. The body may take up to 3 MB, room for 10000 domains of any valid length. group_id defaults to the default group, enabled to true. Each domain is trimmed, lowercased and checked as Create Domain checks it; one invalid domain does not stop the others.
A rule is named after its domain. When the group already has a rule by that name, such as a deny of the same domain, the rule is named <domain> (<action>) instead.
The reply holds one result per domain, in request order:
{
"results": [
{ "domain": "ads.example.com", "status": "added" },
{ "domain": "*.tracker.example.net", "status": "existing" },
{ "domain": "x..com", "status": "invalid", "error": "Invalid managed domain: Domain cannot contain an empty label" }
]
}
status | Meaning |
|---|---|
added | The rule was created |
existing | The group already has a permanent rule for the domain with the same action and enabled state, so nothing was written. A blocked service's rule does not count, since it goes when the service is unblocked. With an error, every name the rule could take is used by other rules |
invalid | The domain is not valid; error says why |
A temporary rule, such as an allow from the query log, does not count as existing: the bulk rule is added beside it and outlasts it. Sending the same list again adds nothing twice.
Get / Update / Delete¶
GET /ferrous/api/v1/managed-domains/{id}
PUT /ferrous/api/v1/managed-domains/{id}
DELETE /ferrous/api/v1/managed-domains/{id}
Auth: session or API key · Returns: GET 200 ManagedDomainResponse; PUT 200 ManagedDomainResponse; DELETE 204 · Errors: GET 404 unknown domain; PUT 400 invalid name, domain, comment or action, 404 unknown domain or group, 409 name taken in the target group; DELETE 404 unknown domain
PUT is a partial update: an absent field keeps its value. Send "comment": null to clear the comment.
Regex Filters¶
List Filters¶
Auth: session or API key · Returns: 200 [RegexFilterResponse]
Create Filter¶
Auth: session or API key · Returns: 201 RegexFilterResponse · Errors: 400 invalid name, pattern, comment, action or regex, 404 unknown group, 409 name taken
{
"name": "Numbered ad hosts",
"pattern": "^ads\\d+\\.example\\.com$",
"action": "deny",
"enabled": true
}
action is deny (block) or allow.
Get / Update / Delete¶
GET /ferrous/api/v1/regex-filters/{id}
PUT /ferrous/api/v1/regex-filters/{id}
DELETE /ferrous/api/v1/regex-filters/{id}
Auth: session or API key · Returns: GET 200 RegexFilterResponse; PUT 200 RegexFilterResponse; DELETE 204 · Errors: GET 404 unknown filter; PUT 400 invalid name, pattern, comment, action or regex, 404 unknown filter or group, 409 name taken; DELETE 404 unknown filter
PUT is a partial update: an absent field keeps its value. Send "comment": null to clear the comment.
Block Filter¶
Block Filter Stats¶
Auth: session or API key · Returns: 200 BlockFilterStatsResponse
Returns total_blocked_domains, the number of exact domains in the compiled blocklist.
Test a Domain¶
Auth: session or API key · Returns: 200 FilterTestResponse · Errors: 400 client is not an IP address
Evaluates one domain against the compiled filter for a group, without sending a query, and names every rule involved: blocked, the block_matches and the allow_reasons, each with its kind (blocklist, manual, managed_domain, regex or allowlist), its source and its match_type. The group is group_id, else the group of the client IP, else the default group.
A managed_domain block match is one per rule: source_id is the managed domain's id and name its name, and each parent with a *. rule of its own adds one.
Backtest a Rule Set¶
Auth: session or API key · Returns: 200 BacktestResponse · Errors: 400 action is not allow or deny, no list line or regex, or an invalid regex
Simulates a candidate blocklist ("action": "deny") or allowlist ("action": "allow") over the domains of recent traffic, before adding it. list takes lines in any blocklist format, regexes raw patterns; window_hours (default 24), group_id (default 1) and limit (the most-queried distinct domains to evaluate) are optional. The report counts the domains and queries the candidate would match, change, find already blocked, or leave to an override, with a sample of the affected domains.
Services (1-Click Blocking)¶
Service Catalog¶
Auth: session or API key · Returns: 200 [ServiceDefinitionResponse]
Returns all available service categories (built-in + custom).
Auth: session or API key · Returns: 200 ServiceDefinitionResponse · Errors: 404 not in the catalog
Returns a specific service definition with its domain list.
Blocked Services¶
Auth: session or API key · Returns: 200 [BlockedServiceResponse]
Returns services currently blocked for a group.
Block Service¶
Auth: session or API key · Returns: 201 BlockedServiceResponse · Errors: 404 service not in the catalog or unknown group, 409 already blocked for the group
Unblock Service¶
Auth: session or API key · Returns: 204 · Errors: 404 not blocked for the group
Custom Services¶
Define your own blockable service categories.
List / Create¶
Auth: session or API key · Returns: GET 200 [CustomServiceResponse]; POST 201 CustomServiceResponse · Errors: POST 400 empty name or no domains, 409 a service with that id exists
{
"name": "My Custom Tracker",
"domains": ["tracker1.example.com", "tracker2.example.com"],
"category_name": "Tracking"
}
category_name is optional and defaults to Custom.
Get / Update / Delete¶
GET /ferrous/api/v1/custom-services/{id}
PATCH /ferrous/api/v1/custom-services/{id}
DELETE /ferrous/api/v1/custom-services/{id}
Auth: session or API key · Returns: GET 200 CustomServiceResponse; PATCH 200 CustomServiceResponse; DELETE 204 · Errors: GET 404 unknown service; PATCH 404 unknown service; DELETE 404 unknown service
Safe Search¶
Get Configs¶
Auth: session or API key · Returns: 200 [SafeSearchConfigResponse]
Every group's Safe Search settings.
Auth: session or API key · Returns: 200 [SafeSearchConfigResponse] · Errors: 404 unknown group
One group's settings, one entry per engine.
Toggle Safe Search¶
Auth: session or API key · Returns: 200 SafeSearchConfigResponse · Errors: 400 unknown engine or youtube_mode, 404 unknown group
youtube_mode (strict or moderate, default strict) applies to the youtube engine.
Delete Configs¶
Auth: session or API key · Returns: 204 · Errors: 404 unknown group
Local DNS Records¶
Static A/AAAA records served directly from cache.
List Records¶
Auth: session or API key · Returns: 200 [LocalRecordDto]
Create Record¶
Auth: session or API key · Returns: 201 LocalRecordDto · Errors: 400 invalid hostname, domain, IP or type, or an IP of the wrong family
Update / Delete¶
Auth: session or API key · Returns: PUT 200 LocalRecordDto; DELETE 204 · Errors: PUT 400 invalid field, 404 unknown record; DELETE 404 unknown record
Schedule Profiles¶
Time-based blocking profiles for parental controls.
List / Create Profiles¶
Auth: session or API key · Returns: GET 200 [ScheduleProfileResponse]; POST 201 ScheduleProfileResponse · Errors: POST 400 invalid name, timezone or comment, 409 name taken
{
"name": "School Hours",
"timezone": "Europe/Lisbon",
"comment": "Block social media during school"
}
timezone is an IANA name and defaults to UTC.
Get / Update / Delete Profile¶
GET /ferrous/api/v1/schedule-profiles/{id}
PUT /ferrous/api/v1/schedule-profiles/{id}
DELETE /ferrous/api/v1/schedule-profiles/{id}
Auth: session or API key · Returns: GET 200 ScheduleProfileWithSlotsResponse; PUT 200 ScheduleProfileResponse; DELETE 204 · Errors: GET 404 unknown profile; PUT 400 invalid name, timezone or comment, 404 unknown profile, 409 name taken; DELETE 404 unknown profile
Manage Time Slots¶
POST /ferrous/api/v1/schedule-profiles/{id}/slots
DELETE /ferrous/api/v1/schedule-profiles/{id}/slots/{slot_id}
Auth: session or API key · Returns: POST 201 TimeSlotResponse; DELETE 204 · Errors: POST 400 invalid action, days or time range, 404 unknown profile; DELETE 404 unknown slot or profile
days is a bitmask from 1 to 127 with Monday as 1, Tuesday as 2, and so on up to Sunday as 64: 31 is Monday to Friday. action is block_all or allow_all.
Assign Schedule to Group¶
GET /ferrous/api/v1/groups/{id}/schedule
PUT /ferrous/api/v1/groups/{id}/schedule
DELETE /ferrous/api/v1/groups/{id}/schedule
Auth: session or API key · Returns: GET 200 GroupScheduleResponse; PUT 200 GroupScheduleResponse; DELETE 204 · Errors: GET 404 no schedule assigned; PUT 404 unknown group or profile; DELETE 404 unknown group
Pi-hole v6 Compatibility API¶
When pihole_compat = true, the Pi-hole v6 endpoints below are available at /api/*, while the native API stays at /ferrous/api/v1/*. The compatibility layer is not read-only — it implements full CRUD for domains, lists, groups and clients, a blocking toggle, and the Pi-hole action endpoints. Every route answers with the response shapes and types of Pi-hole's FTL, and request bodies are read as JSON whatever their Content-Type.
With [auth] enabled, every endpoint except /api/auth, /api/info/login and /api/info/client needs the sid from POST /api/auth in an X-FTL-SID header (or a sid header, or ?sid=); the native X-Api-Key header is not read here — send an API token as the password instead. See Pi-hole Compatibility > Authentication.
Auth & session
| Method | Endpoint | Description |
|---|---|---|
POST | /api/auth | Pi-hole v6 login (session-based). Public |
GET | /api/auth | Session status; 401 with the session object without a valid session. Public |
DELETE | /api/auth | Logout |
GET | /api/auth/sessions | Live sessions; current_session marks the presented one |
DELETE | /api/auth/session/{id} | End the session listed under id |
GET | /api/info/login | {"dns": true, "https_port": N} (0 on plain HTTP). Public |
Stats & history
| Method | Endpoint | Description |
|---|---|---|
GET | /api/stats/summary | Dashboard summary stats, with types, status and replies counters |
GET | /api/history | Query timeline, 145 ten-minute buckets (also at /api/stats/history) |
GET | /api/history/clients | Per-client series in the same buckets (N, default 10) |
GET | /api/stats/top_domains | Top allowed domains (?blocked=true for blocked); count (default 10) |
GET | /api/stats/top_blocked | Top blocked domains; count |
GET | /api/stats/top_clients | Top clients (?blocked=true ranks by blocked queries); count |
GET | /api/stats/query_types | Query count per type |
GET | /api/stats/upstreams | Array of answer sources: blocklist, cache, then each upstream |
GET | /api/stats/recent_blocked | Most recently blocked domains; count (default 1) |
GET | /api/stats/database/summary | Long-term summary; Unix from and until required |
GET | /api/stats/database/top_domains | Long-term top domains; Unix from and until required |
GET | /api/stats/database/top_clients | Long-term top clients; Unix from and until required |
GET | /api/stats/database/upstreams | Long-term upstream usage; Unix from and until required |
GET | /api/stats/database/query_types | Long-term query type counts; Unix from and until required |
Queries & search
| Method | Endpoint | Description |
|---|---|---|
GET | /api/queries | Query log (filters: from, until, domain, client_ip, client_name, upstream, type, status, reply, dnssec, …; paging: length, start, cursor) |
GET | /api/queries/suggestions | Filter values (count, default 30) |
GET | /api/search/{domain} | Domain-list entries, regex filters, blocklists and allowlists that hold the domain (partial, N) |
DNS blocking toggle
| Method | Endpoint | Description |
|---|---|---|
GET | /api/dns/blocking | blocking: "enabled" or "disabled"; timer: seconds left, or null |
POST | /api/dns/blocking | Set blocking (optional timer: flip back after N seconds, fractions accepted) |
Domains (CRUD)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/domains | List all domains |
GET | /api/domains/{type} | List by type (allow/deny) or kind (exact/regex) |
GET | /api/domains/{type}/{kind} | List by type and kind (exact/regex) |
GET | /api/domains/{type}/{kind}/{domain} | Get one domain |
POST | /api/domains/{type}/{kind} | Add one domain or several |
PUT | /api/domains/{type}/{kind}/{domain} | Replace or create a domain |
DELETE | /api/domains/{type}/{kind}/{domain} | Delete a domain |
POST | /api/domains:batchDelete | Batch delete ([{item, type, kind}]) |
Lists / adlists (CRUD)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/lists | List adlists (optional ?type=allow\|block) |
POST | /api/lists?type=allow\|block | Add one adlist or several |
GET | /api/lists/{list} | Lists with this address or id (optional ?type=) |
PUT | /api/lists/{list}?type=allow\|block | Replace or create an adlist |
DELETE | /api/lists/{list}?type=allow\|block | Delete an adlist |
POST | /api/lists:batchDelete | Batch delete ([{item, type}]) |
Groups (CRUD)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/groups | List groups |
POST | /api/groups | Add one group or several |
GET | /api/groups/{name} | Get a group |
PUT | /api/groups/{name} | Replace, create or rename a group |
DELETE | /api/groups/{name} | Delete a group |
POST | /api/groups:batchDelete | Batch delete ([{item}]) |
Clients (CRUD)
| Method | Endpoint | Description |
|---|---|---|
GET | /api/clients | List clients |
POST | /api/clients | Add one client or several (by IP or subnet) |
GET | /api/clients/{client} | Get a client (by IP or subnet) |
GET | /api/clients/_suggestions | Devices the resolver has seen (count, default 50) |
PUT | /api/clients/{client} | Update or create a client (by IP or subnet) |
DELETE | /api/clients/{client} | Delete a client (by IP or subnet) |
POST | /api/clients:batchDelete | Batch delete ([{item}]) |
Info
| Method | Endpoint | Description |
|---|---|---|
GET | /api/info/client | The caller's address, method and headers. Public |
GET | /api/info/version | Version of each component (core, web, ftl, docker) |
GET | /api/info/ftl | Resolver process info and counts |
GET | /api/info/system | Host uptime, memory (kB), processes and load |
GET | /api/info/host | Kernel uname, device model and DMI identifiers |
GET | /api/info/sensors | Temperature sensors (hwmon) |
GET | /api/info/metrics | DNS cache counters |
GET | /api/info/messages | Diagnosis messages (always empty), also /count and DELETE /{id} |
GET | /api/info/database | Database file and stored query counts |
Network and DHCP
| Method | Endpoint | Description |
|---|---|---|
GET | /api/network/gateway | Default routes with their interface addresses |
GET | /api/network/routes | Routing table |
GET | /api/network/interfaces | Interfaces with their addresses |
GET | /api/network/devices | Devices built from the known clients (max_devices, max_addresses) |
GET | /api/dhcp/leases | Always empty: Ferrous serves no DHCP |
PADD and endpoint list
| Method | Endpoint | Description |
|---|---|---|
GET | /api/padd | One-call summary for PADD (full, default true) |
GET | /api/endpoints | Every documented route by HTTP method |
Actions
| Method | Endpoint | Description |
|---|---|---|
POST | /api/action/gravity | Reload the blocklists, streaming text/plain progress like pihole -g |
POST | /api/action/restartdns | Reload configuration in-memory |
POST | /api/action/flush/logs | Delete every stored query |
See Pi-hole Compatibility for details, the reply shapes that changed in v0.9.23, and the limitations.