Guardian Hub API Guide — Complete Reference

Audience: Developers integrating with Guardian Hub  |  Version: v1  |  Last updated: March 2026

1. Overview

The Guardian Hub API provides programmatic access to the entire platform: manage WordPress sites, configure Autopilot automation, handle billing, process tickets, and receive real-time notifications. Every action available in the web dashboard can be performed through the API.

Base URL

All API endpoints are served under the /api/v1/ prefix:

https://guardian.bluix.net/api/v1/

If your tenant uses a white-label domain, replace the host accordingly (e.g. https://manage.youragency.com/api/v1/).

Versioning

The API is versioned via the URL path. The current and only stable version is v1. Breaking changes will be introduced in a new version prefix (e.g. /api/v2/) and the previous version will remain available for at least 12 months after deprecation notice.

Tip

A quick way to verify the API is reachable: send GET /api/v1/ and expect a JSON response with "status": "ok" and "service": "guardian-hub".

2. Authentication

Guardian Hub supports three authentication mechanisms depending on the use case.

2.1 Sanctum Token (Primary)

The recommended method for web and mobile clients. Obtain a token by posting credentials to the login endpoint:

POST /api/v1/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your-password"
}

The response includes a bearer token:

{
  "success": true,
  "status": "success",
  "message": "Success",
  "data": {
    "token": "1|abc123def456...",
    "user": { "id": 1, "name": "John", "email": "user@example.com", ... }
  }
}

Include the token in all subsequent requests:

Authorization: Bearer 1|abc123def456...

2.2 Passport OAuth (Alexa / Third-Party)

For voice assistants and third-party integrations, Guardian Hub uses Laravel Passport with scoped tokens. Alexa endpoints require scope:alexa.read or scope:alexa.action via OAuth bearer tokens obtained through the standard OAuth2 authorization code flow.

2.3 API Key (Plugin / Agent)

The WordPress plugin (GuardianPlug) authenticates using a site-specific API key and HMAC signature. License endpoints under /api/v1/licenses are protected by API key, not Sanctum. The Autopilot handshake and telemetry endpoints use a dedicated autopilot.signature middleware.

2.4 Social Auth

Users can authenticate via Google, Apple, Microsoft, or custom OIDC providers. The flow uses redirect/callback endpoints under /api/v1/auth/social/{provider}/.

Quick Start: Get a Token
  1. Register an account via the dashboard or POST /api/v1/register.
  2. Call POST /api/v1/login with email and password.
  3. Store the token from the response securely.
  4. Send Authorization: Bearer {token} with every request.
  5. Verify with GET /api/v1/auth/me to confirm the token works.
Warning

The login endpoint is rate-limited to 5 requests per minute. Implement exponential backoff if you receive a 429 response. Never store tokens in client-side JavaScript accessible to third-party scripts.

3. Rate Limiting

Rate limits vary by endpoint category to balance availability and fair usage.

CategoryLimitApplies To
Auth (login)5 req/minPOST /login
Auth (register)Standard auth throttlePOST /register
Public endpointsapi.public throttleCheckout catalog, translations, white-label config
General API60 req/minHealth, autopilot defaults/catalog
Telemetry120 req/minPlugin and product telemetry
Autopilot (agent)120 req/minHandshake, telemetry from plugin
Webhooks30-60 req/minWhatsApp/WeChat inbound
Tickets (create)tickets.create throttleNew ticket creation
Tickets (message)tickets.message throttleAdding messages to tickets
Heavy operationsapi.heavy throttleAI digests, AI insights
Admin operationsadmin throttleSystem ops, Stripe admin, feature overrides

Handling 429 Responses

HTTP/1.1 429 Too Many Requests
Retry-After: 30

{
  "message": "Too many requests. Please try again later."
}
Retry Strategy

Read the Retry-After header (seconds) and wait at least that long before retrying. Use exponential backoff with jitter: wait min(2^attempt * 1s + random(0-1s), 60s). Never retry in a tight loop.

4. Request Format

Required Headers

HeaderValueRequired
Content-Typeapplication/jsonFor POST/PUT/PATCH
Acceptapplication/jsonAlways recommended
AuthorizationBearer {token}For authenticated endpoints

Pagination

List endpoints support Laravel-style pagination:

ParameterDefaultDescription
page1Page number to retrieve
per_page15Items per page (max varies by endpoint, typically 50-100)

Filtering and Sorting

Many list endpoints accept filter parameters as query strings. For example, the tickets endpoint supports:

GET /api/v1/tickets?status=open&priority=high&search=ssl&per_page=25

Refer to individual endpoint documentation for available filters.

5. Response Format

All responses follow a standardized JSON envelope:

Success Response

{
  "success": true,
  "status": "success",
  "message": "Success",
  "data": { ... }
}

Error Response

{
  "success": false,
  "status": "error",
  "message": "Human-readable error description",
  "errors": null | { "field": ["Validation message"] }
}

HTTP Status Codes

CodeMeaning
200Request succeeded
201Resource created
400Bad request / invalid argument
401Unauthenticated (missing or invalid token)
403Forbidden (valid token but insufficient permissions)
404Resource not found
422Validation error (check errors object)
429Rate limit exceeded
500Internal server error

Paginated Response

List endpoints wrap data in Laravel's paginator structure inside the data envelope:

{
  "success": true,
  "status": "success",
  "message": "Success",
  "data": {
    "current_page": 1,
    "data": [ { ... }, { ... } ],
    "last_page": 5,
    "per_page": 15,
    "total": 73,
    "next_page_url": "/api/v1/tickets?page=2",
    "prev_page_url": null
  }
}

6. API Endpoints by Category

Auth

MethodPathDescriptionAuth
POST/loginLogin with email/password, returns Sanctum tokenNo
POST/registerRegister a new account and tenantNo
GET/registration/fieldsGet registration form field configurationNo
GET/auth/meGet current authenticated user detailsSanctum
GET/auth/social/{provider}/redirectRedirect to social provider (google, apple, microsoft, oidc)No
GET/auth/social/{provider}/callbackHandle callback from social providerNo
POST/auth/social/exchangeExchange social auth code for Sanctum tokenNo
POST/auth/social/complete-signupComplete registration after social authNo
POST/auth/social/link/confirmLink social account to existing userNo
GET/user/localeGet user locale preferenceSanctum
POST/user/localeSet user locale preferenceSanctum
GET/account/deletionGet account deletion request statusSanctum
POST/account/deletionRequest account deletion (GDPR)Sanctum

Guardian Sites

All site endpoints require Sanctum auth + tenant context.

MethodPathDescription
GET/sitesList all sites for the current tenant
POST/sitesCreate a new site (generates pairing token)
GET/sites/{site}Get site details
PUT/sites/{site}Update site settings
DELETE/sites/{site}Delete a site
POST/sites/{site}/refreshForce refresh site data from agent
POST/sites/{site}/scanTrigger a security scan
GET/sites/{site}/scoreGet site health/security score
GET/sites/{site}/alertsList active alerts for a site
POST/alerts/{alert}/resolveResolve an alert
GET/sites/{site}/membersList site team members
POST/sites/{site}/membersAdd a member to a site
PUT/sites/{site}/members/{member}Update member role
DELETE/sites/{site}/members/{member}Remove a member
GET/sites/{site}/metricsGet site performance metrics
GET/sites/{site}/timelineGet activity timeline
GET/sites/{site}/reportDownload a site report (PDF/CSV)
GET/sites/{site}/risk-scoreGet computed risk score
POST/sites/{site}/containment/enableEnable kill-switch containment mode
POST/sites/{site}/containment/disableDisable containment mode

Autopilot

MethodPathDescriptionAuth
GET/autopilot/defaultsGet default autopilot configurationNo
GET/autopilot/catalogList available spokes and bundlesNo
POST/autopilot/handshakeAgent handshake (plugin registers with hub)Signature
POST/autopilot/telemetryAgent sends telemetry dataSignature
POST/autopilot/sites/{site}/registerRegister a site for autopilotSanctum
GET/autopilot/sites/{site}/profileGet site autopilot profileSanctum
PUT/autopilot/sites/{site}/spokesUpdate enabled spokesSanctum
PUT/autopilot/sites/{site}/scheduleUpdate automation scheduleSanctum
GET/autopilot/sites/{site}/modeGet autonomy mode (full/semi/manual)Sanctum
POST/autopilot/sites/{site}/modeSet autonomy modeSanctum
GET/autopilot/sites/{site}/chat/threadsList AI chat threads for a siteSanctum
POST/autopilot/sites/{site}/chat/threadsCreate a new AI chat threadSanctum
POST/autopilot/chat/threads/{thread}/messagesSend a message in an AI chat threadSanctum
GET/action-approvalsList pending autopilot approvalsSanctum
POST/action-approvals/{approval}/approveApprove an autopilot actionSanctum
POST/action-approvals/{approval}/rejectReject an autopilot actionSanctum

Billing

Billing endpoints require Sanctum auth + tenant context.

MethodPathDescription
GET/billing/overviewGet tenant billing overview (plan, usage, invoices)
POST/billing/change-planInitiate plan change (creates Stripe checkout)
POST/billing/plan/confirm-checkoutConfirm plan checkout after Stripe redirect
POST/billing/recovery-pass/purchasePurchase a recovery pass
POST/billing/request-bank-transferRequest bank transfer payment
GET/billing/addons/overviewList purchased add-ons and assignments
POST/billing/addons/previewPreview add-on pricing before purchase
POST/billing/addons/purchasePurchase an add-on (Stripe checkout)
POST/billing/addons/assignAssign an add-on to a specific site
GET/billing/bundles/catalogList available bundles
POST/billing/bundles/purchasePurchase a bundle
GET/checkout/catalogPublic plan catalog (no auth required)
POST/checkout/registerPublic register + checkout in one step

Tickets

Sanctum auth + tenant context required.

MethodPathDescription
GET/ticketsList tickets (filterable by status, priority, category, search)
POST/ticketsCreate a new ticket
GET/tickets/{ticket}Get ticket details with messages
PUT/tickets/{ticket}Update ticket (status, priority, assignment)
POST/tickets/{ticket}/messagesAdd a message to a ticket
POST/tickets/{ticket}/escalateEscalate a ticket to higher priority
GET/tickets/{ticket}/ai-insightGet AI-generated insight for a ticket
POST/tickets/{ticket}/ai-insight/refreshRefresh AI insight (heavy operation)
GET/tickets/ai-digest/latestGet latest AI digest of all tickets
GET/tickets/contextGet ticket context data (categories, users)
GET/tickets/statisticsGet ticket statistics and metrics

Notifications

MethodPathDescriptionAuth
GET/notificationsList notifications (paginated)Sanctum
GET/notifications/unread-countGet unread notification countSanctum
POST/notifications/{id}/readMark a notification as readSanctum
POST/notifications/read-allMark all notifications as readSanctum
DELETE/notifications/{id}Delete a notificationSanctum
POST/push/subscriptionsSubscribe to web push notificationsSanctum
DELETE/push/subscriptions/{endpointHash}Unsubscribe from web pushSanctum
POST/push/testSend a test push notificationSanctum

Admin

Admin endpoints require Sanctum auth + superadmin role. Rate-limited under the admin throttle.

MethodPathDescription
GET/admin/stripe/overviewStripe dashboard overview
GET/admin/stripe/addon-subscriptionsList all add-on subscriptions
POST/admin/stripe/reconcile-pendingReconcile pending Stripe checkouts
POST/admin/stripe/process-provisioningProcess provisioning queue
GET/admin/resellersList reseller accounts
GET/admin/tenantsList all tenants
POST/admin/tenants/{tenant}/assign-resellerAssign a tenant to a reseller
GET/admin/white-labelsList all white-label configurations
POST/admin/white-labels/{wl}/compliance/approveApprove white-label compliance
GET/admin/feature-overridesList feature flag overrides
POST/admin/feature-overridesCreate a feature override
POST/admin/system-ops/backupsRegister a system backup
POST/admin/system-ops/updates/startStart a system update
GET/admin/autopilot/spokesManage autopilot spoke definitions (CRUD)
GET/admin/autopilot/bundlesManage autopilot bundle definitions (CRUD)

Webhooks (Inbound)

MethodPathDescriptionAuth
POST/stripe/connect/webhookStripe Connect webhook receiverStripe signature
GET/webhooks/whatsappWhatsApp webhook verificationVerify token
POST/webhooks/whatsappWhatsApp inbound message receiverVerify token
GET/webhooks/wechatWeChat webhook verificationVerify token
POST/webhooks/wechatWeChat inbound message receiverVerify token

Mobile

MethodPathDescriptionAuth
GET/mobile/configGet mobile app configuration (public)No
POST/mobile/devicesRegister a mobile device for pushSanctum
DELETE/mobile/devices/{deviceId}Unregister a mobile deviceSanctum

Telemetry

MethodPathDescriptionAuth
POST/telemetry/eventsSend product telemetry eventsNo
POST/telemetry/pluginSend plugin telemetry dataNo

Health

MethodPathDescriptionAuth
GET/healthPublic health check (service status)No
GET/system/maintenance-statusCheck if system is in maintenance modeNo

7. Webhook Integration

Guardian Hub sends outbound webhooks for billing events (via Stripe) and receives inbound webhooks from messaging platforms.

Stripe Webhooks

Stripe sends events to /api/v1/stripe/connect/webhook. Guardian Hub validates the webhook signature using the STRIPE_CONNECT_WEBHOOK_SECRET.

Setting Up Stripe Webhooks
  1. In your Stripe Dashboard, go to Developers → Webhooks.
  2. Add endpoint: https://your-hub-domain/api/v1/stripe/connect/webhook.
  3. Select relevant events: checkout.session.completed, customer.subscription.updated, invoice.paid, etc.
  4. Copy the signing secret and set it as STRIPE_CONNECT_WEBHOOK_SECRET in your environment.

Signature Validation

All inbound webhooks are validated before processing:

  • Stripe: HMAC-SHA256 signature in the Stripe-Signature header, verified with the webhook secret.
  • WhatsApp: Verification token challenge on GET, plus token validation on POST.
  • WeChat: SHA1 signature verification using the configured token and AES key.
  • WHMCS: HMAC validation using WHMCS_WEBHOOK_SECRET for service lifecycle events (activate, suspend, terminate, upgrade, payment).

Retry Policy

Stripe retries failed webhook deliveries for up to 3 days with exponential backoff. Ensure your endpoint returns 200 OK quickly and processes events asynchronously. WhatsApp and WeChat follow their respective platform retry policies.

Warning

Always validate webhook signatures before processing. Never trust the payload without verification. Process webhooks idempotently as they may be delivered more than once.

8. Error Handling

Common Error Patterns

// Validation error (422)
{
  "success": false,
  "status": "error",
  "message": "The email field is required.",
  "errors": {
    "email": ["The email field is required."],
    "password": ["The password must be at least 8 characters."]
  }
}

// Authentication error (401)
{
  "success": false,
  "status": "error",
  "message": "Unauthenticated.",
  "errors": null
}

// Authorization error (403)
{
  "success": false,
  "status": "error",
  "message": "This action is unauthorized.",
  "errors": null
}

// Not found (404)
{
  "success": false,
  "status": "error",
  "message": "Resource not found.",
  "errors": null
}

Graceful Error Handling

Recommended Approach
  1. Always check the success boolean before accessing data.
  2. For 422 errors, iterate over errors to display field-level messages.
  3. For 401, redirect to login or refresh the token.
  4. For 429, respect the Retry-After header and back off.
  5. For 500, log the error and show a generic message to the user. Do not retry immediately.
Tip

Wrap your API client in a response interceptor that automatically handles token refresh on 401, queues retries on 429, and logs 500 errors to your monitoring system.

9. Best Practices

Idempotency

For critical write operations (billing, provisioning), include a client-generated idempotency key. Stripe checkout endpoints pass this through to Stripe. If you retry a request with the same key, the original result is returned without creating a duplicate.

Caching

Cache responses from read-heavy endpoints like /autopilot/catalog, /checkout/catalog, and /mobile/config. These change infrequently. Use a TTL of 5-15 minutes. Always respect Cache-Control headers when present.

Pagination

Never fetch all records at once. Use page and per_page parameters. For large datasets (sites, tickets), iterate through pages until next_page_url is null.

Security

Critical Security Rules
  • Never expose API tokens in client-side code, URLs, or logs.
  • Always use HTTPS in production. The API will reject non-HTTPS connections.
  • Rotate tokens periodically and revoke tokens immediately when a team member leaves.
  • Store tokens in secure storage (e.g. OS keychain, encrypted storage), never in localStorage.
  • Use the narrowest OAuth scope required for your integration.

Environment Separation

EnvironmentBase URLPurpose
Productionhttps://guardian.bluix.net/api/v1/Live data, real billing
Staginghttps://staging.guardian.bluix.net/api/v1/Test with Stripe test mode, safe to experiment

Always develop and test against staging first. Stripe test-mode keys are used in staging, so no real charges occur. Admin Stripe actions are enabled by default outside production.

Tip

Use separate API tokens for staging and production. Never use production tokens in development environments, CI pipelines, or shared machines.

10. SDKs & Tools

Swagger / OpenAPI

The full API specification is available as an OpenAPI 3.x YAML file and rendered via Swagger UI:

Postman Collection

A ready-to-use Postman collection is available for quick testing:

Import into Postman
  1. Open Postman and click Import.
  2. Paste the URL https://your-hub-domain/api-docs/collection.json or upload the file.
  3. Set the base_url environment variable to your Hub API URL.
  4. Set the token variable after calling the login endpoint.
  5. All collection requests will automatically use these variables.

Code Generation

Use the OpenAPI spec to generate client SDKs in any language:

# Generate a TypeScript client
npx openapi-generator-cli generate \
  -i https://your-hub-domain/api-docs/openapi.yaml \
  -g typescript-fetch \
  -o ./guardian-hub-client

# Generate a PHP client
npx openapi-generator-cli generate \
  -i https://your-hub-domain/api-docs/openapi.yaml \
  -g php \
  -o ./guardian-hub-php-client

11. Changelog

API changes are documented in the following locations:

  • Release notes: Published with each Guardian Hub release in the dashboard under What's New.
  • OpenAPI spec diff: Compare openapi.yaml between versions to see added/removed/changed endpoints.
  • Deprecation warnings: Deprecated endpoints return a X-Deprecated header and a Sunset header with the removal date.
Versioning Policy

Non-breaking changes (new endpoints, new optional fields) are added to the current version without notice. Breaking changes (removed fields, changed behavior) are introduced in a new API version. The previous version remains available for at least 12 months after deprecation.

End of Guardian Hub API Guide