Served Prefixes API

This endpoint returns every prefix currently served by the OpenCache fleet — the union of networks[] from every appliance snapshot, with duplicates removed. Content providers use it to map their traffic-steering platforms onto the prefixes OpenCache will actually answer.

Appliances publish a snapshot on change, or at least hourly. By default the list is supernetted — adjacent and covered prefixes are collapsed into the smallest covering set (10.0.0.0/24 + 10.0.1.0/24 → 10.0.0.0/23), which covers exactly the same address space with far fewer entries. Pass supernet=false for the raw serving set exactly as announced (no /24 normalisation, no aggregation). A successful call returns immediately with the full set; there is no pagination.

Signed in to PF Console? The Try it panel below runs the same call live against your session. It hits the console API (/opencache/prefixes), which is the counterpart of https://baas.p.foundation/opencache/v1.1/.

Authentication

Every call needs a Directus Bearer token:

text
Authorization: Bearer <token>

A service account is fully supported. The token must belong to a user that holds OpenCache/Prefixes: Read directly — role-derived grants, including administrator, do not count. Project membership is not required: this is a fleet-wide read, not scoped to a workspace.

The public base URL used in this guide is https://baas.p.foundation/opencache/v1.1/.

Version

The public OpenCache API is versioned in the path.

VersionBase URLStatus
v1https://baas.p.foundation/opencache/v1/Stable
v1.1https://baas.p.foundation/opencache/v1.1/Rolling Release (beta)

This guide documents v1.1. Treat it as a preview — paths and fields may still change before it is marked stable. Use v1 for production integrations that need a frozen contract.

Required permissions

EndpointMust hold
GET /prefixesOpenCache/Prefixes: Read

Ask your P Foundation contact (or a console admin with Users: Write) to assign the policy directly to the service-account user. Grant sparingly — holders see every tenant's serving footprint, not just appliances their projects own.

Prefixes — GET /prefixes

Returns the deduplicated, numerically sorted list of prefixes the fleet currently serves — supernetted by default.

No request body.

Query parameters

ParamTypeDefaultNotes
supernetbooleantruetrue/1 or false/0. When true, adjacent and covered prefixes are collapsed; when false, prefixes are returned exactly as announced. Added in v1.1

Response fields

FieldTypeNotes
prefixesstring[]Deduplicated CIDRs. IPv4 before IPv6; less-specific before more-specific
totalPrefixesnumberprefixes.length
appliances.totalnumberAppliance snapshot rows found
appliances.reportingnumberRows whose snapshot includes a networks array (a never-reported appliance stores {})
lastUpdatedstring | nullMost recent snapshot write time (server clock), ISO-8601
supernettedbooleanWhether the returned list was collapsed (supernet echoed back)

Example

curl --request GET \
  --url https://baas.p.foundation/opencache/v1.1/prefixes \
  --header 'Authorization: Bearer $TOKEN'

Success (200)

json
{
  "code": 200,
  "serverErrorCode": null,
  "message": "Prefixes",
  "data": {
    "prefixes": ["1.2.3.0/24", "10.0.0.0/8", "2001:db8::/32"],
    "totalPrefixes": 3,
    "appliances": { "total": 12, "reporting": 11 },
    "lastUpdated": "2026-08-20T11:04:00.000Z",
    "supernetted": true
  }
}

The payload can be large (tens of thousands of prefixes). Poll on the order of minutes, not seconds — the serving set changes when BGP does, not per request.

Errors

HTTPserverErrorCodeWhen
400VALIDATION_FAILEDsupernet is not true/1/false/0
401UNAUTHORIZEDMissing or invalid Bearer token
403FORBIDDENToken is valid but the user does not hold the Read policy directly
500INTERNAL_SERVER_ERRORSnapshot scan failed
json
{
  "code": 403,
  "serverErrorCode": "FORBIDDEN",
  "message": "OpenCache/Prefixes: Read policy required",
  "data": null
}