Information
- License: Source First License 1.1
- OpenAPI version:
3.1.0
Control plane REST API for opdns profiles, accounts and tokens.
The dashboard is the first client. The API has no private endpoints.
Operator (admin) routes are not part of this API. They are a separate API on an
internal host, and every former /v1/admin path answers 404 here.
Authentication: a session cookie or an API token. The sign-in callback
GET /v1/auth/oidc/callback sets the session cookie __Host-opdns_session after you
sign in with an op account at opauth. A plain-HTTP dev server cannot use the
__Host- prefix, so it sets opdns_session. You send an API token as
Authorization: Bearer opdns_.... Tokens carry scopes (profiles:read,
profiles:write, nodes:write, account:read, billing:read, logs:read,
analytics:read). The x-opdns-scopes of the bearer scheme describes them.
Sessions have every scope. The security of each operation names the one scope
that a token needs for it (bearer: [scope]). An operation without bearer
accepts a session only (403 session_required for a token). A token without the
scope gets 403 insufficient_scope, and its required_scope names the scope. The
API rejects cookie-authenticated writes from another origin, unless the origin is
an allowed dashboard origin.
CORS: the three public signup surfaces (/v1/auth/signup-mode, /v1/waitlist,
/v1/waitlist/confirm) allow exact configured origins, and only the method and
Content-Type of their route. Eligible preflights answer 204. A rejected origin,
method or header answers 403. Actual responses name the origin and allow credentials.
For an allowed dashboard origin, other /v1 routes add Access-Control-Expose-Headers:
ETag, Retry-After, X-Request-Id, Content-Disposition, Location. Their preflights
answer 204 without authentication. Origins that are not allowed get no CORS headers.
Responses vary on Origin on those routes, and on signup surfaces when Origin is present.
Errors are RFC 9457 problem documents (application/problem+json) with a stable
machine code.
Profile writes are optimistic. Every profile resource returns an ETag that holds
the profile version, and writes accept If-Match with it (412 on mismatch).
Every write increments the version and publishes the full profile document to the edge.
Unauthenticated routes are rate limited per client IP (429 with Retry-After).
Requests with an API token are limited per organization, across every token of
its members and every server, to the api_requests_per_minute of the plan
(GET /v1/account/plan), in fixed one-minute windows. Every response to a token
carries RateLimit-Limit (the requests per window of the plan),
RateLimit-Remaining (the requests left in this window) and RateLimit-Reset (the
seconds until the window resets), as in the IETF RateLimit header fields draft. It
also carries RateLimit-Policy (<limit>;w=60). Past the limit, the answer is 429
rate_limited with Retry-After (the same seconds as RateLimit-Reset).
Dashboard sessions do not count.
Lists use cursor pagination: limit (default 50, at most 200) and cursor (the
opaque next_cursor of the previous page). next_cursor is null on the last
page. The order is stable, so the API never repeats or skips rows that were created
between pages before the cursor. A modified cursor gets 400 invalid_cursor.
POSTs that create something accept an Idempotency-Key header. If you repeat the
same request with the same key within 24 h, the API replays the first (2xx)
response with Idempotent-Replayed: true and does not create the resource again.
The same key with a different request gets 409 idempotency_key_reused. A repeat
while the first request still runs gets 409 idempotency_in_progress. Keys are per
account.
Sessions last at most 30 days from sign-in and end after 7 days without
use. The first request more than 24 h after the API issued the session token gets
a new token in Set-Cookie. The previous token stays valid for a few seconds.
Sign-in: opdns signs everyone in through opauth, the op account
(account.opauth.net), with OIDC. The op account handles credentials, verification,
recovery and address changes. API token creation, node creation, exports and
account deletion need a sign-in at opauth within the last five minutes
(reauth_required). In that case, the dashboard signs in again with
prompt=login. Emailed links point at the dashboard. A one-time token travels in
the URL fragment, which browsers never send to a server. The dashboard asks before
it submits the token, so a link that a mail scanner opens changes nothing. The API
deletes an account that is still unverified seven days after its first sign-in.
Versioning. Every route is under /v1. Before the public beta, the API
changes as the product does. Endpoints and fields are added, changed, renamed and
removed without a deprecation period. The dashboard and the clients of opdns
change with them in the same release. info.version is the version of this
document. It changes with every change to the document: minor for any change to
the contract (removals included), and patch for wording. Every response carries it
in the X-Opdns-Api-Version header (also api_version in GET /v1/meta). The API
changelog says what changed in each version. Clients must ignore response fields
that they do not know, and treat an enum value that they do not know as “other”.
The session cookie that sign-in sets. On a dev server over plain HTTP, browsers
refuse the __Host- prefix, so the cookie is named opdns_session.
Security scheme type: apiKey
Cookie parameter name: __Host-opdns_session
API token (opdns_...) with scopes. An operation names the one scope that a
token needs in its security (bearer: [scope]). x-opdns-scopes lists
every scope that a token can carry.
Security scheme type: http
The node token (opdnsnode_...) from POST /v1/nodes/enrol, for the endpoints that nodes call.
Security scheme type: http