openapi: 3.1.0 info: title: wPanel API version: 1.0.0 summary: Webyne multi-tenant hosting business OS — control-plane API. description: | Versioned REST contract for wPanel v1.0. This document is generated from, and must stay in sync with, `docs/api-contract.md` (endpoint list and conventions) and `server/internal/migrate/sql/*.sql` (row shapes — JSON field names are the snake_case column names). ## Conventions - Base path `/v1`, JSON only (`application/json; charset=utf-8`), UUID identifiers, RFC 3339 UTC timestamps. - Money is always an integer amount in **minor units** (`*_minor`, int64) plus an ISO-4217 `currency`. - **Lists** return `{"data": [...], "next_cursor": "" | null}`; page with `?limit=` (1–200, default 50) and `?cursor=`. - **Objects** return the row object directly (no envelope). - **Errors** return `{"error": {"code", "message", "request_id"}}` (see `Error`). Ids belonging to another tenant return `404 not_found`, never `403`, so tenant existence cannot be probed. - **Async:** mutations that touch infrastructure return **202** with `JobAccepted`; poll `GET /v1/jobs/{id}`. - **Idempotency:** `Idempotency-Key` is honoured on `POST /v1/orders`, `POST /v1/hosting-accounts` and is **required** on every `/v1/external/*` mutation. A replay with the same key and same body returns the original response; the same key with a different body returns `409 conflict`. - **Active organization:** `X-Org-ID` selects which membership (or which org inside the caller's subtree) the call acts in. Default is the caller's first membership. ## Authentication - **Browser:** `POST /v1/auth/login` sets `wp_session` (HttpOnly, Secure, SameSite=Lax) and `wp_csrf` (readable) cookies. Every mutating browser request (POST/PUT/PATCH/DELETE) must echo the cookie in `X-CSRF-Token`. - **API clients:** `Authorization: Bearer ` (from login) or `Authorization: Bearer wpk_` (scoped API key). Bearer callers do not send CSRF tokens. - **Node agents:** mutual TLS with a short-lived node certificate (simulated in dev with `X-Node-Credential`). - **Payment webhooks:** no wPanel auth; authenticated by provider signature (e.g. `X-Razorpay-Signature`). ## Roles `platform_admin, platform_support, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator`. Authorization is always enforced server-side (RBAC + organization subtree + PostgreSQL row-level security as defence in depth). Each operation lists its permitted roles in `x-roles`. contact: name: Webyne Engineering email: engineering@webyne.com license: name: Proprietary identifier: LicenseRef-Webyne-Proprietary servers: - url: https://api.wpanel.webyne.com description: Production control plane - url: https://api.staging.wpanel.webyne.com description: Staging - url: http://localhost:8080 description: Local development (deploy/docker-compose.yml) security: - cookieSession: [] csrfToken: [] - bearerJwt: [] - apiKey: [] tags: - { name: Support, description: Customer support tickets with SLA } - { name: Settings, description: 'Provider settings - support policy, notification templates, merchant accounts' } - { name: Exports, description: Tenant-scoped data exports } - { name: Auth, description: 'Login, MFA, sessions, OIDC discovery' } - { name: Organizations, description: Provider / reseller hierarchy and memberships } - { name: Support Access, description: 'Time-limited, reason-coded, audited platform support grants' } - { name: API Keys, description: 'Scoped `wpk_` API keys' } - { name: White-label, description: 'Brands, custom domains, public brand resolution' } - { name: Infrastructure, description: 'Regions, clusters, nodes, capacity (platform admin)' } - { name: Ops, description: 'Reconciliation, SLO overview, alerts, health and metrics' } - { name: Pools & Plans, description: 'Resource pools, allocations, versioned plans' } - { name: Customers, description: End customers of a provider or reseller } - { name: Hosting, description: Hosting account lifecycle } - { name: Sites, description: 'Websites, files, cron, logs, WordPress, staging' } - { name: Databases, description: Customer databases and imports } - { name: DNS, description: 'Domains, zones and records' } - { name: Certificates, description: ACME TLS certificates } - { name: Mail, description: 'Mailboxes, aliases, forwards, mail auth records, queue' } - { name: Backups, description: Backups and restores } - { name: Migrations, description: cPanel / WHM imports } - { name: Jobs, description: Asynchronous job status } - { name: Events & Webhooks, description: 'Tenant events, outbound signed webhooks, replay' } - { name: Audit, description: Append-only audit log } - { name: Storefront, description: Public catalog and signup } - { name: Catalog, description: 'Products, prices, coupons' } - { name: Orders, description: 'Carts, orders, checkout' } - { name: Payments, description: 'Payment provider webhooks, refunds, simulated provider' } - { name: Billing, description: 'Subscriptions, invoices, credit notes, ledger, wallet, tax profiles' } - { name: External Billing, description: WHMCS-compatible provisioning adapter (API-key auth) } - { name: Decisions, description: Open decisions registry (spec §9) } - { name: Node Agent, description: 'Node agent enrollment, polling and reports (mTLS)' } paths: # --------------------------------------------------------------------------- # Auth & identity # --------------------------------------------------------------------------- /v1/auth/login: post: tags: [Auth] operationId: login summary: Password login description: | On success sets `wp_session` and `wp_csrf` cookies and returns a JWT `access_token`. If the user has MFA enabled (mandatory for platform_* and *_owner roles) returns `{mfa_required: true, mfa_token}` instead; complete with `POST /v1/auth/mfa/verify`. Rate limited per IP and per account; repeated failures lock the account. security: [] x-roles: [anonymous] requestBody: required: true content: application/json: schema: type: object required: [email, password] properties: email: { type: string, format: email } password: { type: string, format: password, minLength: 1, maxLength: 256 } example: { email: owner@acmehost.test, password: "Provider#2026" } responses: '200': description: Logged in, or MFA challenge required headers: Set-Cookie: description: '`wp_session=; HttpOnly; Secure; SameSite=Lax; Path=/` and `wp_csrf=; Secure; SameSite=Lax; Path=/`' schema: { type: string } content: application/json: schema: oneOf: - $ref: '#/components/schemas/LoginSuccess' - $ref: '#/components/schemas/MfaChallenge' '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } '429': { $ref: '#/components/responses/RateLimited' } /v1/auth/mfa/verify: post: tags: [Auth] operationId: verifyMfa summary: Complete an MFA challenge with a TOTP code security: [] x-roles: [anonymous] requestBody: required: true content: application/json: schema: type: object required: [mfa_token, code] properties: mfa_token: { type: string } code: { type: string, pattern: '^[0-9]{6}$' } responses: '200': description: Logged in (same as successful login) content: application/json: schema: { $ref: '#/components/schemas/LoginSuccess' } '401': { $ref: '#/components/responses/Unauthenticated' } '429': { $ref: '#/components/responses/RateLimited' } /v1/auth/mfa/enroll: post: tags: [Auth] operationId: enrollMfa summary: Start TOTP enrollment for the current user x-roles: [any-authenticated] responses: '200': description: Enrollment secret (shown once; stored encrypted) content: application/json: schema: type: object required: [secret, otpauth_url] properties: secret: { type: string, description: Base32 TOTP secret } otpauth_url: { type: string, examples: ['otpauth://totp/wPanel:admin@wpanel.test?secret=...&issuer=wPanel'] } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/auth/mfa/activate: post: tags: [Auth] operationId: activateMfa summary: Confirm TOTP enrollment with a first valid code x-roles: [any-authenticated] requestBody: required: true content: application/json: schema: type: object required: [code] properties: code: { type: string, pattern: '^[0-9]{6}$' } responses: '200': description: MFA enabled content: application/json: schema: type: object properties: mfa_enabled: { type: boolean, const: true } '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } /v1/auth/logout: post: tags: [Auth] operationId: logout summary: Revoke the current session x-roles: [any-authenticated] responses: '204': { description: Session revoked; cookies cleared } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/me: get: tags: [Auth] operationId: getMe summary: Current user, memberships, active org and effective permissions x-roles: [any-authenticated] parameters: - $ref: '#/components/parameters/OrgId' responses: '200': description: Current identity content: application/json: schema: { $ref: '#/components/schemas/Me' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/auth/sessions: get: tags: [Auth] operationId: listSessions summary: List own sessions x-roles: [any-authenticated] parameters: - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Sessions content: application/json: schema: { $ref: '#/components/schemas/SessionList' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/auth/sessions/revoke: post: tags: [Auth] operationId: revokeSessions summary: Revoke one session or all own sessions x-roles: [any-authenticated] requestBody: required: true content: application/json: schema: oneOf: - type: object required: [session_id] properties: session_id: { $ref: '#/components/schemas/Uuid' } - type: object required: [all] properties: all: { type: boolean, const: true } responses: '200': description: Number of sessions revoked content: application/json: schema: type: object properties: revoked: { type: integer, minimum: 0 } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /.well-known/openid-configuration: get: tags: [Auth] operationId: openidConfiguration summary: OIDC discovery document (simulated issuer) security: [] x-roles: [anonymous] responses: '200': description: OIDC provider metadata content: application/json: schema: type: object required: [issuer, jwks_uri] properties: issuer: { type: string, format: uri } jwks_uri: { type: string, format: uri } authorization_endpoint: { type: string, format: uri } token_endpoint: { type: string, format: uri } id_token_signing_alg_values_supported: { type: array, items: { type: string } } subject_types_supported: { type: array, items: { type: string } } response_types_supported: { type: array, items: { type: string } } additionalProperties: true /v1/auth/jwks: get: tags: [Auth] operationId: getJwks summary: JSON Web Key Set used to verify access tokens security: [] x-roles: [anonymous] responses: '200': description: JWKS content: application/json: schema: type: object required: [keys] properties: keys: type: array items: type: object required: [kty, kid] properties: kty: { type: string } kid: { type: string } use: { type: string } alg: { type: string } crv: { type: string } x: { type: string } y: { type: string } n: { type: string } e: { type: string } # --------------------------------------------------------------------------- # Organizations, members, support access, API keys # --------------------------------------------------------------------------- /v1/organizations: get: tags: [Organizations] operationId: listOrganizations summary: List organizations in the caller's subtree x-roles: [platform_admin, platform_support, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' - { name: type, in: query, schema: { $ref: '#/components/schemas/OrgType' } } - { name: parent_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } responses: '200': description: Organizations content: application/json: schema: { $ref: '#/components/schemas/OrganizationList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Organizations] operationId: createOrganization summary: Create a provider (platform only) or reseller organization description: | Providers must be children of the platform org; resellers children of a provider or (if depth allows) a reseller. Reseller depth is enforced against the parent chain's `reseller_depth_limit` (default 1) → `422 validation`. x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/OrganizationCreate' } example: { name: BharatWeb, slug: bharatweb, type: reseller, parent_id: 6f1c2a8e-3d55-4c1e-9d38-2a1f4b7c9e10 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Organization' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/organizations/{id}: get: tags: [Organizations] operationId: getOrganization summary: Get an organization x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Organization content: application/json: schema: { $ref: '#/components/schemas/Organization' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/organizations/{id}/status: post: tags: [Organizations] operationId: setOrganizationStatus summary: Suspend, reactivate or close an organization (cascades to its subtree's services via jobs) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [status, reason] properties: status: { type: string, enum: [active, suspended, closed] } reason: { type: string, minLength: 3, maxLength: 500 } responses: '200': description: Updated organization content: application/json: schema: { $ref: '#/components/schemas/Organization' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/organizations/{id}/members: get: tags: [Organizations] operationId: listMembers summary: List memberships of an organization x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Memberships content: application/json: schema: { $ref: '#/components/schemas/MembershipList' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Organizations] operationId: addMember summary: Invite a staff member or customer collaborator description: | Callers can only grant roles at or below their own level within the same org type. `customer_owner` may add `customer_collaborator` memberships for its own `customer_id` with `scopes` such as `sites:read`, `files:write`, `dns:write`. x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [email, name, role] properties: email: { type: string, format: email } name: { type: string, minLength: 1, maxLength: 200 } role: { $ref: '#/components/schemas/Role' } customer_id: { $ref: '#/components/schemas/Uuid', description: Required for customer_* roles } scopes: { type: array, items: { $ref: '#/components/schemas/Scope' } } responses: '201': description: Membership created (invitation email sent if the user is new) content: application/json: schema: { $ref: '#/components/schemas/Membership' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/support-access: get: tags: [Support Access] operationId: listSupportAccess summary: List support access grants description: Platform staff see all grants; tenant owners see grants targeting their subtree. x-roles: [platform_admin, platform_support, provider_owner, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' - { name: active, in: query, schema: { type: boolean } } responses: '200': description: Grants content: application/json: schema: { $ref: '#/components/schemas/SupportAccessGrantList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Support Access] operationId: createSupportAccess summary: Open a time-limited, reason-coded support grant into a tenant (platform only, max 240 minutes) x-roles: [platform_admin, platform_support] requestBody: required: true content: application/json: schema: type: object required: [org_id, reason_code, reason, duration_minutes] properties: org_id: { $ref: '#/components/schemas/Uuid' } reason_code: { type: string, enum: [incident, customer_request, abuse, billing_dispute, migration_assist] } reason: { type: string, minLength: 10, maxLength: 1000 } ticket_ref: { type: string, maxLength: 100 } duration_minutes: { type: integer, minimum: 1, maximum: 240 } responses: '201': description: Grant created (audited; tenant owner notified) content: application/json: schema: { $ref: '#/components/schemas/SupportAccessGrant' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '422': { $ref: '#/components/responses/Validation' } /v1/support-access/{id}/revoke: post: tags: [Support Access] operationId: revokeSupportAccess summary: Revoke a support grant early x-roles: [platform_admin, platform_support, provider_owner, reseller_owner] parameters: - $ref: '#/components/parameters/IdPath' responses: '200': description: Revoked grant content: application/json: schema: { $ref: '#/components/schemas/SupportAccessGrant' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/api-keys: get: tags: [API Keys] operationId: listApiKeys summary: List API keys of the active org (prefix only, never the secret) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: API keys content: application/json: schema: { $ref: '#/components/schemas/ApiKeyList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [API Keys] operationId: createApiKey summary: Create a scoped API key (the `key` is returned once) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name, scopes] properties: name: { type: string, minLength: 1, maxLength: 100 } scopes: { type: array, minItems: 1, items: { $ref: '#/components/schemas/Scope' } } example: { name: WHMCS production, scopes: ['external:write', 'hosting:read', 'usage:read'] } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/ApiKeyCreated' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # White-label # --------------------------------------------------------------------------- /v1/brands: get: tags: [White-label] operationId: listBrands summary: List brands of the active org x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Brands content: application/json: schema: { $ref: '#/components/schemas/BrandList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [White-label] operationId: createBrand summary: Create a brand x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/BrandInput' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Brand' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '422': { $ref: '#/components/responses/Validation' } /v1/brands/{id}: patch: tags: [White-label] operationId: updateBrand summary: Partially update a brand (abuse_contact / security_disclosure cannot be blanked) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/BrandPatch' } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/Brand' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/brands/{id}/domains: get: tags: [White-label] operationId: listBrandDomains summary: List custom hostnames bound to a brand x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Brand domains content: application/json: schema: { $ref: '#/components/schemas/BrandDomainList' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [White-label] operationId: addBrandDomain summary: Request a custom hostname; returns the TXT record to publish x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [hostname] properties: hostname: { $ref: '#/components/schemas/Hostname' } example: { hostname: billing.acmehost.in } responses: '201': description: Pending verification content: application/json: schema: { $ref: '#/components/schemas/BrandDomain' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/brand-domains/{id}/verify: post: tags: [White-label] operationId: verifyBrandDomain summary: Verify the TXT record, issue TLS, then activate the hostname x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } /v1/brand-domains/{id}: delete: tags: [White-label] operationId: removeBrandDomain summary: Unbind a hostname (row kept as tombstone with status `removed` for takeover prevention) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Tombstoned binding content: application/json: schema: { $ref: '#/components/schemas/BrandDomain' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/public/brand: get: tags: [White-label] operationId: resolvePublicBrand summary: Resolve the brand for a hostname (public; mandatory disclosures always included) security: [] x-roles: [anonymous] parameters: - { name: host, in: query, description: 'Overrides the `Host` header (dev / preview)', schema: { $ref: '#/components/schemas/Hostname' } } - { name: brand, in: query, description: 'Brand slug shortcut for demos (e.g. `acme`)', schema: { type: string } } responses: '200': description: Public brand profile content: application/json: schema: { $ref: '#/components/schemas/PublicBrand' } '404': { $ref: '#/components/responses/NotFound' } # --------------------------------------------------------------------------- # Infrastructure (platform admin) # --------------------------------------------------------------------------- /v1/regions: get: tags: [Infrastructure] operationId: listRegions summary: List regions description: All authenticated roles can list active regions (needed for ordering); platform roles also see drained/disabled. x-roles: [any-authenticated] parameters: - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Regions content: application/json: schema: { $ref: '#/components/schemas/RegionList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Infrastructure] operationId: createRegion summary: Create a region x-roles: [platform_admin] requestBody: required: true content: application/json: schema: type: object required: [code, name, country] properties: code: { type: string, pattern: '^[a-z]{2}-[a-z]{3}-[0-9]+$', examples: [in-mum-1] } name: { type: string } country: { type: string, pattern: '^[A-Z]{2}$' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Region' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/clusters: get: tags: [Infrastructure] operationId: listClusters summary: List clusters x-roles: [platform_admin, platform_support] parameters: - { name: region_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Clusters content: application/json: schema: { $ref: '#/components/schemas/ClusterList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Infrastructure] operationId: createCluster summary: Create a cluster x-roles: [platform_admin] requestBody: required: true content: application/json: schema: type: object required: [region_id, name, role] properties: region_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } role: { type: string, enum: [web, mail, dns, db, backup] } storage_profile: { type: string, enum: [ceph, local_nvme], default: ceph } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Cluster' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/nodes: get: tags: [Infrastructure] operationId: listNodes summary: List nodes with health, capacity, allocated and observed usage x-roles: [platform_admin, platform_support] parameters: - { name: cluster_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - { name: status, in: query, schema: { $ref: '#/components/schemas/NodeStatus' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Nodes content: application/json: schema: { $ref: '#/components/schemas/NodeList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Infrastructure] operationId: registerNode summary: Register a node (status `provisioning` until the agent enrolls) description: Returns the node plus a single-use `enrollment_token` (60 min) consumed by `POST /v1/agent/enroll`. x-roles: [platform_admin] requestBody: required: true content: application/json: schema: type: object required: [cluster_id, hostname, ip_address, capacity] properties: cluster_id: { $ref: '#/components/schemas/Uuid' } hostname: { $ref: '#/components/schemas/Hostname' } ip_address: { type: string, oneOf: [{ format: ipv4 }, { format: ipv6 }] } kind: { type: string, enum: [vm, baremetal], default: vm } os: { type: string, default: almalinux-9 } capacity: { $ref: '#/components/schemas/NodeCapacity' } labels: { type: object, additionalProperties: { type: string } } responses: '201': description: Registered content: application/json: schema: allOf: - $ref: '#/components/schemas/Node' - type: object properties: enrollment_token: { type: string, description: Shown once; single use; expires after 60 minutes } enrollment_expires_at: { $ref: '#/components/schemas/Timestamp' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/nodes/{id}/actions: post: tags: [Infrastructure] operationId: nodeAction summary: Drain, put into maintenance, activate or retire a node description: '`drain` stops new placements and schedules migrations; `retire` is refused while accounts remain (409).' x-roles: [platform_admin] parameters: - $ref: '#/components/parameters/IdPath' requestBody: required: true content: application/json: schema: type: object required: [action] properties: action: { type: string, enum: [drain, maintenance, activate, retire] } reason: { type: string } responses: '200': description: Updated node content: application/json: schema: { $ref: '#/components/schemas/Node' } '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } /v1/capacity: get: tags: [Infrastructure] operationId: getCapacity summary: Per-region / per-cluster capacity, allocated and observed totals x-roles: [platform_admin, platform_support] parameters: - { name: region_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } responses: '200': description: Capacity summary content: application/json: schema: { $ref: '#/components/schemas/CapacitySummary' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } # --------------------------------------------------------------------------- # Ops # --------------------------------------------------------------------------- /v1/ops/reconcile: post: tags: [Ops] operationId: reconcile summary: Run desired-vs-observed reconciliation (non-destructive; drift that would delete data goes to manual_review) x-roles: [platform_admin] requestBody: required: false content: application/json: schema: type: object properties: node_id: { $ref: '#/components/schemas/Uuid' } region_id: { $ref: '#/components/schemas/Uuid' } dry_run: { type: boolean, default: false } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } /v1/ops/overview: get: tags: [Ops] operationId: opsOverview summary: SLO status, metrics summary and active alerts x-roles: [platform_admin, platform_support] responses: '200': description: Overview content: application/json: schema: { $ref: '#/components/schemas/OpsOverview' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } /v1/ops/alerts: get: tags: [Ops] operationId: listAlerts summary: Active alerts (mirrors Alertmanager rules in deploy/monitoring/alerts.yml) x-roles: [platform_admin, platform_support] parameters: - { name: severity, in: query, schema: { type: string, enum: [critical, warning, info] } } responses: '200': description: Alerts content: application/json: schema: type: object required: [data] properties: data: { type: array, items: { $ref: '#/components/schemas/Alert' } } next_cursor: { type: [string, 'null'] } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } /healthz: get: tags: [Ops] operationId: healthz summary: Liveness probe security: [] x-roles: [anonymous] responses: '200': description: Process is alive content: application/json: schema: { type: object, properties: { status: { type: string, const: ok } } } /readyz: get: tags: [Ops] operationId: readyz summary: Readiness probe (database and Redis reachable, migrations applied) security: [] x-roles: [anonymous] responses: '200': description: Ready content: application/json: schema: { $ref: '#/components/schemas/Readiness' } '503': description: Not ready content: application/json: schema: { $ref: '#/components/schemas/Readiness' } /metrics: get: tags: [Ops] operationId: metrics summary: Prometheus metrics (text exposition format); restrict to the monitoring network security: [] x-roles: [anonymous] responses: '200': description: | Exposes `wpanel_http_requests_total{method,route,status}`, `wpanel_http_request_duration_seconds{route}` (histogram), `wpanel_jobs_total{kind,status}`, `wpanel_job_duration_seconds{kind}` (histogram), `wpanel_jobs_queued`, `wpanel_outbox_lag_seconds`, `wpanel_node_up{node}`, `wpanel_node_capacity_used_ratio{node,resource}`, `wpanel_payment_failures_total{provider}`, `wpanel_mail_queue_size{node}`, `wpanel_certificate_expiry_seconds{common_name}`, `wpanel_backup_age_seconds{account}`, `wpanel_tenant_errors_total{org}`. content: text/plain: schema: { type: string } # --------------------------------------------------------------------------- # Pools & plans # --------------------------------------------------------------------------- /v1/pools: get: tags: [Pools & Plans] operationId: listPools summary: List resource pools of the active org (and its subtree for providers) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Pools content: application/json: schema: { $ref: '#/components/schemas/ResourcePoolList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Pools & Plans] operationId: createPool summary: Create a root resource pool (platform grants wholesale capacity to a provider) description: '`oversell_ratio` > 1.00 requires an approved policy (decision `shared_hosting_isolation` / platform admin).' x-roles: [platform_admin, provider_owner, provider_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name, region_id, limits] properties: name: { type: string } region_id: { $ref: '#/components/schemas/Uuid' } limits: { $ref: '#/components/schemas/Limits' } oversell_ratio: { type: number, minimum: 1, maximum: 4, default: 1 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/ResourcePool' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/pools/{id}: get: tags: [Pools & Plans] operationId: getPool summary: Get a pool including `reserved` and `available` x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Pool content: application/json: schema: { $ref: '#/components/schemas/ResourcePool' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/pools/{id}/allocations: post: tags: [Pools & Plans] operationId: allocateFromPool summary: Delegate capacity to a child org (transactional reservation; optionally creates the child's pool) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [child_org_id, limits] properties: child_org_id: { $ref: '#/components/schemas/Uuid' } limits: { $ref: '#/components/schemas/Limits' } create_child_pool: { type: boolean, default: true } child_pool_name: { type: string } example: child_org_id: 0b8a6f0e-7f0c-4d53-8a2a-4f3e2c1d9b77 limits: { cpu_millicores: 8000, memory_mb: 16384, storage_gb: 200, bandwidth_gb: 2000, inodes: 2000000, databases: 100, mailboxes: 500, sites: 100 } create_child_pool: true child_pool_name: BharatWeb Mumbai responses: '201': description: Allocation (and child pool when requested) content: application/json: schema: { $ref: '#/components/schemas/AllocationResult' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/plans: get: tags: [Pools & Plans] operationId: listPlans summary: List plans (own, plus wholesale plans of ancestors usable for resale) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - { name: kind, in: query, schema: { type: string, enum: [wholesale, retail] } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Plans content: application/json: schema: { $ref: '#/components/schemas/PlanList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Pools & Plans] operationId: createPlan summary: Create a plan and its immutable version 1 x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [code, name, limits] properties: code: { type: string, pattern: '^[a-z0-9][a-z0-9-]{1,62}$' } name: { type: string } kind: { type: string, enum: [wholesale, retail], default: retail } limits: { $ref: '#/components/schemas/Limits' } features: { $ref: '#/components/schemas/PlanFeatures' } isolation: { type: string, enum: [standard, hardened], default: standard } responses: '201': description: Plan with `versions` (one element) content: application/json: schema: { $ref: '#/components/schemas/Plan' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/plans/{id}: get: tags: [Pools & Plans] operationId: getPlan summary: Get a plan including all versions x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Plan content: application/json: schema: { $ref: '#/components/schemas/Plan' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/plans/{id}/versions: post: tags: [Pools & Plans] operationId: createPlanVersion summary: Publish a new immutable plan version (existing subscriptions keep their version) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [limits] properties: limits: { $ref: '#/components/schemas/Limits' } features: { $ref: '#/components/schemas/PlanFeatures' } isolation: { type: string, enum: [standard, hardened] } responses: '201': description: New version content: application/json: schema: { $ref: '#/components/schemas/PlanVersion' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/hosting-accounts/{id}/migrate-plan: post: tags: [Pools & Plans] operationId: migrateAccountPlan summary: Explicitly migrate a hosting account to another plan version (re-reserves capacity) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [plan_version_id] properties: plan_version_id: { $ref: '#/components/schemas/Uuid' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # Customers & hosting # --------------------------------------------------------------------------- /v1/customers: get: tags: [Customers] operationId: listCustomers summary: List customers in the active org subtree x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - { name: q, in: query, description: Search by name or email, schema: { type: string } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Customers content: application/json: schema: { $ref: '#/components/schemas/CustomerList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Customers] operationId: createCustomer summary: Create a customer (optionally with a customer_owner login) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name, email] properties: name: { type: string } email: { type: string, format: email } company: { type: string } gstin: { $ref: '#/components/schemas/Gstin' } state_code: { $ref: '#/components/schemas/StateCode' } billing_address: { $ref: '#/components/schemas/Address' } create_login: { type: boolean, default: false } password: { type: string, format: password, minLength: 10, description: Required when create_login is true } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Customer' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/customers/{id}: get: tags: [Customers] operationId: getCustomer summary: Get a customer x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Customer content: application/json: schema: { $ref: '#/components/schemas/Customer' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/hosting-accounts: get: tags: [Hosting] operationId: listHostingAccounts summary: List hosting accounts (customers see only their own) x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - { name: customer_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - { name: status, in: query, schema: { $ref: '#/components/schemas/HostingAccountStatus' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Hosting accounts content: application/json: schema: { $ref: '#/components/schemas/HostingAccountList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Hosting] operationId: createHostingAccount summary: Provision a hosting account description: | Validates ownership (customer, plan version, pool) and capacity, atomically reserves pool and node capacity, and enqueues a provisioning saga (account → runtime → DNS → TLS → health check → active). Transient failures retry with backoff; exhausted retries compensate (release reservations) and move to `manual_review`. x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: type: object required: [customer_id, plan_version_id, region_code, domain] properties: customer_id: { $ref: '#/components/schemas/Uuid' } plan_version_id: { $ref: '#/components/schemas/Uuid' } pool_id: { $ref: '#/components/schemas/Uuid', description: Defaults to the org's pool in the region } region_code: { type: string, examples: [in-mum-1] } domain: { $ref: '#/components/schemas/Hostname' } example: { customer_id: 3d0f6a8c-1b2e-4c5d-8e9f-0a1b2c3d4e5f, plan_version_id: 9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d, region_code: in-mum-1, domain: priya-designs.in } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: '`insufficient_capacity`, or `conflict` (domain taken / idempotency key reused with a different body)' content: application/json: schema: { $ref: '#/components/schemas/Error' } '422': { $ref: '#/components/responses/Validation' } /v1/hosting-accounts/{id}: get: tags: [Hosting] operationId: getHostingAccount summary: Get a hosting account x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Hosting account content: application/json: schema: { $ref: '#/components/schemas/HostingAccount' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/accounts/{id}/actions: post: tags: [Hosting] operationId: hostingAccountAction summary: Lifecycle action on a hosting account description: | - `suspend` params `{web, mail, data, reason}` — each access dimension independently. - `unsuspend` params `{}` (or the same booleans to lift selectively). - `resize` params `{plan_version_id}`. - `terminate` params `{confirm_username, retention_days}` — `confirm_username` must equal the account username; capacity is released only after verified cleanup. - `backup` params `{kind}`; `restore` params `{backup_id, target}`; `migrate` params `{target_node_id?, region_code?}`. x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/AccountActionRequest' } examples: suspend: { value: { action: suspend, params: { web: true, mail: false, data: false, reason: Unpaid invoice INV-2026-000123 } } } terminate: { value: { action: terminate, params: { confirm_username: wp7f3a2c, retention_days: 14 } } } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # Sites # --------------------------------------------------------------------------- /v1/sites: get: tags: [Sites] operationId: listSites summary: List websites x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - { name: hosting_account_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Websites content: application/json: schema: { $ref: '#/components/schemas/WebsiteList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Sites] operationId: createSite summary: Add an add-on domain or subdomain site (counts against `sites` limit) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['sites:write'] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [hosting_account_id, domain, kind] properties: hosting_account_id: { $ref: '#/components/schemas/Uuid' } domain: { $ref: '#/components/schemas/Hostname' } kind: { type: string, enum: [addon, subdomain] } php_version: { $ref: '#/components/schemas/PhpVersion' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}: get: tags: [Sites] operationId: getSite summary: Get a website x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Website content: application/json: schema: { $ref: '#/components/schemas/Website' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [Sites] operationId: updateSite summary: Change PHP version / extensions / redirects (applied by agent asynchronously; returns updated desired state) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['sites:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object minProperties: 1 properties: php_version: { $ref: '#/components/schemas/PhpVersion' } php_extensions: { type: array, items: { type: string, pattern: '^[a-z0-9_]+$' } } redirects: { type: array, maxItems: 500, items: { $ref: '#/components/schemas/Redirect' } } responses: '200': description: Updated website content: application/json: schema: { $ref: '#/components/schemas/Website' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}/wordpress: post: tags: [Sites] operationId: installWordPress summary: Install WordPress (admin password generated and delivered via one-time reveal, never in events) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['sites:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [title, admin_user, admin_email] properties: title: { type: string, maxLength: 200 } admin_user: { type: string, pattern: '^[a-zA-Z0-9_.-]{3,60}$' } admin_email: { type: string, format: email } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}/staging: post: tags: [Sites] operationId: createStaging summary: Create a staging copy at `staging.` x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['sites:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } /v1/sites/{id}/files: get: tags: [Sites] operationId: listFiles summary: List a directory (path is normalised and chrooted to the account home; traversal → 422) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['files:read'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/FilePath' responses: '200': description: Directory listing content: application/json: schema: { $ref: '#/components/schemas/DirectoryListing' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}/files/content: get: tags: [Sites] operationId: readFile summary: Read a text file (max 2 MiB) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['files:read'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/FilePathRequired' responses: '200': description: File content content: application/json: schema: { $ref: '#/components/schemas/FileContent' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } put: tags: [Sites] operationId: writeFile summary: Write a text file (atomic replace, owned by the account UID, counts against quota) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['files:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/FilePathRequired' requestBody: required: true content: application/json: schema: type: object required: [content] properties: content: { type: string, maxLength: 2097152 } responses: '200': description: Written content: application/json: schema: { $ref: '#/components/schemas/FileContent' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}/cron: get: tags: [Sites] operationId: listCron summary: List cron jobs for a site x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Cron jobs content: application/json: schema: { $ref: '#/components/schemas/CronJobList' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Sites] operationId: createCron summary: Add a cron job (runs as the account UID; minimum interval 5 minutes) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['sites:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [schedule, command] properties: schedule: { type: string, examples: ['*/5 * * * *'] } command: { type: string, maxLength: 1000 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/CronJob' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/sites/{id}/logs: get: tags: [Sites] operationId: getSiteLogs summary: Tail access or error log (redacted; own site only) x-roles: [provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['logs:read'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' - { name: type, in: query, required: true, schema: { type: string, enum: [access, error] } } - { name: lines, in: query, schema: { type: integer, minimum: 1, maximum: 1000, default: 200 } } responses: '200': description: Log lines content: application/json: schema: type: object required: [lines] properties: lines: { type: array, items: { type: string } } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } # --------------------------------------------------------------------------- # Databases # --------------------------------------------------------------------------- /v1/databases: get: tags: [Databases] operationId: listDatabases summary: List databases x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - { name: hosting_account_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Databases content: application/json: schema: { $ref: '#/components/schemas/DatabaseList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Databases] operationId: createDatabase summary: Create a database (name is prefixed with the account username) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['databases:write'] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [hosting_account_id, name] properties: hosting_account_id: { $ref: '#/components/schemas/Uuid' } name: { type: string, pattern: '^[a-z][a-z0-9_]{0,31}$' } engine: { type: string, enum: [mariadb, mysql, postgresql], default: mariadb } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/databases/{id}/import: post: tags: [Databases] operationId: importDatabase summary: Import a SQL dump from a URL (SSRF-validated https URL; private/link-local/metadata addresses rejected) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['databases:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [source_url] properties: source_url: { type: string, format: uri, pattern: '^https://' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # DNS # --------------------------------------------------------------------------- /v1/domains: get: tags: [DNS] operationId: listDomains summary: List domains x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Domains content: application/json: schema: { $ref: '#/components/schemas/DomainList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [DNS] operationId: createDomain summary: Register a domain for a customer (ownership must be verified before use) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [customer_id, name] properties: customer_id: { $ref: '#/components/schemas/Uuid' } name: { $ref: '#/components/schemas/Hostname' } dns_mode: { type: string, enum: [managed, external], default: managed } responses: '201': description: Created; includes `ownership_token` to publish as TXT `_wpanel-verify.` content: application/json: schema: { $ref: '#/components/schemas/Domain' } '401': { $ref: '#/components/responses/Unauthenticated' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/domains/{id}/verify: post: tags: [DNS] operationId: verifyDomain summary: Check the ownership TXT record now x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Domain (verified_at set when the TXT record matched) content: application/json: schema: { $ref: '#/components/schemas/Domain' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/dns/zones: get: tags: [DNS] operationId: listZones summary: List DNS zones x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Zones content: application/json: schema: { $ref: '#/components/schemas/DnsZoneList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [DNS] operationId: createZone summary: Create a PowerDNS zone for a verified managed domain x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['dns:write'] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [domain_id] properties: domain_id: { $ref: '#/components/schemas/Uuid' } template: { type: string, enum: [default, mail, none], default: default } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/DnsZone' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/dns/zones/{id}: get: tags: [DNS] operationId: getZone summary: Get a zone including `records` x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Zone content: application/json: schema: { $ref: '#/components/schemas/DnsZone' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/dns/zones/{id}/records: post: tags: [DNS] operationId: createRecord summary: Add a record (validated per type; bumps zone serial) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['dns:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name, type, content] properties: name: { type: string, description: 'Relative name or `@`' } type: { $ref: '#/components/schemas/DnsRecordType' } content: { type: string, maxLength: 4096 } ttl: { type: integer, minimum: 60, maximum: 86400, default: 3600 } priority: { type: integer, minimum: 0, maximum: 65535, description: Required for MX and SRV } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/DnsRecord' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/dns/records/{id}: delete: tags: [DNS] operationId: deleteRecord summary: Delete a record x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['dns:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '204': { description: Deleted } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } # --------------------------------------------------------------------------- # Certificates & mail # --------------------------------------------------------------------------- /v1/certificates: get: tags: [Certificates] operationId: listCertificates summary: List certificates (expiry tracked; auto-renew 30 days before not_after) x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Certificates content: application/json: schema: { $ref: '#/components/schemas/CertificateList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Certificates] operationId: requestCertificate summary: Request an ACME certificate x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [common_name] properties: common_name: { $ref: '#/components/schemas/Hostname' } sans: { type: array, maxItems: 100, items: { $ref: '#/components/schemas/Hostname' } } challenge: { type: string, enum: [http-01, dns-01], default: http-01 } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } /v1/mailboxes: get: tags: [Mail] operationId: listMailboxes summary: List mailboxes, aliases and forwards x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - { name: hosting_account_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Mailboxes content: application/json: schema: { $ref: '#/components/schemas/MailboxList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Mail] operationId: createMailbox summary: Create a mailbox, alias or forward (counts against `mailboxes` limit) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['mail:write'] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [hosting_account_id, address, kind] properties: hosting_account_id: { $ref: '#/components/schemas/Uuid' } address: { type: string, format: email } kind: { type: string, enum: [mailbox, alias, forward] } password: { type: string, format: password, minLength: 10, writeOnly: true, description: Required for kind=mailbox } destinations: { type: array, items: { type: string, format: email }, description: Required for alias/forward } quota_mb: { type: integer, minimum: 50, default: 1024 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Mailbox' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/mail/domains/{domain}/auth: get: tags: [Mail] operationId: getMailAuth summary: SPF, DKIM and DMARC records to publish for a domain x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - { name: domain, in: path, required: true, schema: { $ref: '#/components/schemas/Hostname' } } - $ref: '#/components/parameters/OrgId' responses: '200': description: Mail authentication records content: application/json: schema: { $ref: '#/components/schemas/MailAuth' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/mail/queue: get: tags: [Mail] operationId: getMailQueue summary: Mail queue statistics per node (providers see only their tenants' share) x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support] parameters: - $ref: '#/components/parameters/OrgId' responses: '200': description: Queue stats content: application/json: schema: { $ref: '#/components/schemas/MailQueueStats' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } # --------------------------------------------------------------------------- # Backups & migrations # --------------------------------------------------------------------------- /v1/backups: get: tags: [Backups] operationId: listBackups summary: List backups x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] parameters: - $ref: '#/components/parameters/OrgId' - { name: hosting_account_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Backups content: application/json: schema: { $ref: '#/components/schemas/BackupList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Backups] operationId: createBackup summary: Take an on-demand encrypted backup to tenant-scoped S3 x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner, customer_collaborator] x-scopes: ['backups:write'] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [hosting_account_id] properties: hosting_account_id: { $ref: '#/components/schemas/Uuid' } kind: { type: string, enum: [full, files, databases, mail, config], default: full } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } /v1/backups/{id}/restore: post: tags: [Backups] operationId: restoreBackup summary: Restore a backup (default to staging; in_place only after staging validation) x-roles: [provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] x-scopes: ['backups:write'] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [target] properties: target: { type: string, enum: [staging, alternate_node, in_place] } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/migrations: get: tags: [Migrations] operationId: listMigrations summary: List migrations x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Migrations content: application/json: schema: { $ref: '#/components/schemas/MigrationList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Migrations] operationId: createMigration summary: Start an authorized cPanel / WHM import (runs preflight first) x-roles: [platform_admin, platform_support, provider_owner, provider_admin, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [customer_id, source_ref, source_kind, domain, plan_version_id] properties: customer_id: { $ref: '#/components/schemas/Uuid' } source_ref: { type: string, description: 'Tenant-scoped object-storage key of the uploaded archive or an SSRF-validated https URL' } source_kind: { type: string, enum: [cpanel_backup, whm_metadata] } domain: { $ref: '#/components/schemas/Hostname' } plan_version_id: { $ref: '#/components/schemas/Uuid' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/migrations/{id}: get: tags: [Migrations] operationId: getMigration summary: Get a migration with preflight results, unsupported features and report x-roles: [platform_admin, platform_support, provider_owner, provider_admin, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Migration content: application/json: schema: { $ref: '#/components/schemas/Migration' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/migrations/{id}/actions: post: tags: [Migrations] operationId: migrationAction summary: Advance or roll back a migration (sync → cutover → accept | rollback); source preserved until accept x-roles: [platform_admin, platform_support, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [action] properties: action: { type: string, enum: [sync, cutover, accept, rollback] } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } # --------------------------------------------------------------------------- # Jobs, events, audit # --------------------------------------------------------------------------- /v1/jobs: get: tags: [Jobs] operationId: listJobs summary: List jobs visible in the active org x-roles: [any-authenticated] parameters: - $ref: '#/components/parameters/OrgId' - { name: status, in: query, schema: { $ref: '#/components/schemas/JobStatus' } } - { name: kind, in: query, schema: { type: string } } - { name: resource_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Jobs content: application/json: schema: { $ref: '#/components/schemas/JobList' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/jobs/{id}: get: tags: [Jobs] operationId: getJob summary: Get job status, saga steps and result x-roles: [any-authenticated] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Job content: application/json: schema: { $ref: '#/components/schemas/Job' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/events: get: tags: [Events & Webhooks] operationId: listEvents summary: List tenant events (envelopes as delivered to webhooks; see api/events/) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: type, in: query, schema: { $ref: '#/components/schemas/EventType' } } - { name: since, in: query, schema: { $ref: '#/components/schemas/Timestamp' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Events content: application/json: schema: { $ref: '#/components/schemas/EventList' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/events/{id}/replay: post: tags: [Events & Webhooks] operationId: replayEvent summary: Re-deliver an event (same id) to matching webhook endpoints, including dead deliveries x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: false content: application/json: schema: type: object properties: endpoint_id: { $ref: '#/components/schemas/Uuid', description: Limit replay to one endpoint } responses: '202': description: Deliveries re-queued content: application/json: schema: type: object properties: event_id: { $ref: '#/components/schemas/Uuid' } deliveries_queued: { type: integer, minimum: 0 } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/webhook-endpoints: get: tags: [Events & Webhooks] operationId: listWebhookEndpoints summary: List outbound webhook endpoints (secret never returned) x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' responses: '200': description: Endpoints content: application/json: schema: { $ref: '#/components/schemas/WebhookEndpointList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Events & Webhooks] operationId: createWebhookEndpoint summary: Register an https endpoint (SSRF-validated); signing secret returned once x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [url] properties: url: { type: string, format: uri, pattern: '^https://' } event_types: type: array default: ['*'] items: anyOf: - $ref: '#/components/schemas/EventType' - { type: string, const: '*' } responses: '201': description: Created content: application/json: schema: allOf: - $ref: '#/components/schemas/WebhookEndpoint' - type: object required: [secret] properties: secret: { type: string, description: 'HMAC signing secret (`whsec_...`), shown once' } '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } /v1/audit-events: get: tags: [Audit] operationId: listAuditEvents summary: Append-only audit log for the active org subtree x-roles: [platform_admin, platform_support, provider_owner, provider_admin, reseller_owner, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: actor_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - { name: action, in: query, schema: { type: string } } - { name: resource_id, in: query, schema: { type: string } } - { name: since, in: query, schema: { $ref: '#/components/schemas/Timestamp' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Audit events content: application/json: schema: { $ref: '#/components/schemas/AuditEventList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } # --------------------------------------------------------------------------- # Commerce # --------------------------------------------------------------------------- /v1/storefront/catalog: get: tags: [Storefront] operationId: getCatalog summary: Public branded catalog (visible products with active prices) security: [] x-roles: [anonymous] parameters: - { name: host, in: query, schema: { $ref: '#/components/schemas/Hostname' } } - { name: brand_id, in: query, schema: { $ref: '#/components/schemas/Uuid' } } - { name: brand, in: query, description: 'Brand slug (demo shortcut, e.g. `acme`)', schema: { type: string } } responses: '200': description: Catalog content: application/json: schema: { $ref: '#/components/schemas/Catalog' } '404': { $ref: '#/components/responses/NotFound' } /v1/storefront/signup: post: tags: [Storefront] operationId: storefrontSignup summary: Public customer signup on a brand's storefront (creates customer + customer_owner login) security: [] x-roles: [anonymous] requestBody: required: true content: application/json: schema: type: object required: [brand_id, name, email, password] properties: brand_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } email: { type: string, format: email } password: { type: string, format: password, minLength: 10 } state_code: { $ref: '#/components/schemas/StateCode' } company: { type: string } gstin: { $ref: '#/components/schemas/Gstin' } responses: '201': description: Customer created and logged in (session cookies set) content: application/json: schema: allOf: - $ref: '#/components/schemas/LoginSuccess' - type: object required: [customer] properties: customer: { $ref: '#/components/schemas/Customer' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } '429': { $ref: '#/components/responses/RateLimited' } /v1/products: get: tags: [Catalog] operationId: listProducts summary: List products of the active org x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Products content: application/json: schema: { $ref: '#/components/schemas/ProductList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Catalog] operationId: createProduct summary: Create a product (hosting products reference a plan) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name] properties: plan_id: { $ref: '#/components/schemas/Uuid' } brand_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } description: { type: string } features: { type: array, items: { type: string } } kind: { type: string, enum: [hosting, domain, addon, backup, managed_service], default: hosting } visible: { type: boolean, default: true } sort_order: { type: integer, default: 0 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Product' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/products/{id}/prices: post: tags: [Catalog] operationId: createPrice summary: Add a price (one per billing cycle + currency); resellers cannot price below their wholesale cost x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [billing_cycle, currency, amount_minor] properties: billing_cycle: { $ref: '#/components/schemas/BillingCycle' } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { $ref: '#/components/schemas/MinorAmount' } setup_fee_minor: { $ref: '#/components/schemas/MinorAmount' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Price' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/coupons: get: tags: [Catalog] operationId: listCoupons summary: List coupons x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Coupons content: application/json: schema: { $ref: '#/components/schemas/CouponList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Catalog] operationId: createCoupon summary: Create a percentage (basis points) or fixed-amount coupon x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: allOf: - type: object required: [code] properties: code: { type: string, pattern: '^[A-Z0-9_-]{3,32}$' } max_redemptions: { type: integer, minimum: 1 } valid_from: { $ref: '#/components/schemas/Timestamp' } valid_until: { $ref: '#/components/schemas/Timestamp' } applies_to: { type: array, items: { $ref: '#/components/schemas/Uuid' } } - oneOf: - type: object required: [percent_bp] properties: percent_bp: { type: integer, minimum: 1, maximum: 10000 } - type: object required: [amount_minor, currency] properties: amount_minor: { type: integer, format: int64, minimum: 1 } currency: { $ref: '#/components/schemas/Currency' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/Coupon' } '401': { $ref: '#/components/responses/Unauthenticated' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/carts: post: tags: [Orders] operationId: createCart summary: Create a cart (anonymous storefront visitors receive a cart bound to the brand) security: [{}, { cookieSession: [], csrfToken: [] }, { bearerJwt: [] }] x-roles: [anonymous, customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] requestBody: required: true content: application/json: schema: type: object required: [currency] properties: brand_id: { $ref: '#/components/schemas/Uuid' } currency: { $ref: '#/components/schemas/Currency' } responses: '201': description: Cart content: application/json: schema: { $ref: '#/components/schemas/Cart' } '422': { $ref: '#/components/responses/Validation' } /v1/carts/{id}: get: tags: [Orders] operationId: getCart summary: Get a cart with computed totals (tax by place of supply) security: [{}, { cookieSession: [] }, { bearerJwt: [] }] x-roles: [anonymous, customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' responses: '200': description: Cart with totals content: application/json: schema: { $ref: '#/components/schemas/Cart' } '404': { $ref: '#/components/responses/NotFound' } /v1/carts/{id}/items: post: tags: [Orders] operationId: addCartItem summary: Add an item to a cart security: [{}, { cookieSession: [], csrfToken: [] }, { bearerJwt: [] }] x-roles: [anonymous, customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/CartItem' } responses: '200': description: Updated cart content: application/json: schema: { $ref: '#/components/schemas/Cart' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/carts/{id}/coupon: post: tags: [Orders] operationId: applyCartCoupon summary: Apply a coupon (validated for dates, redemptions, applicable products and currency) security: [{}, { cookieSession: [], csrfToken: [] }, { bearerJwt: [] }] x-roles: [anonymous, customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' requestBody: required: true content: application/json: schema: type: object required: [code] properties: code: { type: string } responses: '200': description: Updated cart content: application/json: schema: { $ref: '#/components/schemas/Cart' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } /v1/orders: get: tags: [Orders] operationId: listOrders summary: List orders (customers see own order history) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: status, in: query, schema: { $ref: '#/components/schemas/OrderStatus' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Orders content: application/json: schema: { $ref: '#/components/schemas/OrderList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Orders] operationId: createOrder summary: Convert a cart into an order in `pending_payment` (pricing snapshot frozen) x-roles: [customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: type: object required: [cart_id, terms_accepted, terms_version, region_code] properties: cart_id: { $ref: '#/components/schemas/Uuid' } terms_accepted: { type: boolean, const: true } terms_version: { type: string, examples: ['2026-11'] } region_code: { type: string, examples: [in-mum-1] } customer_id: { $ref: '#/components/schemas/Uuid', description: Staff placing an order on behalf of a customer } responses: '201': description: Order content: application/json: schema: { $ref: '#/components/schemas/Order' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/orders/{id}: get: tags: [Orders] operationId: getOrder summary: Get an order including `items` x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Order content: application/json: schema: { $ref: '#/components/schemas/Order' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/orders/{id}/checkout: post: tags: [Orders] operationId: checkoutOrder summary: Create a hosted-checkout session with the seller's merchant account (no card data touches wPanel) description: | Browser success callbacks never provision. Provisioning starts only after a verified payment webhook moves the order to `paid_provisioning`. x-roles: [customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Checkout parameters for the provider's hosted widget content: application/json: schema: { $ref: '#/components/schemas/CheckoutSession' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } /v1/payments/sim/{order_id}/complete: post: tags: [Payments] operationId: simCompletePayment summary: Dev/sim provider only — emit a correctly signed payment webhook to wPanel for this order description: Disabled (404) unless `WPANEL_ENV=dev` and the seller's merchant account provider is `sim`. x-roles: [customer_owner, platform_admin, provider_owner, reseller_owner] parameters: - { name: order_id, in: path, required: true, schema: { $ref: '#/components/schemas/Uuid' } } - $ref: '#/components/parameters/OrgId' requestBody: required: false content: application/json: schema: type: object properties: outcome: { type: string, enum: [captured, failed], default: captured } event_id: { type: string, description: Reuse to simulate a duplicate provider event } responses: '200': description: Webhook emitted; returns the intake result content: application/json: schema: { $ref: '#/components/schemas/PaymentWebhookAck' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/webhooks/payments/{provider}: post: tags: [Payments] operationId: paymentWebhook summary: Payment provider → wPanel webhook intake description: | Verifies the provider signature over the raw body (e.g. `X-Razorpay-Signature`, HMAC-SHA256 with the merchant account's webhook secret), maps the event to an order, checks amount, currency and provider order id, and deduplicates on `(provider, provider_event_id)` in `payment_events`. A duplicate event returns 200 with `duplicate: true` and has no side effects. Invalid signatures return 401 and are stored as `rejected`. security: [] x-roles: [payment-provider] parameters: - name: provider in: path required: true schema: { type: string, enum: [razorpay, stripe, paypal, sim] } - { name: X-Razorpay-Signature, in: header, required: false, schema: { type: string } } - { name: X-Razorpay-Event-Id, in: header, required: false, schema: { type: string } } - { name: Stripe-Signature, in: header, required: false, schema: { type: string } } - { name: X-Sim-Signature, in: header, required: false, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object description: Provider-specific payload; stored verbatim in payment_events.payload. additionalProperties: true responses: '200': description: Accepted (processed, duplicate or ignored) content: application/json: schema: { $ref: '#/components/schemas/PaymentWebhookAck' } '401': description: Signature invalid content: application/json: schema: { $ref: '#/components/schemas/Error' } '422': description: Amount / currency / order mismatch (event rejected, order flagged for review) content: application/json: schema: { $ref: '#/components/schemas/Error' } /v1/subscriptions: get: tags: [Billing] operationId: listSubscriptions summary: List subscriptions x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: status, in: query, schema: { $ref: '#/components/schemas/SubscriptionStatus' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Subscriptions content: application/json: schema: { $ref: '#/components/schemas/SubscriptionList' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/subscriptions/{id}/cancel: post: tags: [Billing] operationId: cancelSubscription summary: Cancel at period end (→ cancellation_pending) or immediately (→ terminated via account termination job) x-roles: [provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [at_period_end] properties: at_period_end: { type: boolean } responses: '200': description: Updated subscription content: application/json: schema: { $ref: '#/components/schemas/Subscription' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': description: Subscription is externally billed (`billing_authority=external`) — cancel in the external system content: application/json: schema: { $ref: '#/components/schemas/Error' } /v1/invoices: get: tags: [Billing] operationId: listInvoices summary: List invoices (retail book for sellers/customers; wholesale book for partners and platform) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: book, in: query, schema: { $ref: '#/components/schemas/Book' } } - { name: status, in: query, schema: { $ref: '#/components/schemas/InvoiceStatus' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Invoices content: application/json: schema: { $ref: '#/components/schemas/InvoiceList' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/invoices/{id}: get: tags: [Billing] operationId: getInvoice summary: Get an invoice with `lines` and `credit_notes` x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin, customer_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' responses: '200': description: Invoice content: application/json: schema: { $ref: '#/components/schemas/Invoice' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/invoices/{id}/credit-notes: post: tags: [Billing] operationId: createCreditNote summary: Issue a credit note against an issued invoice (the only way to correct it) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/IdPath' - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [amount_minor, reason] properties: amount_minor: { type: integer, format: int64, minimum: 1, description: 'Gross amount; must not exceed invoice total minus prior credit notes' } reason: { type: string, minLength: 3 } responses: '201': description: Credit note content: application/json: schema: { $ref: '#/components/schemas/CreditNote' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/refunds: post: tags: [Payments] operationId: createRefund summary: Refund all or part of a captured payment through the provider (creates a credit note) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [payment_id, amount_minor, reason] properties: payment_id: { $ref: '#/components/schemas/Uuid' } amount_minor: { type: integer, format: int64, minimum: 1 } reason: { type: string, minLength: 3 } responses: '201': description: Refund content: application/json: schema: { $ref: '#/components/schemas/Refund' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } '422': { $ref: '#/components/responses/Validation' } /v1/ledger: get: tags: [Billing] operationId: listLedgerEntries summary: Double-entry ledger postings for one book x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' - { name: book, in: query, required: true, schema: { $ref: '#/components/schemas/Book' } } - { name: account, in: query, schema: { $ref: '#/components/schemas/LedgerAccount' } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Ledger entries content: application/json: schema: { $ref: '#/components/schemas/LedgerEntryList' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } /v1/wallet: get: tags: [Billing] operationId: getWallet summary: Customer wallet balance (per currency) and entries x-roles: [customer_owner, provider_owner, provider_admin, provider_billing, reseller_owner, reseller_admin] parameters: - $ref: '#/components/parameters/OrgId' - { name: customer_id, in: query, description: Staff only, schema: { $ref: '#/components/schemas/Uuid' } } responses: '200': description: Wallet content: application/json: schema: { $ref: '#/components/schemas/Wallet' } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/tax-profiles: get: tags: [Billing] operationId: listTaxProfiles summary: List tax profiles (GST registration of the issuer) x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' responses: '200': description: Tax profiles content: application/json: schema: { $ref: '#/components/schemas/TaxProfileList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Billing] operationId: createTaxProfile summary: Create a tax profile x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [name, legal_name, state_code] properties: name: { type: string } country: { type: string, pattern: '^[A-Z]{2}$', default: IN } gstin: { $ref: '#/components/schemas/Gstin' } legal_name: { type: string } state_code: { $ref: '#/components/schemas/StateCode' } address: { $ref: '#/components/schemas/Address' } default_rate_bp: { type: integer, minimum: 0, maximum: 10000, default: 1800 } sac_code: { type: string, default: '998315' } invoice_prefix: { type: string, pattern: '^[A-Z0-9/-]{1,10}$', default: INV } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/TaxProfile' } '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } /v1/billing-adapters: get: tags: [Billing] operationId: listBillingAdapters summary: List external billing adapters x-roles: [platform_admin, provider_owner, provider_admin, provider_billing, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' responses: '200': description: Adapters content: application/json: schema: { $ref: '#/components/schemas/BillingAdapterList' } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Billing] operationId: createBillingAdapter summary: Register an external billing system (e.g. WHMCS); binds a scoped API key, returns webhook secret once x-roles: [platform_admin, provider_owner, provider_admin, reseller_owner] parameters: - $ref: '#/components/parameters/OrgId' requestBody: required: true content: application/json: schema: type: object required: [kind, name] properties: kind: { type: string, enum: [whmcs, blesta, hostbill, custom] } name: { type: string } api_key_id: { $ref: '#/components/schemas/Uuid', description: Existing API key to bind; a new key is minted when omitted } config: type: object description: Non-secret settings, e.g. `{"webhook_url":"https://billing.example/modules/servers/wpanel/callback.php"}` additionalProperties: true responses: '201': description: Created content: application/json: schema: allOf: - $ref: '#/components/schemas/BillingAdapter' - type: object properties: webhook_secret: { type: string, description: Shown once } api_key: { type: string, description: 'Shown once when a new `wpk_` key was minted' } '401': { $ref: '#/components/responses/Unauthenticated' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # External billing (WHMCS-compatible) — API-key auth only # --------------------------------------------------------------------------- /v1/external/{adapter}/accounts: post: tags: [External Billing] operationId: externalCreateAccount summary: Create customer (if new) + hosting account with `billing_authority=external` description: | Requires an API key bound to a billing adapter of this `adapter` kind. The customer is matched by email within the key's org. The created subscription is marked `billing_authority=external` with `external_ref`, so wPanel never invoices it natively. security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['external:write'] parameters: - $ref: '#/components/parameters/Adapter' - $ref: '#/components/parameters/IdempotencyKeyRequired' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/ExternalAccountCreate' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '409': description: '`conflict` (external_ref already exists / key reuse with different body) or `insufficient_capacity`' content: application/json: schema: { $ref: '#/components/schemas/Error' } '422': { $ref: '#/components/responses/Validation' } /v1/external/{adapter}/accounts/{ref}/suspend: post: tags: [External Billing] operationId: externalSuspend summary: Suspend an externally billed account security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['external:write'] parameters: - $ref: '#/components/parameters/Adapter' - $ref: '#/components/parameters/ExternalRef' - $ref: '#/components/parameters/IdempotencyKeyRequired' requestBody: required: false content: application/json: schema: type: object properties: reason: { type: string } web: { type: boolean, default: true } mail: { type: boolean, default: false } data: { type: boolean, default: false } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } /v1/external/{adapter}/accounts/{ref}/unsuspend: post: tags: [External Billing] operationId: externalUnsuspend summary: Unsuspend an externally billed account security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['external:write'] parameters: - $ref: '#/components/parameters/Adapter' - $ref: '#/components/parameters/ExternalRef' - $ref: '#/components/parameters/IdempotencyKeyRequired' requestBody: required: false content: application/json: schema: { type: object } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/external/{adapter}/accounts/{ref}/terminate: post: tags: [External Billing] operationId: externalTerminate summary: Terminate an externally billed account (data retained for `retention_days` before cleanup) security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['external:write'] parameters: - $ref: '#/components/parameters/Adapter' - $ref: '#/components/parameters/ExternalRef' - $ref: '#/components/parameters/IdempotencyKeyRequired' requestBody: required: false content: application/json: schema: type: object properties: retention_days: { type: integer, minimum: 0, maximum: 90, default: 14 } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } /v1/external/{adapter}/accounts/{ref}/change-package: post: tags: [External Billing] operationId: externalChangePackage summary: Move an externally billed account to another plan version security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['external:write'] parameters: - $ref: '#/components/parameters/Adapter' - $ref: '#/components/parameters/ExternalRef' - $ref: '#/components/parameters/IdempotencyKeyRequired' requestBody: required: true content: application/json: schema: type: object required: [plan_version_id] properties: plan_version_id: { $ref: '#/components/schemas/Uuid' } responses: '202': { $ref: '#/components/responses/Accepted' } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/InsufficientCapacity' } '422': { $ref: '#/components/responses/Validation' } /v1/external/{adapter}/usage: get: tags: [External Billing] operationId: externalUsage summary: Usage sync for externally billed accounts (disk / bandwidth in MB) security: [{ apiKey: [] }] x-roles: [api_key] x-scopes: ['usage:read'] parameters: - $ref: '#/components/parameters/Adapter' - { name: refs, in: query, description: Comma-separated external refs; empty = all accounts of this adapter, schema: { type: string } } - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: Usage rows content: application/json: schema: type: object required: [data] properties: data: { type: array, items: { $ref: '#/components/schemas/ExternalUsage' } } next_cursor: { type: [string, 'null'] } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } # --------------------------------------------------------------------------- # Decisions registry # --------------------------------------------------------------------------- /v1/decisions: get: tags: [Decisions] operationId: listDecisions summary: List the open decisions registry (see docs/decisions.md) x-roles: [platform_admin, platform_support, provider_owner] responses: '200': description: Decisions content: application/json: schema: type: object required: [data] properties: data: { type: array, items: { $ref: '#/components/schemas/Decision' } } next_cursor: { type: [string, 'null'] } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/decisions/{key}: patch: tags: [Decisions] operationId: updateDecision summary: Record or approve a decision (platform admin; audited) x-roles: [platform_admin] parameters: - { name: key, in: path, required: true, schema: { type: string, pattern: '^[a-z][a-z0-9_]{2,63}$' }, example: reseller_depth } requestBody: required: true content: application/json: schema: type: object minProperties: 1 properties: value: { description: Any JSON value } status: { type: string, enum: [proposed, approved, superseded] } notes: { type: string } example: { value: 1, status: approved, notes: Approved at architecture review 2026-12-01 } responses: '200': description: Updated decision content: application/json: schema: { $ref: '#/components/schemas/Decision' } '401': { $ref: '#/components/responses/Unauthenticated' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '422': { $ref: '#/components/responses/Validation' } # --------------------------------------------------------------------------- # Node agent # --------------------------------------------------------------------------- /v1/agent/enroll: post: tags: [Node Agent] operationId: agentEnroll summary: Exchange a single-use enrollment token + CSR for a short-lived node client certificate security: [] x-roles: [node-agent] requestBody: required: true content: application/json: schema: type: object required: [node_id, hostname, enrollment_token, csr_pem] properties: node_id: { $ref: '#/components/schemas/Uuid' } hostname: { $ref: '#/components/schemas/Hostname' } enrollment_token: { type: string } csr_pem: { type: string } agent_version: { type: string } responses: '200': description: Enrolled content: application/json: schema: type: object required: [certificate_pem, ca_pem, expires_at] properties: certificate_pem: { type: string } ca_pem: { type: string } expires_at: { $ref: '#/components/schemas/Timestamp' } task_signing_public_key: { type: string, description: Ed25519 public key used to verify agent_tasks.signature } poll_interval_seconds: { type: integer } '401': { $ref: '#/components/responses/Unauthenticated' } '409': { $ref: '#/components/responses/Conflict' } /v1/agent/poll: post: tags: [Node Agent] operationId: agentPoll summary: Long-poll for signed, allowlisted tasks (also acts as heartbeat) security: [{ nodeMtls: [] }, { nodeCredential: [] }] x-roles: [node-agent] requestBody: required: false content: application/json: schema: type: object properties: max_tasks: { type: integer, minimum: 1, maximum: 50, default: 10 } wait_seconds: { type: integer, minimum: 0, maximum: 30, default: 25 } responses: '200': description: Tasks (possibly empty) content: application/json: schema: type: object required: [tasks] properties: tasks: { type: array, items: { $ref: '#/components/schemas/AgentTask' } } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/agent/report: post: tags: [Node Agent] operationId: agentReport summary: Report inventory, health and observed per-account state (monotonic `seq` for replay protection) security: [{ nodeMtls: [] }, { nodeCredential: [] }] x-roles: [node-agent] requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/AgentReport' } responses: '204': { description: Accepted } '401': { $ref: '#/components/responses/Unauthenticated' } '409': description: '`seq` not greater than last accepted (replay)' content: application/json: schema: { $ref: '#/components/schemas/Error' } /v1/agent/tasks/{id}/result: post: tags: [Node Agent] operationId: agentTaskResult summary: Report the result of a task (idempotent per task id) security: [{ nodeMtls: [] }, { nodeCredential: [] }] x-roles: [node-agent] parameters: - $ref: '#/components/parameters/IdPath' requestBody: required: true content: application/json: schema: type: object required: [status, nonce] properties: status: { type: string, enum: [succeeded, failed] } nonce: { type: string, description: Must equal the task nonce } result: { type: object, additionalProperties: true } error: { type: string } responses: '204': { description: Recorded } '401': { $ref: '#/components/responses/Unauthenticated' } '404': { $ref: '#/components/responses/NotFound' } '409': { $ref: '#/components/responses/Conflict' } # ============================================================================= # --------------------------------------------------------------------------- # v1.1 — Support desk, provider settings, settlements, exports, SFTP/SSH access # --------------------------------------------------------------------------- /v1/tickets: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Support] operationId: listTickets summary: List support tickets (customers see only their own) x-roles: [provider_*, reseller_*, platform_support, customer_owner, customer_collaborator] parameters: - { name: status, in: query, schema: { type: string, enum: [open, pending, resolved, closed] } } responses: '200': { description: Tickets, content: { application/json: { schema: { $ref: '#/components/schemas/TicketList' } } } } '401': { $ref: '#/components/responses/Unauthenticated' } post: tags: [Support] operationId: createTicket summary: Open a ticket (SLA due time from the org support policy) requestBody: required: true content: application/json: schema: type: object required: [subject, body] properties: subject: { type: string, minLength: 3, maxLength: 200 } body: { type: string, maxLength: 20000 } priority: { type: string, enum: [low, normal, high, urgent], default: normal } category: { type: string, enum: [billing, technical, abuse, sales, other], default: technical } hosting_account_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } responses: '201': { description: Created, content: { application/json: { schema: { $ref: '#/components/schemas/Ticket' } } } } '422': { $ref: '#/components/responses/Validation' } /v1/tickets/{id}: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] get: tags: [Support] operationId: getTicket summary: Ticket with message thread (internal notes are omitted for customers) responses: '200': { description: Ticket, content: { application/json: { schema: { $ref: '#/components/schemas/Ticket' } } } } '404': { $ref: '#/components/responses/NotFound' } /v1/tickets/{id}/messages: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] post: tags: [Support] operationId: replyTicket summary: Reply (staff may post internal notes; staff replies notify the customer) requestBody: required: true content: { application/json: { schema: { type: object, required: [body], properties: { body: { type: string }, internal: { type: boolean, default: false } } } } } responses: '200': { description: Updated ticket, content: { application/json: { schema: { $ref: '#/components/schemas/Ticket' } } } } '403': { $ref: '#/components/responses/Forbidden' } '409': { $ref: '#/components/responses/Conflict' } /v1/tickets/{id}/status: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] post: tags: [Support] operationId: setTicketStatus summary: Change status / assignee (customers may only close) requestBody: required: true content: { application/json: { schema: { type: object, required: [status], properties: { status: { type: string, enum: [open, pending, resolved, closed] }, assignee_id: { type: [string, 'null'], format: uuid } } } } } responses: '200': { description: Updated ticket, content: { application/json: { schema: { $ref: '#/components/schemas/Ticket' } } } } '403': { $ref: '#/components/responses/Forbidden' } /v1/support-policy: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Settings] operationId: getSupportPolicy summary: Support policy (SLA targets, business hours, escalation) responses: '200': { description: Policy, content: { application/json: { schema: { $ref: '#/components/schemas/SupportPolicy' } } } } put: tags: [Settings] operationId: putSupportPolicy summary: Update support policy requestBody: { required: true, content: { application/json: { schema: { $ref: '#/components/schemas/SupportPolicy' } } } } responses: '200': { description: Policy, content: { application/json: { schema: { $ref: '#/components/schemas/SupportPolicy' } } } } '422': { $ref: '#/components/responses/Validation' } /v1/notification-templates: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Settings] operationId: listNotificationTemplates summary: White-label notification templates (defaults merged with overrides) responses: '200': { description: Templates, content: { application/json: { schema: { type: object, properties: { data: { type: array, items: { $ref: '#/components/schemas/NotificationTemplate' } } } } } } } /v1/notification-templates/{key}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: key, in: path, required: true, schema: { type: string, enum: [order.paid, hosting.provisioned, hosting.failed, invoice.issued, subscription.past_due, account.suspended, backup.completed, ticket.reply] } } put: tags: [Settings] operationId: putNotificationTemplate summary: Override a template (Go text/template syntax, validated on save) requestBody: { required: true, content: { application/json: { schema: { type: object, required: [subject, body], properties: { subject: { type: string }, body: { type: string, maxLength: 20000 }, enabled: { type: boolean } } } } } } responses: '200': { description: Saved, content: { application/json: { schema: { $ref: '#/components/schemas/NotificationTemplate' } } } } '422': { $ref: '#/components/responses/Validation' } /v1/notification-templates/{key}/preview: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: key, in: path, required: true, schema: { type: string } } post: tags: [Settings] operationId: previewNotificationTemplate summary: Render a template with sample data requestBody: { content: { application/json: { schema: { type: object, properties: { data: { type: object, additionalProperties: true } } } } } } responses: '200': { description: Rendered, content: { application/json: { schema: { type: object, properties: { subject: { type: string }, body: { type: string } } } } } } /v1/notifications: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Settings] operationId: listNotifications summary: Sent notification log responses: '200': { description: Log, content: { application/json: { schema: { type: object, properties: { data: { type: array, items: { type: object, additionalProperties: true } } } } } } } /v1/merchant-accounts: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Settings] operationId: listMerchantAccounts summary: Partner-owned payment accounts (secrets are never returned) responses: '200': { description: Accounts, content: { application/json: { schema: { type: object, properties: { data: { type: array, items: { $ref: '#/components/schemas/MerchantAccount' } } } } } } } post: tags: [Settings] operationId: createMerchantAccount summary: Add a Razorpay account (secrets encrypted at rest in the vault) requestBody: required: true content: application/json: schema: type: object required: [key_id, key_secret, webhook_secret] properties: provider: { type: string, enum: [razorpay], default: razorpay } mode: { type: string, enum: [test, live], default: test } key_id: { type: string, pattern: '^rzp_(test|live)_' } key_secret: { type: string, format: password, writeOnly: true } webhook_secret: { type: string, format: password, writeOnly: true } is_default: { type: boolean, default: true } responses: '201': { description: Created, content: { application/json: { schema: { $ref: '#/components/schemas/MerchantAccount' } } } } '422': { $ref: '#/components/responses/Validation' } /v1/merchant-accounts/{id}: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] delete: tags: [Settings] operationId: deleteMerchantAccount summary: Remove a merchant account responses: '200': { description: Deleted } '404': { $ref: '#/components/responses/NotFound' } /v1/webhooks/payments/{provider}/{account}: post: tags: [Payments] operationId: merchantPaymentWebhook summary: Webhook for a partner-owned merchant account (verified with that account's secret) security: [] parameters: - { name: provider, in: path, required: true, schema: { type: string, enum: [razorpay] } } - { name: account, in: path, required: true, schema: { $ref: '#/components/schemas/Uuid' } } requestBody: { required: true, content: { application/json: { schema: { type: object, additionalProperties: true } } } } responses: '200': { description: Processed or duplicate } '401': { $ref: '#/components/responses/Unauthenticated' } /v1/settlements: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Billing] operationId: listSettlements summary: Settlement reconciliation reports responses: '200': { description: Reports, content: { application/json: { schema: { type: object, properties: { data: { type: array, items: { type: object, additionalProperties: true } } } } } } } /v1/settlements/reconcile: parameters: [{ $ref: '#/components/parameters/OrgId' }] post: tags: [Billing] operationId: reconcileSettlement summary: Reconcile a provider settlement (payments + refunds); posts bank/fee ledger entries; idempotent per settlement_ref requestBody: required: true content: application/json: schema: type: object required: [provider, settlement_ref, entries] properties: provider: { type: string } settlement_ref: { type: string } currency: { $ref: '#/components/schemas/Currency' } entries: type: array maxItems: 10000 items: type: object required: [provider_id, amount_minor] properties: type: { type: string, enum: [payment, refund], default: payment } provider_id: { type: string } amount_minor: { $ref: '#/components/schemas/MinorAmount' } fee_minor: { $ref: '#/components/schemas/MinorAmount' } settled_at: { $ref: '#/components/schemas/Timestamp' } responses: '200': { description: 'Report: matched, mismatched with reasons, unsettled payments, stuck refunds' } '409': { $ref: '#/components/responses/Conflict' } /v1/exports/{kind}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: kind, in: path, required: true, schema: { type: string, enum: [customers, hosting-accounts, invoices, orders, payments, tickets, audit-events] } } - { name: format, in: query, schema: { type: string, enum: [csv, json], default: csv } } get: tags: [Exports] operationId: exportData summary: Tenant-scoped, audited data export (CSV formula-injection safe) responses: '200': description: Export content: text/csv: { schema: { type: string } } application/json: { schema: { type: object, properties: { data: { type: array, items: { type: object, additionalProperties: { type: string } } } } } } '403': { $ref: '#/components/responses/Forbidden' } /v1/accounts/{id}/access: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] get: tags: [Hosting] operationId: listAccessCredentials summary: SFTP / scoped SSH credentials of a hosting account responses: '200': { description: Credentials, content: { application/json: { schema: { type: object, properties: { data: { type: array, items: { $ref: '#/components/schemas/AccessCredential' } } } } } } } post: tags: [Hosting] operationId: createAccessCredential summary: Create an SFTP (chrooted to scope) or SSH (jailed, key-only, plan feature ssh) credential requestBody: required: true content: application/json: schema: type: object required: [kind] properties: kind: { type: string, enum: [sftp, ssh] } scope_path: { type: string, default: /public_html } public_key: { type: string, description: 'OpenSSH key: ed25519, ecdsa, or RSA >= 3072' } password: { type: string, format: password, minLength: 12, description: SFTP only } expires_in_days: { type: integer, minimum: 0, maximum: 365 } responses: '202': { $ref: '#/components/responses/Accepted' } '403': { $ref: '#/components/responses/Forbidden' } '422': { $ref: '#/components/responses/Validation' } /v1/access-credentials/{id}: parameters: [{ $ref: '#/components/parameters/IdPath' }, { $ref: '#/components/parameters/OrgId' }] delete: tags: [Hosting] operationId: revokeAccessCredential summary: Revoke a credential (verified removal on the node) responses: '202': { $ref: '#/components/responses/Accepted' } '404': { $ref: '#/components/responses/NotFound' } components: securitySchemes: cookieSession: type: apiKey in: cookie name: wp_session description: HttpOnly, Secure, SameSite=Lax session cookie set by POST /v1/auth/login. csrfToken: type: apiKey in: header name: X-CSRF-Token description: Double-submit token; must equal the `wp_csrf` cookie on every mutating cookie-authenticated request. bearerJwt: type: http scheme: bearer bearerFormat: JWT description: Access token from login (`access_token`), verifiable with /v1/auth/jwks. apiKey: type: http scheme: bearer bearerFormat: 'wpk__' description: Scoped organization API key. Stored hashed; only the prefix is ever shown after creation. nodeMtls: type: mutualTLS description: Node agent client certificate issued by /v1/agent/enroll (production). nodeCredential: type: apiKey in: header name: X-Node-Credential description: Development-only simulation of node mTLS identity. parameters: OrgId: name: X-Org-ID in: header required: false description: Organization the call acts in (a membership org or an org in its subtree). Defaults to first membership. schema: { $ref: '#/components/schemas/Uuid' } IdempotencyKey: name: Idempotency-Key in: header required: false description: 'Client-generated key (8–255 chars). Same key + same body replays the original response; same key + different body → 409.' schema: { type: string, minLength: 8, maxLength: 255 } IdempotencyKeyRequired: name: Idempotency-Key in: header required: true description: Required on external billing mutations. The WHMCS module uses sha256("wpanel|||"). schema: { type: string, minLength: 8, maxLength: 255 } IdPath: name: id in: path required: true schema: { $ref: '#/components/schemas/Uuid' } Limit: name: limit in: query schema: { type: integer, minimum: 1, maximum: 200, default: 50 } Cursor: name: cursor in: query description: Opaque cursor from a previous `next_cursor`. schema: { type: string } FilePath: name: path in: query description: Path relative to the account home; normalised; `..`, NUL bytes and symlink escapes are rejected. schema: { type: string, default: /, maxLength: 4096 } FilePathRequired: name: path in: query required: true description: Path relative to the account home; normalised; `..`, NUL bytes and symlink escapes are rejected. schema: { type: string, maxLength: 4096 } Adapter: name: adapter in: path required: true schema: { type: string, enum: [whmcs, blesta, hostbill, custom] } ExternalRef: name: ref in: path required: true description: External reference set at creation (WHMCS module uses `whmcs-`). schema: { type: string, pattern: '^[A-Za-z0-9._:-]{1,128}$' } responses: Accepted: description: Accepted — asynchronous job enqueued headers: Location: description: /v1/jobs/{job_id} schema: { type: string } content: application/json: schema: { $ref: '#/components/schemas/JobAccepted' } Unauthenticated: description: '`unauthenticated` or `mfa_required`' content: application/json: schema: { $ref: '#/components/schemas/Error' } example: { error: { code: unauthenticated, message: Authentication required, request_id: req_01JD9X3K2Q } } Forbidden: description: '`forbidden` — authenticated but the role/scope does not permit this action' content: application/json: schema: { $ref: '#/components/schemas/Error' } NotFound: description: '`not_found` — does not exist **or belongs to another tenant**' content: application/json: schema: { $ref: '#/components/schemas/Error' } Validation: description: '`validation` — request failed validation; `details` lists field errors' content: application/json: schema: { $ref: '#/components/schemas/Error' } example: { error: { code: validation, message: Invalid request, request_id: req_01JD9X3K2Q, details: [{ field: path, reason: path escapes account home }] } } Conflict: description: '`conflict` — uniqueness, state-machine or idempotency conflict' content: application/json: schema: { $ref: '#/components/schemas/Error' } InsufficientCapacity: description: '`insufficient_capacity` — pool/node capacity would be exceeded (or `conflict`)' content: application/json: schema: { $ref: '#/components/schemas/Error' } example: { error: { code: insufficient_capacity, message: 'pool has 20 sites available, 25 requested', request_id: req_01JD9X3K2Q } } RateLimited: description: '`rate_limited`' headers: Retry-After: schema: { type: integer } content: application/json: schema: { $ref: '#/components/schemas/Error' } schemas: # ---------------- v1.1 ---------------- Ticket: type: object properties: id: { $ref: '#/components/schemas/Uuid' } number: { type: integer } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } customer_name: { type: string } subject: { type: string } status: { type: string, enum: [open, pending, resolved, closed] } priority: { type: string, enum: [low, normal, high, urgent] } category: { type: string, enum: [billing, technical, abuse, sales, other] } assignee_id: { type: [string, 'null'], format: uuid } assignee_email: { type: [string, 'null'] } hosting_account_id: { type: [string, 'null'], format: uuid } first_response_due_at: { $ref: '#/components/schemas/NullableTimestamp' } first_responded_at: { $ref: '#/components/schemas/NullableTimestamp' } sla_breached: { type: boolean } messages: type: array items: type: object properties: id: { $ref: '#/components/schemas/Uuid' } author_name: { type: string } author_type: { type: string, enum: [customer, staff, system] } body: { type: string } internal: { type: boolean } created_at: { $ref: '#/components/schemas/Timestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } TicketList: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/Ticket' } } next_cursor: { type: [string, 'null'] } SupportPolicy: type: object required: [first_response_minutes] properties: first_response_minutes: type: object required: [low, normal, high, urgent] properties: low: { type: integer, minimum: 5, maximum: 10080 } normal: { type: integer, minimum: 5, maximum: 10080 } high: { type: integer, minimum: 5, maximum: 10080 } urgent: { type: integer, minimum: 5, maximum: 10080 } business_hours: { type: string, examples: ['24x7'] } auto_close_days: { type: integer, minimum: 1, maximum: 90 } escalation_email: { type: [string, 'null'], format: email } abuse_email: { type: [string, 'null'], format: email } NotificationTemplate: type: object properties: key: { type: string } subject: { type: string } body: { type: string } enabled: { type: boolean } is_default: { type: boolean } MerchantAccount: type: object properties: id: { $ref: '#/components/schemas/Uuid' } provider: { type: string, enum: [razorpay] } mode: { type: string, enum: [test, live] } key_id: { type: string } is_default: { type: boolean } webhook_url: { type: string, format: uri } created_at: { $ref: '#/components/schemas/Timestamp' } AccessCredential: type: object properties: id: { $ref: '#/components/schemas/Uuid' } kind: { type: string, enum: [sftp, ssh] } login: { type: string } scope_path: { type: string } auth: { type: string, enum: [password, key] } key_fingerprint: { type: [string, 'null'] } status: { type: string, enum: [pending, active, revoking, revoked, failed] } host: { type: string } port: { type: integer } expires_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } # ---------------- primitives ---------------- Uuid: { type: string, format: uuid } Timestamp: { type: string, format: date-time } NullableTimestamp: { type: [string, 'null'], format: date-time } Currency: { type: string, pattern: '^[A-Z]{3}$', examples: [INR] } MinorAmount: { type: integer, format: int64, minimum: 0, description: Amount in minor units (paise / cents) } Hostname: { type: string, format: hostname, maxLength: 253 } Gstin: { type: string, pattern: '^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$' } StateCode: { type: string, pattern: '^[0-9]{2}$', description: GST state code for place of supply, examples: ['27'] } PhpVersion: { type: string, enum: ['7.4', '8.1', '8.2', '8.3', '8.4'] } Address: type: object properties: line1: { type: string } line2: { type: string } city: { type: string } state: { type: string } postal_code: { type: string } country: { type: string, pattern: '^[A-Z]{2}$' } Role: type: string enum: [platform_admin, platform_support, provider_owner, provider_admin, provider_billing, provider_support, reseller_owner, reseller_admin, customer_owner, customer_collaborator] Scope: type: string description: 'Resource scope `:`, e.g. hosting:write, billing:read, sites:read, files:write, dns:write, external:write, usage:read' pattern: '^[a-z_]+:(read|write)$' OrgType: { type: string, enum: [platform, provider, reseller] } Book: { type: string, enum: [wholesale, retail] } BillingCycle: { type: string, enum: [monthly, quarterly, annual, one_time] } Limits: type: object description: Shared limits document (pools, allocations, plan versions, hosting accounts). additionalProperties: false properties: cpu_millicores: { type: integer, minimum: 0 } memory_mb: { type: integer, minimum: 0 } storage_gb: { type: integer, minimum: 0 } bandwidth_gb: { type: integer, minimum: 0 } inodes: { type: integer, minimum: 0 } databases: { type: integer, minimum: 0 } mailboxes: { type: integer, minimum: 0 } sites: { type: integer, minimum: 0 } NodeCapacity: type: object additionalProperties: false properties: cpu_millicores: { type: integer, minimum: 0 } memory_mb: { type: integer, minimum: 0 } disk_gb: { type: integer, minimum: 0 } inodes: { type: integer, minimum: 0 } sites: { type: integer, minimum: 0 } PlanFeatures: type: object additionalProperties: true properties: php_versions: { type: array, items: { $ref: '#/components/schemas/PhpVersion' } } wordpress: { type: boolean } staging: { type: boolean } ssh: { type: boolean } sftp: { type: boolean } backups_daily: { type: boolean } backup_retention_days: { type: integer } Suspension: type: object required: [web, mail, data] properties: web: { type: boolean } mail: { type: boolean } data: { type: boolean } Redirect: type: object required: [from, to, code] properties: from: { type: string, pattern: '^/' } to: { type: string } code: { type: integer, enum: [301, 302, 307, 308] } # ---------------- envelopes ---------------- Error: type: object required: [error] properties: error: type: object required: [code, message, request_id] properties: code: type: string enum: [unauthenticated, mfa_required, forbidden, not_found, validation, conflict, insufficient_capacity, rate_limited, internal] message: { type: string } request_id: { type: string } details: type: array items: type: object properties: field: { type: string } reason: { type: string } ListMeta: type: object required: [data, next_cursor] properties: next_cursor: { type: [string, 'null'] } JobAccepted: type: object required: [job_id, status, resource_type, resource_id] properties: job_id: { $ref: '#/components/schemas/Uuid' } status: { type: string, const: queued } resource_type: type: string examples: [hosting_account, website, database, certificate, backup, restore, migration, brand_domain, reconcile] resource_id: { type: [string, 'null'], format: uuid } example: { job_id: 5b3c2d1e-0f9a-4b8c-9d7e-6f5a4b3c2d1e, status: queued, resource_type: hosting_account, resource_id: 7e6d5c4b-3a29-4180-9f8e-7d6c5b4a3928 } JobStatus: { type: string, enum: [queued, running, succeeded, failed, retrying, manual_review, cancelled] } JobStep: type: object required: [name, status] properties: name: { type: string, examples: [reserve_capacity, create_account, configure_runtime, create_dns, issue_tls, health_check, commit_active] } status: { type: string, enum: [pending, running, succeeded, failed, compensated, skipped] } at: { $ref: '#/components/schemas/Timestamp' } error: { type: string } Job: type: object required: [id, kind, status, attempts, steps] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } kind: { type: string, examples: [hosting.provision, hosting.suspend, site.create, backup.create, reconcile] } resource_type: { type: [string, 'null'] } resource_id: { type: [string, 'null'], format: uuid } status: { $ref: '#/components/schemas/JobStatus' } attempts: { type: integer } max_attempts: { type: integer } run_after: { $ref: '#/components/schemas/Timestamp' } deadline_at: { $ref: '#/components/schemas/NullableTimestamp' } steps: { type: array, items: { $ref: '#/components/schemas/JobStep' } } result: { type: [object, 'null'], additionalProperties: true } last_error: { type: [string, 'null'] } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } finished_at: { $ref: '#/components/schemas/NullableTimestamp' } created_by: { type: [string, 'null'], format: uuid } JobList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Job' } } } # ---------------- identity ---------------- User: type: object required: [id, email, name, mfa_enabled] properties: id: { $ref: '#/components/schemas/Uuid' } email: { type: string, format: email } name: { type: string } mfa_enabled: { type: boolean } status: { type: string, enum: [active, locked, disabled] } MembershipSummary: type: object required: [org_id, org_name, org_type, role] properties: org_id: { $ref: '#/components/schemas/Uuid' } org_name: { type: string } org_type: { $ref: '#/components/schemas/OrgType' } role: { $ref: '#/components/schemas/Role' } customer_id: { type: [string, 'null'], format: uuid } scopes: { type: array, items: { $ref: '#/components/schemas/Scope' } } LoginSuccess: type: object required: [user, memberships, access_token] properties: user: { $ref: '#/components/schemas/User' } memberships: { type: array, items: { $ref: '#/components/schemas/MembershipSummary' } } access_token: { type: string, description: 'JWT, short-lived (15 min)' } expires_in: { type: integer } MfaChallenge: type: object required: [mfa_required, mfa_token] properties: mfa_required: { type: boolean, const: true } mfa_token: { type: string, description: 'Opaque, single use, 5-minute lifetime' } Me: type: object required: [user, memberships, active_org_id, permissions] properties: user: { $ref: '#/components/schemas/User' } memberships: { type: array, items: { $ref: '#/components/schemas/MembershipSummary' } } active_org_id: { $ref: '#/components/schemas/Uuid' } permissions: { type: array, items: { type: string }, examples: [['hosting:write', 'billing:read']] } support_grant: { $ref: '#/components/schemas/SupportAccessGrant', description: Present when acting under a support grant } Session: type: object required: [id, created_at, expires_at] properties: id: { $ref: '#/components/schemas/Uuid' } user_id: { $ref: '#/components/schemas/Uuid' } mfa_passed: { type: boolean } ip: { type: [string, 'null'] } user_agent: { type: [string, 'null'] } current: { type: boolean, description: True for the session making this request } created_at: { $ref: '#/components/schemas/Timestamp' } expires_at: { $ref: '#/components/schemas/Timestamp' } revoked_at: { $ref: '#/components/schemas/NullableTimestamp' } revoked_reason: { type: [string, 'null'] } SessionList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Session' } } } # ---------------- organizations ---------------- Organization: type: object required: [id, type, status, name, slug, path, depth] properties: id: { $ref: '#/components/schemas/Uuid' } parent_id: { type: [string, 'null'], format: uuid } type: { $ref: '#/components/schemas/OrgType' } status: { type: string, enum: [active, suspended, closed] } name: { type: string } slug: { type: string } path: { type: string, description: "Materialized path '//...//'" } depth: { type: integer } reseller_depth_limit: { type: integer } allow_external_servers: { type: boolean } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } OrganizationCreate: type: object required: [name, slug, type, parent_id] properties: name: { type: string, minLength: 2, maxLength: 200 } slug: { type: string, pattern: '^[a-z0-9][a-z0-9-]{1,62}$' } type: { type: string, enum: [provider, reseller] } parent_id: { $ref: '#/components/schemas/Uuid' } OrganizationList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Organization' } } } Membership: type: object required: [id, org_id, user_id, role] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } user_id: { $ref: '#/components/schemas/Uuid' } user: { $ref: '#/components/schemas/User' } role: { $ref: '#/components/schemas/Role' } customer_id: { type: [string, 'null'], format: uuid } scopes: { type: array, items: { $ref: '#/components/schemas/Scope' } } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } MembershipList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Membership' } } } SupportAccessGrant: type: object required: [id, org_id, granted_to, reason_code, reason, expires_at] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } granted_to: { $ref: '#/components/schemas/Uuid' } reason_code: { type: string, enum: [incident, customer_request, abuse, billing_dispute, migration_assist] } reason: { type: string } ticket_ref: { type: [string, 'null'] } expires_at: { $ref: '#/components/schemas/Timestamp' } revoked_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { $ref: '#/components/schemas/Uuid' } SupportAccessGrantList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/SupportAccessGrant' } } } ApiKey: type: object required: [id, org_id, name, prefix, scopes] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } prefix: { type: string, examples: [wpk_7f3a2c] } scopes: { type: array, items: { $ref: '#/components/schemas/Scope' } } last_used_at: { $ref: '#/components/schemas/NullableTimestamp' } revoked_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } ApiKeyCreated: allOf: - $ref: '#/components/schemas/ApiKey' - type: object required: [key] properties: key: { type: string, pattern: '^wpk_', description: 'Full secret, shown exactly once' } ApiKeyList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/ApiKey' } } } # ---------------- white-label ---------------- BrandInput: allOf: - $ref: '#/components/schemas/BrandFields' - type: object required: [name] BrandFields: type: object properties: name: { type: string } logo_url: { type: string, format: uri } primary_color: { type: string, pattern: '^#[0-9a-fA-F]{6}$' } accent_color: { type: string, pattern: '^#[0-9a-fA-F]{6}$' } sender_name: { type: string } sender_email: { type: string, format: email } support_email: { type: string, format: email } legal_terms_url: { type: string, format: uri } legal_privacy_url: { type: string, format: uri } abuse_contact: { type: string, minLength: 3 } security_disclosure: { type: string, minLength: 10 } BrandPatch: allOf: - $ref: '#/components/schemas/BrandFields' - type: object minProperties: 1 Brand: allOf: - $ref: '#/components/schemas/BrandFields' - type: object required: [id, org_id, name, primary_color, accent_color, abuse_contact, security_disclosure] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } BrandList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Brand' } } } BrandDomain: type: object required: [id, brand_id, hostname, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } brand_id: { $ref: '#/components/schemas/Uuid' } hostname: { $ref: '#/components/schemas/Hostname' } status: { type: string, enum: [pending_verification, verified, tls_issuing, active, failed, removed] } verification: type: object required: [type, name, value] properties: type: { type: string, const: TXT } name: { type: string, examples: ['_wpanel-verify.billing.acmehost.in'] } value: { type: string } verified_at: { $ref: '#/components/schemas/NullableTimestamp' } tls_certificate_id: { type: [string, 'null'], format: uuid } removed_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } BrandDomainList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/BrandDomain' } } } PublicBrand: type: object required: [id, name, primary_color, accent_color, disclosures] properties: id: { $ref: '#/components/schemas/Uuid' } name: { type: string } logo_url: { type: [string, 'null'], format: uri } primary_color: { type: string } accent_color: { type: string } support_email: { type: [string, 'null'] } legal_terms_url: { type: [string, 'null'] } legal_privacy_url: { type: [string, 'null'] } disclosures: type: object required: [abuse_contact, security_disclosure] properties: abuse_contact: { type: string } security_disclosure: { type: string } # ---------------- infrastructure ---------------- Region: type: object required: [id, code, name, country, status] properties: id: { $ref: '#/components/schemas/Uuid' } code: { type: string } name: { type: string } country: { type: string } status: { type: string, enum: [active, draining, disabled] } created_at: { $ref: '#/components/schemas/Timestamp' } RegionList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Region' } } } Cluster: type: object required: [id, region_id, name, role, storage_profile, status] properties: id: { $ref: '#/components/schemas/Uuid' } region_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } role: { type: string, enum: [web, mail, dns, db, backup] } storage_profile: { type: string, enum: [ceph, local_nvme] } status: { type: string, enum: [active, draining, disabled] } created_at: { $ref: '#/components/schemas/Timestamp' } ClusterList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Cluster' } } } NodeStatus: { type: string, enum: [provisioning, active, draining, maintenance, offline, retired] } Node: type: object required: [id, cluster_id, hostname, ip_address, kind, os, status, health] properties: id: { $ref: '#/components/schemas/Uuid' } cluster_id: { $ref: '#/components/schemas/Uuid' } hostname: { type: string } ip_address: { type: string } kind: { type: string, enum: [vm, baremetal] } os: { type: string, examples: [almalinux-9] } status: { $ref: '#/components/schemas/NodeStatus' } health: { type: string, enum: [healthy, degraded, unhealthy, unknown] } labels: { type: object, additionalProperties: { type: string } } capacity: { $ref: '#/components/schemas/NodeCapacity' } allocated: { $ref: '#/components/schemas/NodeCapacity' } observed: { type: object, additionalProperties: true, description: Agent-reported usage } agent_version: { type: [string, 'null'] } agent_cert_fingerprint: { type: [string, 'null'] } agent_cert_expires_at: { $ref: '#/components/schemas/NullableTimestamp' } last_heartbeat_at: { $ref: '#/components/schemas/NullableTimestamp' } last_seq: { type: integer, format: int64 } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } NodeList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Node' } } } CapacityTotals: type: object properties: capacity: { $ref: '#/components/schemas/NodeCapacity' } allocated: { $ref: '#/components/schemas/NodeCapacity' } observed: { $ref: '#/components/schemas/NodeCapacity' } nodes: { type: integer } healthy_nodes: { type: integer } CapacitySummary: type: object required: [regions] properties: regions: type: array items: allOf: - $ref: '#/components/schemas/CapacityTotals' - type: object properties: region_id: { $ref: '#/components/schemas/Uuid' } region_code: { type: string } clusters: type: array items: allOf: - $ref: '#/components/schemas/CapacityTotals' - type: object properties: cluster_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } role: { type: string } Alert: type: object required: [name, severity, state] properties: name: { type: string, examples: [WpanelNodeDown] } severity: { type: string, enum: [critical, warning, info] } state: { type: string, enum: [firing, pending, resolved] } summary: { type: string } labels: { type: object, additionalProperties: { type: string } } runbook_url: { type: string } started_at: { $ref: '#/components/schemas/Timestamp' } OpsOverview: type: object properties: slo: type: object properties: availability_30d: { type: number, description: 'Ratio, target 0.999' } read_p95_ms: { type: number, description: Target < 500 } provisioning_p95_seconds: { type: number, description: Target < 300 } backup_max_age_hours: { type: number, description: RPO target 24 } error_budget_remaining: { type: number } metrics: type: object properties: jobs_queued: { type: integer } outbox_lag_seconds: { type: number } nodes_up: { type: integer } nodes_total: { type: integer } payment_failures_24h: { type: integer } mail_queue_total: { type: integer } certificates_expiring_14d: { type: integer } alerts: { type: array, items: { $ref: '#/components/schemas/Alert' } } Readiness: type: object properties: status: { type: string, enum: [ok, degraded, unavailable] } checks: type: object additionalProperties: { type: string, enum: [ok, fail] } examples: [{ database: ok, redis: ok, migrations: ok }] # ---------------- pools & plans ---------------- ResourcePool: type: object required: [id, org_id, region_id, name, limits, reserved, oversell_ratio, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } region_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } parent_allocation_id: { type: [string, 'null'], format: uuid } limits: { $ref: '#/components/schemas/Limits' } reserved: { $ref: '#/components/schemas/Limits' } available: { $ref: '#/components/schemas/Limits', description: 'limits × oversell_ratio − reserved' } oversell_ratio: { type: number, minimum: 1, maximum: 4 } status: { type: string, enum: [active, frozen] } version: { type: integer, format: int64 } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } ResourcePoolList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/ResourcePool' } } } Allocation: type: object required: [id, org_id, pool_id, child_org_id, limits, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } pool_id: { $ref: '#/components/schemas/Uuid' } child_org_id: { $ref: '#/components/schemas/Uuid' } limits: { $ref: '#/components/schemas/Limits' } status: { type: string, enum: [active, released] } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } AllocationResult: allOf: - $ref: '#/components/schemas/Allocation' - type: object properties: child_pool_id: { type: [string, 'null'], format: uuid } child_pool: { $ref: '#/components/schemas/ResourcePool' } PlanVersion: type: object required: [id, plan_id, version, limits, features, isolation] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } plan_id: { $ref: '#/components/schemas/Uuid' } version: { type: integer, minimum: 1 } limits: { $ref: '#/components/schemas/Limits' } features: { $ref: '#/components/schemas/PlanFeatures' } isolation: { type: string, enum: [standard, hardened] } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } Plan: type: object required: [id, org_id, code, name, kind, status, current_version] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } code: { type: string } name: { type: string } kind: { type: string, enum: [wholesale, retail] } status: { type: string, enum: [active, retired] } current_version: { type: integer } plan_version_id: { $ref: '#/components/schemas/Uuid', description: Id of the current version (convenience) } versions: { type: array, items: { $ref: '#/components/schemas/PlanVersion' } } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } PlanList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Plan' } } } # ---------------- customers & hosting ---------------- Customer: type: object required: [id, org_id, name, email, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } email: { type: string, format: email } company: { type: [string, 'null'] } gstin: { type: [string, 'null'] } billing_address: { $ref: '#/components/schemas/Address' } state_code: { type: [string, 'null'] } status: { type: string, enum: [active, suspended, closed] } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } CustomerList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Customer' } } } HostingAccountStatus: type: string enum: [pending, provisioning, active, failed, manual_review, suspended, migrating, terminating, terminated] HostingAccount: type: object required: [id, org_id, customer_id, plan_version_id, pool_id, region_id, username, primary_domain, status, suspension, limits] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } plan_version_id: { $ref: '#/components/schemas/Uuid' } pool_id: { $ref: '#/components/schemas/Uuid' } region_id: { $ref: '#/components/schemas/Uuid' } node_id: { type: [string, 'null'], format: uuid, description: Hidden (null) for customer roles } username: { type: string } linux_uid: { type: [integer, 'null'] } primary_domain: { type: string } status: { $ref: '#/components/schemas/HostingAccountStatus' } suspension: { $ref: '#/components/schemas/Suspension' } suspension_reason: { type: [string, 'null'] } limits: { $ref: '#/components/schemas/Limits' } usage: { type: object, additionalProperties: true } desired_state: { type: object, additionalProperties: true } observed_state: { type: object, additionalProperties: true } billing_authority: { type: string, enum: [native, external] } subscription_id: { type: [string, 'null'], format: uuid } retention_until: { $ref: '#/components/schemas/NullableTimestamp' } terminated_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } HostingAccountList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/HostingAccount' } } } AccountActionRequest: type: object required: [action] properties: action: { type: string, enum: [suspend, unsuspend, resize, terminate, backup, restore, migrate] } params: oneOf: - title: SuspendParams type: object required: [reason] properties: web: { type: boolean, default: true } mail: { type: boolean, default: false } data: { type: boolean, default: false } reason: { type: string } - title: ResizeParams type: object required: [plan_version_id] properties: plan_version_id: { $ref: '#/components/schemas/Uuid' } - title: TerminateParams type: object required: [confirm_username, retention_days] properties: confirm_username: { type: string } retention_days: { type: integer, minimum: 0, maximum: 90 } - title: BackupParams type: object required: [kind] properties: kind: { type: string, enum: [full, files, databases, mail, config] } - title: RestoreParams type: object required: [backup_id, target] properties: backup_id: { $ref: '#/components/schemas/Uuid' } target: { type: string, enum: [staging, alternate_node, in_place] } - title: MigrateParams type: object required: [region_code] properties: target_node_id: { $ref: '#/components/schemas/Uuid' } region_code: { type: string } - title: EmptyParams type: object maxProperties: 0 Website: type: object required: [id, org_id, customer_id, hosting_account_id, domain, kind, document_root, php_version, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } hosting_account_id: { $ref: '#/components/schemas/Uuid' } domain: { type: string } kind: { type: string, enum: [primary, addon, subdomain, staging] } document_root: { type: string } php_version: { type: string } php_extensions: { type: array, items: { type: string } } app: { type: string, enum: [none, wordpress, php, node, python] } app_meta: { type: object, additionalProperties: true } redirects: { type: array, items: { $ref: '#/components/schemas/Redirect' } } staging_of: { type: [string, 'null'], format: uuid } status: { type: string, enum: [pending, active, suspended, failed, deleting, deleted] } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } WebsiteList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Website' } } } DirectoryListing: type: object required: [path, entries] properties: path: { type: string } entries: type: array items: type: object required: [name, type] properties: name: { type: string } type: { type: string, enum: [file, dir, symlink] } size: { type: integer, format: int64 } modified: { $ref: '#/components/schemas/Timestamp' } FileContent: type: object required: [path, content] properties: path: { type: string } content: { type: string } CronJob: type: object required: [id, website_id, schedule, command, enabled] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } website_id: { $ref: '#/components/schemas/Uuid' } schedule: { type: string } command: { type: string } enabled: { type: boolean } created_at: { $ref: '#/components/schemas/Timestamp' } CronJobList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/CronJob' } } } Database: type: object required: [id, hosting_account_id, engine, name, db_user, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } hosting_account_id: { $ref: '#/components/schemas/Uuid' } engine: { type: string, enum: [mariadb, mysql, postgresql] } name: { type: string } db_user: { type: string } size_mb: { type: integer } status: { type: string, enum: [pending, active, failed, deleted] } created_at: { $ref: '#/components/schemas/Timestamp' } DatabaseList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Database' } } } # ---------------- DNS / TLS / mail ---------------- Domain: type: object required: [id, org_id, customer_id, name, dns_mode] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } dns_mode: { type: string, enum: [managed, external] } ownership_token: { type: string, description: 'Publish as TXT `_wpanel-verify.`' } verified_at: { $ref: '#/components/schemas/NullableTimestamp' } registrar: { type: [string, 'null'] } expires_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } DomainList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Domain' } } } DnsRecordType: { type: string, enum: [A, AAAA, CNAME, MX, TXT, CAA, SRV, NS] } DnsRecord: type: object required: [id, zone_id, name, type, content, ttl] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } zone_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } type: { $ref: '#/components/schemas/DnsRecordType' } content: { type: string } ttl: { type: integer, minimum: 60, maximum: 86400 } priority: { type: [integer, 'null'] } created_at: { $ref: '#/components/schemas/Timestamp' } DnsZone: type: object required: [id, domain_id, name, serial, nameservers, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } domain_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } serial: { type: integer, format: int64 } nameservers: { type: array, items: { type: string } } template: { type: [string, 'null'] } status: { type: string, enum: [pending, active, error] } records: { type: array, items: { $ref: '#/components/schemas/DnsRecord' }, description: 'Included on GET /v1/dns/zones/{id}' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } DnsZoneList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/DnsZone' } } } Certificate: type: object required: [id, org_id, common_name, sans, issuer, challenge, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { type: [string, 'null'], format: uuid } common_name: { type: string } sans: { type: array, items: { type: string } } issuer: { type: string } challenge: { type: string, enum: [http-01, dns-01] } status: { type: string, enum: [pending, issuing, active, renewing, failed, expired, revoked] } attempts: { type: integer } last_error: { type: [string, 'null'] } not_before: { $ref: '#/components/schemas/NullableTimestamp' } not_after: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } CertificateList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Certificate' } } } Mailbox: type: object required: [id, hosting_account_id, address, kind, quota_mb, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } hosting_account_id: { $ref: '#/components/schemas/Uuid' } address: { type: string, format: email } kind: { type: string, enum: [mailbox, alias, forward] } destinations: { type: array, items: { type: string, format: email } } quota_mb: { type: integer } used_mb: { type: integer } send_rate_per_hour: { type: integer } status: { type: string, enum: [pending, active, suspended, deleted] } created_at: { $ref: '#/components/schemas/Timestamp' } MailboxList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Mailbox' } } } MailAuth: type: object required: [spf, dkim, dmarc] properties: domain: { type: string } spf: { type: string, examples: ['v=spf1 include:_spf.wpanel.net -all'] } dkim: type: object required: [selector, record] properties: selector: { type: string, examples: [wp2026] } record: { type: string } dmarc: { type: string, examples: ['v=DMARC1; p=quarantine; rua=mailto:dmarc@wpanel.net'] } published: { type: object, additionalProperties: { type: boolean }, description: Whether each record is currently visible in DNS } MailQueueStats: type: object properties: total: { type: integer } deferred: { type: integer } active: { type: integer } nodes: type: array items: type: object properties: node: { type: string } size: { type: integer } deferred: { type: integer } oldest_age_seconds: { type: integer } top_senders: type: array items: type: object properties: hosting_account_id: { $ref: '#/components/schemas/Uuid' } queued: { type: integer } # ---------------- backups & migrations ---------------- Backup: type: object required: [id, hosting_account_id, kind, trigger, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } hosting_account_id: { $ref: '#/components/schemas/Uuid' } kind: { type: string, enum: [full, files, databases, mail, config] } trigger: { type: string, enum: [manual, scheduled, pre_migration, pre_termination] } status: { type: string, enum: [pending, running, completed, failed, expired] } size_bytes: { type: [integer, 'null'], format: int64 } sha256: { type: [string, 'null'] } immutable_until: { $ref: '#/components/schemas/NullableTimestamp' } retention_until: { $ref: '#/components/schemas/NullableTimestamp' } completed_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } restores: { type: array, items: { $ref: '#/components/schemas/Restore' }, description: Restores started from this backup } description: '`storage_url` and `encryption_key_ref` are internal and never returned.' BackupList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Backup' } } } Restore: type: object required: [id, backup_id, target, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } backup_id: { $ref: '#/components/schemas/Uuid' } target: { type: string, enum: [staging, alternate_node, in_place] } status: { type: string, enum: [pending, running, validating, completed, failed, promoted] } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } Migration: type: object required: [id, org_id, customer_id, source_kind, source_ref, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } hosting_account_id: { type: [string, 'null'], format: uuid } source_kind: { type: string, enum: [cpanel_backup, whm_metadata] } source_ref: { type: string } status: type: string enum: [preflight, preflight_failed, staging, validating, ready_for_cutover, syncing, cut_over, accepted, rolled_back, failed] preflight: type: object additionalProperties: true description: 'Per-check results, e.g. {"php":"ok","disk":"ok","dns":"warn","mail":"ok","databases":"ok"}' unsupported: { type: array, items: { type: object, additionalProperties: true } } report: { type: object, additionalProperties: true } authorized_by: { $ref: '#/components/schemas/Uuid' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } MigrationList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Migration' } } } # ---------------- events, webhooks, audit ---------------- EventType: type: string enum: [order.paid, hosting.provisioned, hosting.failed, subscription.past_due, account.suspended, backup.completed] Event: type: object description: Event envelope; `data` schemas per type live in api/events/*.schema.json. Never contains credentials. required: [id, type, version, org_id, occurred_at, resource, data] properties: id: { $ref: '#/components/schemas/Uuid' } type: { $ref: '#/components/schemas/EventType' } version: { type: integer, minimum: 1 } org_id: { $ref: '#/components/schemas/Uuid' } occurred_at: { $ref: '#/components/schemas/Timestamp' } resource: type: object required: [type, id] properties: type: { type: string } id: { $ref: '#/components/schemas/Uuid' } data: { type: object, additionalProperties: true } EventList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Event' } } } WebhookEndpoint: type: object required: [id, org_id, url, event_types, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } url: { type: string, format: uri } event_types: { type: array, items: { type: string } } status: { type: string, enum: [active, disabled] } created_at: { $ref: '#/components/schemas/Timestamp' } WebhookEndpointList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/WebhookEndpoint' } } } AuditEvent: type: object required: [id, org_id, actor_type, action, occurred_at] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } actor_id: { type: [string, 'null'], format: uuid } actor_type: { type: string, enum: [user, api_key, system, agent, support] } action: { type: string, examples: [hosting_account.suspend, support_access.create, invoice.issue] } resource_type: { type: [string, 'null'] } resource_id: { type: [string, 'null'] } ip: { type: [string, 'null'] } request_id: { type: [string, 'null'] } support_grant_id: { type: [string, 'null'], format: uuid } metadata: { type: object, additionalProperties: true } occurred_at: { $ref: '#/components/schemas/Timestamp' } AuditEventList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/AuditEvent' } } } Decision: type: object required: [key, title, value, options, status, owner] properties: key: { type: string, examples: [reseller_depth] } title: { type: string } value: { description: Current proposed or approved value (any JSON) } options: { type: array, items: {} } status: { type: string, enum: [proposed, approved, superseded] } owner: { type: string, examples: [Product lead] } approved_by: { type: [string, 'null'], format: uuid } approved_at: { $ref: '#/components/schemas/NullableTimestamp' } notes: { type: [string, 'null'] } updated_at: { $ref: '#/components/schemas/Timestamp' } # ---------------- commerce ---------------- CatalogPrice: type: object required: [id, billing_cycle, currency, amount_minor] properties: id: { $ref: '#/components/schemas/Uuid' } billing_cycle: { $ref: '#/components/schemas/BillingCycle' } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { $ref: '#/components/schemas/MinorAmount' } setup_fee_minor: { $ref: '#/components/schemas/MinorAmount' } Catalog: type: object required: [brand, products] properties: brand: { $ref: '#/components/schemas/PublicBrand' } products: type: array items: type: object required: [id, name, prices] properties: id: { $ref: '#/components/schemas/Uuid' } name: { type: string } description: { type: [string, 'null'] } features: { type: array, items: { type: string } } kind: { type: string } limits: { $ref: '#/components/schemas/Limits', description: Current plan version limits for comparison } prices: { type: array, items: { $ref: '#/components/schemas/CatalogPrice' } } Product: type: object required: [id, org_id, kind, name, visible] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } brand_id: { type: [string, 'null'], format: uuid } plan_id: { type: [string, 'null'], format: uuid } kind: { type: string, enum: [hosting, domain, addon, backup, managed_service] } name: { type: string } description: { type: [string, 'null'] } features: { type: array, items: { type: string } } visible: { type: boolean } sort_order: { type: integer } prices: { type: array, items: { $ref: '#/components/schemas/Price' } } created_at: { $ref: '#/components/schemas/Timestamp' } ProductList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Product' } } } Price: type: object required: [id, product_id, billing_cycle, currency, amount_minor, setup_fee_minor, active] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } product_id: { $ref: '#/components/schemas/Uuid' } billing_cycle: { $ref: '#/components/schemas/BillingCycle' } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { $ref: '#/components/schemas/MinorAmount' } setup_fee_minor: { $ref: '#/components/schemas/MinorAmount' } active: { type: boolean } created_at: { $ref: '#/components/schemas/Timestamp' } Coupon: type: object required: [id, org_id, code, redemptions] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } code: { type: string } percent_bp: { type: [integer, 'null'] } amount_minor: { type: [integer, 'null'], format: int64 } currency: { type: [string, 'null'] } max_redemptions: { type: [integer, 'null'] } redemptions: { type: integer } valid_from: { $ref: '#/components/schemas/Timestamp' } valid_until: { $ref: '#/components/schemas/NullableTimestamp' } applies_to: { type: array, items: { $ref: '#/components/schemas/Uuid' } } created_at: { $ref: '#/components/schemas/Timestamp' } CouponList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Coupon' } } } CartItem: type: object required: [price_id] properties: price_id: { $ref: '#/components/schemas/Uuid' } quantity: { type: integer, minimum: 1, default: 1 } domain: { $ref: '#/components/schemas/Hostname' } Totals: type: object required: [currency, subtotal_minor, discount_minor, tax_minor, total_minor] properties: currency: { $ref: '#/components/schemas/Currency' } subtotal_minor: { $ref: '#/components/schemas/MinorAmount' } discount_minor: { $ref: '#/components/schemas/MinorAmount' } tax_minor: { $ref: '#/components/schemas/MinorAmount' } total_minor: { $ref: '#/components/schemas/MinorAmount' } tax_breakdown: { $ref: '#/components/schemas/TaxBreakdown' } TaxBreakdown: type: object properties: cgst: { $ref: '#/components/schemas/MinorAmount' } sgst: { $ref: '#/components/schemas/MinorAmount' } igst: { $ref: '#/components/schemas/MinorAmount' } Cart: type: object required: [id, org_id, currency, items, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } brand_id: { type: [string, 'null'], format: uuid } customer_id: { type: [string, 'null'], format: uuid } currency: { $ref: '#/components/schemas/Currency' } items: { type: array, items: { $ref: '#/components/schemas/CartItem' } } coupon_code: { type: [string, 'null'] } status: { type: string, enum: [open, converted, abandoned] } totals: { $ref: '#/components/schemas/Totals' } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } OrderStatus: type: string description: 'draft → pending_payment → paid_provisioning → active; failures → provisioning_retry → manual_review → refund_review → refunded; cancelled.' enum: [draft, pending_payment, paid_provisioning, active, provisioning_retry, manual_review, cancelled, refund_review, refunded] OrderItem: type: object required: [id, order_id, product_id, price_id, description, billing_cycle, quantity, unit_minor, total_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } order_id: { $ref: '#/components/schemas/Uuid' } product_id: { $ref: '#/components/schemas/Uuid' } price_id: { $ref: '#/components/schemas/Uuid' } plan_version_id: { type: [string, 'null'], format: uuid } description: { type: string } billing_cycle: { type: string } quantity: { type: integer, minimum: 1 } unit_minor: { type: integer, format: int64 } discount_minor: { type: integer, format: int64 } tax_rate_bp: { type: integer } tax_minor: { type: integer, format: int64 } total_minor: { type: integer, format: int64 } domain: { type: [string, 'null'] } hosting_account_id: { type: [string, 'null'], format: uuid } Order: type: object required: [id, org_id, customer_id, number, status, currency, subtotal_minor, discount_minor, tax_minor, total_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } brand_id: { type: [string, 'null'], format: uuid } cart_id: { type: [string, 'null'], format: uuid } number: { type: string, examples: [ORD-2026-000042] } status: { $ref: '#/components/schemas/OrderStatus' } currency: { $ref: '#/components/schemas/Currency' } subtotal_minor: { type: integer, format: int64 } discount_minor: { type: integer, format: int64 } tax_minor: { type: integer, format: int64 } total_minor: { type: integer, format: int64 } pricing_snapshot: { type: object, additionalProperties: true } terms_accepted_at: { $ref: '#/components/schemas/NullableTimestamp' } terms_version: { type: [string, 'null'] } billing_authority: { type: string, enum: [native, external] } payment_provider: { type: [string, 'null'] } provider_order_id: { type: [string, 'null'] } region_code: { type: [string, 'null'] } items: { type: array, items: { $ref: '#/components/schemas/OrderItem' } } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } OrderList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Order' } } } CheckoutSession: type: object required: [provider, checkout] properties: provider: { type: string, enum: [razorpay, stripe, paypal, sim] } checkout: type: object required: [key_id, order_id, amount, currency] additionalProperties: true properties: key_id: { type: string, description: Publishable key of the seller's merchant account } order_id: { type: string, description: Provider order id } amount: { type: integer, format: int64 } currency: { $ref: '#/components/schemas/Currency' } name: { type: string } description: { type: string } prefill: { type: object, properties: { name: { type: string }, email: { type: string } } } PaymentWebhookAck: type: object required: [received] properties: received: { type: boolean } duplicate: { type: boolean } processing_status: { type: string, enum: [received, processed, rejected, ignored] } order_id: { type: [string, 'null'], format: uuid } order_status: { $ref: '#/components/schemas/OrderStatus' } SubscriptionStatus: { type: string, enum: [active, past_due, suspended, cancellation_pending, terminated] } Subscription: type: object required: [id, org_id, customer_id, product_id, price_id, status, payment_state, billing_cycle, currency, amount_minor, current_period_start, current_period_end, billing_authority] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { $ref: '#/components/schemas/Uuid' } order_id: { type: [string, 'null'], format: uuid } product_id: { $ref: '#/components/schemas/Uuid' } price_id: { $ref: '#/components/schemas/Uuid' } plan_version_id: { type: [string, 'null'], format: uuid } hosting_account_id: { type: [string, 'null'], format: uuid } status: { $ref: '#/components/schemas/SubscriptionStatus' } payment_state: { type: string, enum: [current, overdue, failed, refunded] } billing_cycle: { type: string } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { type: integer, format: int64 } current_period_start: { $ref: '#/components/schemas/Timestamp' } current_period_end: { $ref: '#/components/schemas/Timestamp' } grace_days: { type: integer } dunning_step: { type: integer } cancel_at_period_end: { type: boolean } billing_authority: { type: string, enum: [native, external] } billing_adapter_id: { type: [string, 'null'], format: uuid } external_ref: { type: [string, 'null'] } created_at: { $ref: '#/components/schemas/Timestamp' } updated_at: { $ref: '#/components/schemas/Timestamp' } SubscriptionList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Subscription' } } } InvoiceStatus: { type: string, enum: [draft, issued, paid, partially_paid, void, uncollectible] } InvoiceLine: type: object required: [id, invoice_id, description, quantity, unit_minor, total_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } invoice_id: { $ref: '#/components/schemas/Uuid' } description: { type: string } sac_code: { type: [string, 'null'] } quantity: { type: integer } unit_minor: { type: integer, format: int64 } discount_minor: { type: integer, format: int64 } tax_rate_bp: { type: integer } tax_minor: { type: integer, format: int64 } total_minor: { type: integer, format: int64 } period_start: { $ref: '#/components/schemas/NullableTimestamp' } period_end: { $ref: '#/components/schemas/NullableTimestamp' } CreditNote: type: object required: [id, invoice_id, number, reason, currency, amount_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } invoice_id: { $ref: '#/components/schemas/Uuid' } number: { type: string, examples: [CN/2026-27/000003] } reason: { type: string } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { type: integer, format: int64 } tax_minor: { type: integer, format: int64 } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } Invoice: type: object description: Issued invoices are immutable (DB trigger); corrections use credit notes. required: [id, org_id, book, status, currency, subtotal_minor, discount_minor, tax_minor, total_minor, amount_paid_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid', description: Issuer } book: { $ref: '#/components/schemas/Book' } customer_id: { type: [string, 'null'], format: uuid } billed_org_id: { type: [string, 'null'], format: uuid } subscription_id: { type: [string, 'null'], format: uuid } order_id: { type: [string, 'null'], format: uuid } number: { type: [string, 'null'], examples: [INV/2026-27/000123] } status: { $ref: '#/components/schemas/InvoiceStatus' } currency: { $ref: '#/components/schemas/Currency' } subtotal_minor: { type: integer, format: int64 } discount_minor: { type: integer, format: int64 } tax_minor: { type: integer, format: int64 } total_minor: { type: integer, format: int64 } amount_paid_minor: { type: integer, format: int64 } supplier_gstin: { type: [string, 'null'] } customer_gstin: { type: [string, 'null'] } place_of_supply: { type: [string, 'null'] } tax_breakdown: { $ref: '#/components/schemas/TaxBreakdown' } issued_at: { $ref: '#/components/schemas/NullableTimestamp' } due_at: { $ref: '#/components/schemas/NullableTimestamp' } paid_at: { $ref: '#/components/schemas/NullableTimestamp' } created_at: { $ref: '#/components/schemas/Timestamp' } lines: { type: array, items: { $ref: '#/components/schemas/InvoiceLine' } } credit_notes: { type: array, items: { $ref: '#/components/schemas/CreditNote' } } payments: { type: array, items: { $ref: '#/components/schemas/Payment' }, description: Payments applied to this invoice } InvoiceList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/Invoice' } } } Payment: type: object required: [id, org_id, provider, provider_payment_id, status, currency, amount_minor] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } customer_id: { type: [string, 'null'], format: uuid } order_id: { type: [string, 'null'], format: uuid } invoice_id: { type: [string, 'null'], format: uuid } provider: { type: string } provider_payment_id: { type: string } provider_order_id: { type: [string, 'null'] } status: { type: string, enum: [authorized, captured, failed, refunded, partially_refunded] } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { type: integer, format: int64 } fee_minor: { type: integer, format: int64 } settled_at: { $ref: '#/components/schemas/NullableTimestamp' } settlement_ref: { type: [string, 'null'] } created_at: { $ref: '#/components/schemas/Timestamp' } Refund: type: object required: [id, payment_id, status, currency, amount_minor, reason] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } payment_id: { $ref: '#/components/schemas/Uuid' } credit_note_id: { type: [string, 'null'], format: uuid } provider_refund_id: { type: [string, 'null'] } status: { type: string, enum: [requested, review, processing, processed, failed] } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { type: integer, format: int64 } reason: { type: string } created_at: { $ref: '#/components/schemas/Timestamp' } created_by: { type: [string, 'null'], format: uuid } LedgerAccount: { type: string, enum: [receivable, revenue, tax_payable, cash, wallet, refunds, credit_notes] } LedgerEntry: type: object required: [id, org_id, book, account, direction, currency, amount_minor, txn_id] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } book: { $ref: '#/components/schemas/Book' } account: { $ref: '#/components/schemas/LedgerAccount' } customer_id: { type: [string, 'null'], format: uuid } counterparty_org_id: { type: [string, 'null'], format: uuid } invoice_id: { type: [string, 'null'], format: uuid } payment_id: { type: [string, 'null'], format: uuid } direction: { type: string, enum: [debit, credit] } currency: { $ref: '#/components/schemas/Currency' } amount_minor: { type: integer, format: int64, minimum: 1 } memo: { type: [string, 'null'] } txn_id: { $ref: '#/components/schemas/Uuid', description: Groups balanced postings } created_at: { $ref: '#/components/schemas/Timestamp' } LedgerEntryList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/LedgerEntry' } } } Wallet: type: object required: [customer_id, balances, entries] properties: customer_id: { $ref: '#/components/schemas/Uuid' } balances: type: array items: type: object required: [currency, balance_minor] properties: currency: { $ref: '#/components/schemas/Currency' } balance_minor: { type: integer, format: int64 } entries: { type: array, items: { $ref: '#/components/schemas/LedgerEntry' } } TaxProfile: type: object required: [id, org_id, name, country, legal_name, state_code, default_rate_bp, sac_code, invoice_prefix] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } name: { type: string } country: { type: string } gstin: { type: [string, 'null'] } legal_name: { type: string } state_code: { type: string } address: { $ref: '#/components/schemas/Address' } default_rate_bp: { type: integer } sac_code: { type: string } invoice_prefix: { type: string } created_at: { $ref: '#/components/schemas/Timestamp' } TaxProfileList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/TaxProfile' } } } BillingAdapter: type: object required: [id, org_id, kind, name, status] properties: id: { $ref: '#/components/schemas/Uuid' } org_id: { $ref: '#/components/schemas/Uuid' } kind: { type: string, enum: [native, whmcs, blesta, hostbill, custom] } name: { type: string } config: { type: object, additionalProperties: true } api_key_id: { type: [string, 'null'], format: uuid } status: { type: string, enum: [active, disabled] } created_at: { $ref: '#/components/schemas/Timestamp' } BillingAdapterList: allOf: - $ref: '#/components/schemas/ListMeta' - properties: { data: { type: array, items: { $ref: '#/components/schemas/BillingAdapter' } } } ExternalAccountCreate: type: object required: [external_ref, customer, plan_version_id, region_code, domain] properties: external_ref: { type: string, pattern: '^[A-Za-z0-9._:-]{1,128}$', examples: [whmcs-1042] } customer: type: object required: [name, email] properties: name: { type: string } email: { type: string, format: email } company: { type: string } state_code: { $ref: '#/components/schemas/StateCode' } plan_version_id: { $ref: '#/components/schemas/Uuid' } region_code: { type: string, examples: [in-mum-1] } pool_id: { $ref: '#/components/schemas/Uuid' } domain: { $ref: '#/components/schemas/Hostname' } username: { type: string, pattern: '^[a-z][a-z0-9]{2,15}$', description: Optional preferred Linux username } ExternalUsage: type: object required: [external_ref, disk_used_mb, disk_limit_mb, bandwidth_used_mb, bandwidth_limit_mb] properties: external_ref: { type: string } hosting_account_id: { $ref: '#/components/schemas/Uuid' } status: { $ref: '#/components/schemas/HostingAccountStatus' } disk_used_mb: { type: integer } disk_limit_mb: { type: integer } bandwidth_used_mb: { type: integer } bandwidth_limit_mb: { type: integer } measured_at: { $ref: '#/components/schemas/Timestamp' } # ---------------- node agent ---------------- AgentTask: type: object required: [id, operation, params, nonce, signature, deadline_at] properties: id: { $ref: '#/components/schemas/Uuid' } job_id: { type: [string, 'null'], format: uuid } operation: type: string description: Allowlisted typed operation (no arbitrary shell), e.g. account.create, account.suspend, site.configure, php_pool.apply, quota.set, cert.install, backup.run params: { type: object, additionalProperties: true } nonce: { type: string } signature: { type: string, description: 'Ed25519 signature over (id, operation, params, nonce, deadline_at)' } deadline_at: { $ref: '#/components/schemas/Timestamp' } AgentReport: type: object required: [seq, health] properties: seq: { type: integer, format: int64, description: Strictly increasing per node } agent_version: { type: string } health: { type: string, enum: [healthy, degraded, unhealthy] } inventory: type: object additionalProperties: true description: 'OS, kernel, PHP versions, cgroup v2 controllers, quota state' observed: { $ref: '#/components/schemas/NodeCapacity' } accounts: type: array items: type: object required: [username] properties: username: { type: string } state: { type: object, additionalProperties: true } usage: { type: object, additionalProperties: true } mail_queue_size: { type: integer }