Skip to content
WasFor
Back to home
Documentation/Developer API

API overview

WasFor exposes a JSON API for both consoles. The user API operates on the signed-in customer's resources; the admin API operates on the fleet and requires an operator key or an admin session.

Base URLs

SurfaceBase
User APIhttps://<panel-host>/api/user
Admin APIhttps://<panel-host>/api/admin
Licensing APIhttps://api.wasfor.com/v1

All traffic must use HTTPS. Plain HTTP requests are redirected and never accepted for authenticated calls.

Authentication

Interactive sessions receive a JWT signed with HS256.

ClaimMeaning
uidUser identifier
roleuser, admin, support, billing
emailAccount email
verToken version, bumped on password change
issAlways wasfor

Access tokens live for 2 hours. Refresh tokens are rotated on use and bound to the session. A token whose ver no longer matches the account is rejected.

http
Authorization: Bearer <access-token>

Admin automation should use scoped API keys instead of operator credentials:

http
Authorization: Bearer wfk_live_<key>

Request conventions

  • Content-Type: application/json for bodies.
  • Unknown fields are rejected on writes so typos fail loudly.
  • Timestamps are ISO 8601 in UTC.
  • Identifiers are integers unless stated otherwise.
  • Lists accept page (1-based), per_page (max 100), sort and q.
http
GET /api/user/sites?page=2&per_page=25&sort=-created_at

Response envelope

Successful responses wrap the payload:

json
{
  "ok": true,
  "data": { "id": 42, "domain": "app.example.com" },
  "meta": { "page": 1, "per_page": 25, "total": 61 }
}

Errors use a stable shape:

json
{
  "ok": false,
  "error": {
    "code": "validation_failed",
    "message": "memory_limit must be between 64M and 1G",
    "fields": { "memory_limit": "out_of_range" },
    "request_id": "req_01J8Z3K9"
  }
}

Quote request_id in support tickets; it links directly to server logs.

Status codes

CodeMeaning
200Success
201Created
204Deleted, no body
400Malformed request
401Missing or invalid token
403Authenticated but not allowed
404Resource not found in scope
409Conflict, e.g. duplicate domain
422Validation failed
429Rate limited
5xxServer error; retry with backoff

Rate limits

ScopeLimit
Authenticated user600 requests / minute
Admin key1200 requests / minute
Auth endpoints10 attempts / minute per IP

Limits return 429 with Retry-After. Implement exponential backoff with jitter rather than fixed retries.

Pagination and filtering

http
GET /api/admin/users?status=active&package=business&per_page=100

meta.total is the total matching the filter, not the page size. Iterate pages until the returned collection is shorter than per_page.

Idempotency

Write endpoints accept an idempotency key so retries do not create duplicates:

http
POST /api/admin/users
Idempotency-Key: 7c1f9a2e-4b7d-4a1e-9c3f-2f6a8e5d1b40

The same key with the same body returns the original result for 24 hours. A different body with the same key returns 409.

Versioning

The API is versioned in the path. Additive fields may appear within a version; clients must ignore unknown keys. Breaking changes ship under a new version with an overlap period.

Quick example

bash
TOKEN="<access-token>"

curl -s https://panel.example.com/api/user/sites \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"

Continue with the User API and Admin API references.

Last updated: 2026-12-01