API Reference
Authentication & Authorization
Copy page
OAuth 2.1 at Hostino — endpoints, scopes, PKCE, Device Flow, refresh and revocation
The Hostino API and MCP use OAuth 2.1 only. Users sign in with their Hostino panel email and password (plus 2FA when enabled), approve the requested permissions, and the app receives a short-lived token. There are no long-lived keys.
Endpoints
Everything is discoverable from metadata:
curl -s https://auth.hostino.ai/.well-known/oauth-authorization-server| Purpose | URL |
|---|---|
| Issuer | https://auth.hostino.ai |
| Authorization | https://auth.hostino.ai/auth |
| Token | https://auth.hostino.ai/token |
| Device Authorization | https://auth.hostino.ai/device/auth |
| Dynamic Client Registration (DCR) | https://auth.hostino.ai/reg |
| Revocation | https://auth.hostino.ai/token/revocation |
| JWKS | https://auth.hostino.ai/jwks |
| Protected Resource Metadata | https://mcp.hostino.ai/.well-known/oauth-protected-resource |
Scopes
| Scope | Access |
|---|---|
services:read | Read services, status and due dates |
domains:read | Read domains, status and expiry dates |
invoices:read | Read invoices, amounts and payment status |
billing:read | Read the credit balance |
orders:read | View plans, pre-invoices and order status |
orders:write | Create a purchase request (no effect without the owner’s approval) |
billing:pay | Choose payment from credit for a purchase request |
orders:approve | Final purchase approval — issued only to Hostino’s web page, never to other apps |
offline_access | Receive a refresh_token to renew access without signing in again |
openid | Optional; user identity (sub) |
Read scopes change nothing; write scopes (orders:write, billing:pay, orders:confirm, deploy:write, wordpress:write, hosting:login) are approved separately, and no order or charge happens without the account owner’s approval. The consent page lists exactly which permissions are being requested.
Resource (required parameter)
Tokens are issued for a specific resource (RFC 8707). Always send it in the authorization and token requests:
resource=https://mcp.hostino.aiA token for this resource is accepted by both MCP and the REST API (api.hostino.ai). Other resources are rejected with invalid_target.
Supported flows
Authorization Code + PKCE
For apps, desktop tools and MCP clients. PKCE with S256 is mandatory.
https://auth.hostino.ai/auth?response_type=code &client_id=CLIENT_ID &redirect_uri=http://localhost:PORT/callback &scope=services:read domains:read offline_access &code_challenge=CHALLENGE&code_challenge_method=S256 &state=STATE &resource=https://mcp.hostino.aiThen exchange the code with your code_verifier at POST /token (grant_type=authorization_code). Authorization codes are valid for 5 minutes and single-use.
Device Authorization (RFC 8628)
For CLIs, servers and browserless devices. The public client hostino-cli exists for this. Step by step in the Quickstart.
Refresh Token
With offline_access, get a fresh access token:
curl -s -X POST https://auth.hostino.ai/token \ -d grant_type=refresh_token \ -d refresh_token=REFRESH_TOKEN \ -d client_id=CLIENT_ID \ -d resource=https://mcp.hostino.aiDynamic Client Registration (RFC 7591)
MCP clients (like Claude Code) register themselves via POST /reg; nothing to do on your side. Clients are public (token_endpoint_auth_method: none) and protected by PKCE.
Token lifetimes
| Item | Lifetime |
|---|---|
| Access token | 1 hour |
| Refresh token | 14 days |
| Authorization code | 5 minutes (single-use) |
| Device code | 10 minutes |
Revocation (RFC 7009)
Any client can revoke its own tokens:
curl -s -X POST https://auth.hostino.ai/token/revocation \ -d token=ACCESS_OR_REFRESH_TOKEN \ -d client_id=CLIENT_IDA 200 response means the token is no longer accepted.
Using the token
Send the token only in the Authorization header:
curl -s https://api.hostino.ai/v1/services -H "Authorization: Bearer ACCESS_TOKEN"Panel cookies or any other method are not accepted. An invalid or expired token returns 401 with WWW-Authenticate: Bearer …, error="invalid_token"; a missing scope returns 403 with error="insufficient_scope". Full list: Errors.
Security notes
- Treat tokens like passwords; never commit them or write them to logs.
- Request only the scopes you need.
- Revoke tokens when you’re done with them.