7.3 KiB
name: manage-hosting description: Manage Interweb Mozambique web hosting accounts through the Interweb Mozambique API: services and usage, one-time cPanel login link, subdomains, addon domains, redirects, databases and database users, cron jobs, free SSL, PHP options, backups, FTP accounts and mailboxes. Use when the user wants to set up a site on their hosting plan, create a database or mailbox, turn on SSL or check disk usage.
Interweb Mozambique hosting
Use this skill for shared hosting plans (cPanel). For VPS servers use manage-vps; for transactional email sent by an application use email-center.
Setup
- API address:
https://api.interweb.co.mz/v1. It is fixed for Interweb Mozambique: never ask the user for another address. - API key: always read it from the
INTERWEB_API_KEYenvironment variable. Check it without printing it:test -n "$INTERWEB_API_KEY" && echo set || echo missing - If it is missing, ask the user to create a key in the API Center (https://www.meu.interweb.co.mz/api-center.php) with
hosting:read(andhosting:writeto change;hosting:loginandhosting:codeare separate permissions, off by default), then to runexport INTERWEB_API_KEY="sandbox_..."and restart Claude Code (or the editor). sandbox_keys read the real account but only simulate writes and never charge.prod_keys change the account and can charge.GET /v1/tokengives the mode indata.modeand the permissions indata.permissions. Suggest asandbox_key for a first try.- Never print, log or commit the key, and never put it in code that runs in a browser or a mobile app. In code, read it from the environment.
Every request looks like this:
curl -sS "https://api.interweb.co.mz/v1/PATH" -H "Authorization: Bearer $INTERWEB_API_KEY" -H "Accept: application/json"
Rules
- Before anything that charges, deletes data or cannot be undone, tell the user exactly what will happen (with the price, when the API gives one) and wait for a clear yes.
- Send an
Idempotency-Keyheader on purchases, sends and other POST requests that accept it, and reuse the same value if you retry the same request:IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid). - Lists come in pages:
?page=1&per_page=100, andmeta.total_pagessays how many there are. - Long operations answer
202with anaction_id. Follow them withGET /v1/actions/{action_id}every 10 to 20 seconds untilstatusisdoneorfailed. - Answer the user in the language they write in, and show amounts with the currency the API returns.
Find the service
curl -sS "https://api.interweb.co.mz/v1/services?status=active&per_page=100" -H "Authorization: Bearer $INTERWEB_API_KEY"
curl -sS "https://api.interweb.co.mz/v1/services/SERVICE_ID/usage" -H "Authorization: Bearer $INTERWEB_API_KEY"
- Hosting services have
product.typehostingaccount. Use theiridin the calls below. 409withdetails.reasonnot_hosting,service_not_active,server_not_supportedorservice_not_readymeans the action cannot run on that service now.- In Sandbox the API checks the request but does not reach the server, so "already exists" errors only show in Production.
Panel login
POST /v1/services/{id}/cpanel-login (hosting:login) returns a link that works once and gives full access. Give it to the user straight away and never write it to files or logs.
Domains and redirects
- Subdomain:
POST /v1/services/{id}/subdomainswith{"root_domain": "mybusiness.co.mz", "name": "blog", "directory": "public_html/blog"}. - Addon domain:
POST /v1/services/{id}/addon-domainswith{"domain": "other.co.mz"}. - Redirects:
GETorPOST /v1/services/{id}/redirectswith{"domain": "mybusiness.co.mz", "source": "/old", "destination": "https://www.mybusiness.co.mz/new"}; delete withDELETE /v1/services/{id}/redirects/{redirect_id}. - Send an
Idempotency-Keyon these POST requests.
Databases
curl -sS -X POST "https://api.interweb.co.mz/v1/services/SERVICE_ID/databases" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" -d '{"name": "site"}'
- Names: lowercase letters, digits and
_; the account prefix is added if missing. Use the full name from the answer. - User:
POST /v1/services/{id}/database-userswith{"name": "site", "password": "..."}. Generate a strong password (12 to 128 characters, at least 3 kinds of characters) and put it only in the project's untracked.env, never in the chat log or in git. - Access:
PUT /v1/services/{id}/databases/{name}/users/{user}; remove withDELETEon the same path. - Deleting a database deletes its data: ask first.
Cron jobs, SSL, PHP, backups and FTP
- Cron:
POST /v1/services/{id}/cronwith{"schedule": "*/15 * * * *", "php_script": "public_html/cron.php"}or a publicurl(hosting:code). - Free SSL:
POST /v1/services/{id}/ssl/autossl; see the certificates withGET /v1/services/{id}/ssl. The domain must already point to the hosting. - PHP:
GET /v1/services/{id}/phpandGETorPUT /v1/services/{id}/php/options. - Backups:
GETorPOST /v1/services/{id}/backups(full backup). - FTP:
GETorPOST /v1/services/{id}/ftp-accounts(hosting:code), password withPUT .../ftp-accounts/{login}/password.
Mailboxes of the hosting account
These need email:read or email:write (not the E-mail Center permissions).
GETorPOST /v1/services/{id}/email/mailboxeswith{"address": "info@mybusiness.co.mz", "password": "...", "quota_mb": 1024}.- Forwarders, autoresponders and the default address:
/v1/services/{id}/email/forwarders,/autoresponders/{address},/default-address. GET /v1/services/{id}/email/authenticationshows SPF, DKIM and DMARC.409account_email_domain: the account login email is on that domain, so that change is made in Meu Interweb.
New plans
GET /v1/catalog/products lists plans and prices. POST /v1/services/purchase with {"product_id": ..., "billing_cycle": "annually", "domain": "mybusiness.co.mz"} buys with account credit (billing:purchase): show the plan, the cycle and the price and ask first.
Errors
Errors look like {"error": {"code", "message", "correlation_id", "details"}}. Act on code, never on the text of message.
| HTTP | code | What to do |
|---|---|---|
| 401 | unauthorized |
The key is missing, wrong or revoked. Ask the user to check INTERWEB_API_KEY. |
| 402 | insufficient_credit |
Not enough account credit, and nothing was charged. Give the user details.add_funds_url. |
| 403 | insufficient_scope |
The key lacks a permission. Name it and ask for a key that has it. |
| 403 | spending_limit_exceeded |
The purchase goes over the key spending limit. Nothing was charged. |
| 404 | not_found |
Wrong id, or it is not in this account. |
| 409 | conflict and others |
Read details.reason and explain it in plain words. |
| 422 | validation_failed |
Fix the field named in details and try again. |
| 429 | rate_limited |
Wait for the Retry-After seconds, then try once more. |
| 5xx | internal_error, upstream_error |
Try again later. If the user contacts support, give them the correlation_id. |
More
- Hosting: https://docs.interweb.co.mz/hosting/
- Email (mailboxes): https://docs.interweb.co.mz/email/
- Catalog: https://docs.interweb.co.mz/catalog/
- Full reference: https://api.interweb.co.mz/v1/openapi.json