6.7 KiB
6.7 KiB
name: manage-vps description: See and control the user's Interweb Angola VPS servers through the Interweb Angola API: state, IP addresses, start, stop and restart, backups, reverse DNS, time zone, root password, reinstall and restore, and extra IPs or disk. Use when the user asks about their VPS or server, wants to restart it, back it up, reinstall the system or find its IP.
Interweb Angola VPS
Use this skill to manage the VPS servers of the account. To publish a project on a server, see deploy-to-vps; to point a domain at it, see connect-domain.
Setup
- API address:
https://api.interweb.ao/v1. It is fixed for Interweb Angola: 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.ao/api-center.php) with
vps:read(andvps:writeto act;vps:password,vps:reinstallandvps:restoreare 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.ao/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.
See the servers
curl -sS "https://api.interweb.ao/v1/servers?per_page=100" -H "Authorization: Bearer $INTERWEB_API_KEY"
curl -sS "https://api.interweb.ao/v1/servers/SERVER_ID" -H "Authorization: Bearer $INTERWEB_API_KEY"
- A server has
id(the same as its service),name,status,ip,additional_ips,power_state,operating_systemandresources. GET /v1/servers/{id}/trafficgives the traffic of the month. With the service suspended, data can be read but actions answer409service_not_active.
Start, stop and restart
IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)
curl -sS -X POST "https://api.interweb.ao/v1/servers/SERVER_ID/restart" -H "Authorization: Bearer $INTERWEB_API_KEY" -H "Idempotency-Key: $IDEM"
- Same for
startandstop. Stopping or restarting takes the sites on the server offline for a few minutes: ask first. - The answer is
202withaction_id. Follow it withGET /v1/actions/{action_id}:running, thendoneorfailed. Starting takes about 2 minutes, stopping about 6. - One action at a time per server (
409action_in_progress), 15 seconds between actions, 10 actions per minute per account.
Backups
- List:
GET /v1/servers/{id}/backups. Make one:POST /v1/servers/{id}/backupswith{"name": "before-update"}and anIdempotency-Key. It can take up to 50 minutes to appear. - At most 4 backups per server, counting the automatic ones (
409backup_limit_reached). Downloading and deleting backups is done in Meu Interweb. - Suggest a backup before any risky change on the server.
Reverse DNS and time zone
GETorPUT /v1/servers/{id}/reverse-dnswith{"records": [{"ip": "203.0.113.10", "hostname": "mail.mybusiness.co.ao"}]}. Only the server IPs are accepted.GETorPUT /v1/servers/{id}/timezonewith{"timezone": "Africa/Luanda"}.
Dangerous actions
Each one needs its own permission, the server name in confirm and an Idempotency-Key. Never run them without a clear request, and repeat back what will be lost.
- New root password:
POST /v1/servers/{id}/passwordwith{"confirm": "<name>"}(vps:password). The server restarts. The password is only in that answer: give it to the user once and never save it in files or logs. - Reinstall: first
GET /v1/servers/{id}/operating-systems, thenPOST /v1/servers/{id}/reinstallwith{"confirm": "<name>", "operating_system": "ubuntu-24.04", "backup_first": true}(vps:reinstall). It deletes everything on the server. Suggestbackup_first: true. - Restore:
POST /v1/servers/{id}/restorewith{"confirm": "<name>", "backup": "<backup id>"}(vps:restore). Everything changed after that backup is lost. - Limits: 5 new passwords and 3 reinstalls or restores per hour.
Extra IP and disk
GET /v1/servers/{id}/extras shows the prices (amount_today is paid now, monthly_amount joins each renewal). POST /v1/servers/{id}/extras buys with account credit (billing:purchase): show the price and ask first. Follow the delivery with GET /v1/extras/{extra_id}.
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
- Servers: https://docs.interweb.ao/servers/
- Permissions: https://docs.interweb.ao/permissions/
- Full reference: https://api.interweb.ao/v1/openapi.json