API keys and the REST API
Last updated
An API (application programming interface) lets your own software talk to MaintainHQ. With the REST API you can read your sites, updates, backups and reports from a script, a spreadsheet tool or your own dashboard, without opening MaintainHQ.
To use it you need an API key: a long secret code that proves a request comes from your account. This guide covers creating keys, choosing what they can do, keeping them safe and using the REST API. Connecting an AI assistant is covered in connect an AI assistant.
Which plans include the API
The API and the MCP server are included in the Pro and Agency plans. On other plans, the API & MCP page says “A paid plan is required” and the Create key button is greyed out. See the pricing page to compare plans.
What a key can and cannot do
Each key has scopes: the permissions it carries. Read is always included.
| Scope | What it allows |
|---|---|
| Read (read) | Read sites, plugins, updates, backups, uptime, vulnerabilities, Gus findings, fix plans, reports and hosted sites with their usage and backups. Ask Gus read-only questions. |
| Write (write) | Start on-demand backups (including of hosted sites), clear a hosted site’s cache, and start Gus diagnoses. Diagnoses count against your Gus allowance. |
| Draft fix plans (gus:draft) | Draft Gus fix plans from stored findings, for you to review in the dashboard. Never approves or applies a fix. |
No key can approve or apply a fix, or order, cancel or delete hosting. Those always stay in the dashboard, with a person in charge. Every change made with a key is recorded in your activity log.
Creating a key
- Open API & MCP under Settings in the left-hand menu. The Keys tab is open first.
- Under Create a key, give it a Name that says where it will be used, such as “reporting script” or “Claude Desktop”.
- Choose when it Expires: Never, 30 days, 90 days, 180 days or 1 year.
- Tick the Scopes it needs. Read is always on; add Write or Draft fix plans only if the tool needs them.
- Press Create key.
- Copy the key from the green box and store it somewhere safe, such as a password manager. Then press I have copied it.
Use one key per tool or person. Then you can revoke one without breaking the others. An account can have up to 25 active keys.
Your keys: checking, limiting and revoking
The Your keys list shows each key’s name, the first few characters of the key (so you can tell them apart), its scopes, when it was created, when it was last used and when it expires. Revoked and expired keys are labelled.
- Permissions opens a page where you limit which sites and which AI tools the key can use through MCP. See AI assistant permissions and activity.
- Revoke switches the key off. Anything using it stops working straight away. This cannot be undone.
Using the REST API
The REST API tab shows the details you need. The API speaks JSON over HTTPS. The base address is https://api.maintainhq.com/v1, and a full description of every endpoint (an OpenAPI 3.1 document) is at https://api.maintainhq.com/v1/openapi.json. That document works with tools such as Postman and Insomnia, and with code generators.
Send your key in an Authorization header on every request, in the form “Authorization: Bearer” followed by your key. The tab includes a ready-made curl example (curl is a command-line tool for making web requests), which searches your sites for one using an old version of a plugin.
- Lists take page and per_page, and return the data with pagination details.
- Errors return an error object with a code and a message.
- Each key may make 120 requests a minute. Spread out large jobs rather than sending everything at once.
Webhook endpoints can also be managed through the API. See webhooks.
Keeping keys safe
- Treat a key like a password. Never paste it into a public code repository, a support ticket or a chat message.
- Give each key the fewest scopes it needs.
- Set an expiry on keys for short projects or contractors.
- If a key might have leaked, revoke it straight away and create a new one.