Skip to content

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:

Terminal window
curl -s https://auth.hostino.ai/.well-known/oauth-authorization-server
PurposeURL
Issuerhttps://auth.hostino.ai
Authorizationhttps://auth.hostino.ai/auth
Tokenhttps://auth.hostino.ai/token
Device Authorizationhttps://auth.hostino.ai/device/auth
Dynamic Client Registration (DCR)https://auth.hostino.ai/reg
Revocationhttps://auth.hostino.ai/token/revocation
JWKShttps://auth.hostino.ai/jwks
Protected Resource Metadatahttps://mcp.hostino.ai/.well-known/oauth-protected-resource

Scopes

ScopeAccess
services:readRead services, status and due dates
domains:readRead domains, status and expiry dates
invoices:readRead invoices, amounts and payment status
billing:readRead the credit balance
orders:readView plans, pre-invoices and order status
orders:writeCreate a purchase request (no effect without the owner’s approval)
billing:payChoose payment from credit for a purchase request
orders:approveFinal purchase approval — issued only to Hostino’s web page, never to other apps
offline_accessReceive a refresh_token to renew access without signing in again
openidOptional; 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.ai

A 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.ai

Then 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:

Terminal window
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.ai

Dynamic 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

ItemLifetime
Access token1 hour
Refresh token14 days
Authorization code5 minutes (single-use)
Device code10 minutes

Revocation (RFC 7009)

Any client can revoke its own tokens:

Terminal window
curl -s -X POST https://auth.hostino.ai/token/revocation \
-d token=ACCESS_OR_REFRESH_TOKEN \
-d client_id=CLIENT_ID

A 200 response means the token is no longer accepted.

Using the token

Send the token only in the Authorization header:

Terminal window
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.