Which method you need
Getting a token pair
Sign in atPOST /v1/auth/login with the email address and password you use for the Hosting Panel.
You get back two tokens:
- An access token, which you send as a bearer token on every request and which expires fairly quickly
- A refresh token, which you keep, and which gets you a new pair when the access token is close to expiring
If your account has two-factor authentication
Signing in returns a challenge rather than a token pair. Complete it atPOST /v1/auth/mfa and you get the pair back.
A challenge allows a limited number of attempts and then expires. If you run out or leave it too long, sign in again to open a new one.
Sign-in is rate limited, both per email address and per account. If you are testing, space the attempts out rather than looping.
Keeping the session alive
CallPOST /v1/auth/refresh with your refresh token before the access token expires, and you get a completely new pair back, including a new refresh token.
That behaviour is deliberate. If someone steals a refresh token and uses it, the moment your own process tries to refresh, the reuse is detected and the session is shut down.
Signing out
POST /v1/auth/logout ends the session behind the token you send, and revokes every token in that family at once. Anything still holding one of them starts getting 401 immediately.
Managing sessions
Your account keeps a list of the sessions signed in to it. You can read that list and revoke any single session without disturbing the others. This is what you want when:- A laptop or server with a stored token is lost, decommissioned or handed on
- A script has been retired and you want its access gone
- You are not sure what is connected and want to see the list
Sending requests
Send the access token as a bearer token on every call:https://api.hosting.com, and everything sits under /v1.
Reads are GET. Every change is a POST with a JSON body, including deletions, which additionally require you to repeat the thing being deleted in a confirmation field such as confirm_domain or confirm_address.
Authentication errors
Keeping credentials safe
- Never put a token in a URL, a log line, or a public repository. Treat the refresh token like a password, because for the life of the session it is one
- Use a separate session per machine or script. Sharing one refresh token between two processes will trigger the reuse protection and lock both out
- Revoke sessions you no longer need rather than leaving them open indefinitely
.jpg?fit=max&auto=format&n=E2LlsT5gBITvo732&q=85&s=ec11e1673894bdf46663a5d73602eb87)