6,4 KiB
6,4 KiB
name: manage-dns description: Read and change the DNS zone of a domain hosted at Interweb Angola: list, add, change and delete A, AAAA, CNAME, MX, TXT, NS, SRV and CAA records, check a record before saving it and restore a zone backup. Use when the user wants to point a domain or subdomain somewhere, add a verification TXT record, set up email records or undo a DNS change.
Interweb Angola DNS
Use this skill for the records inside the zone of a domain that uses our nameservers. To change the nameservers themselves, use manage-domains.
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
dns:read(anddns:writeto change), 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.
Read the zone
curl -sS "https://api.interweb.ao/v1/domains/mybusiness.co.ao/dns" -H "Authorization: Bearer $INTERWEB_API_KEY"
- Each record has
id,name,type,value,ttl,priorityandread_only. Records withread_only: true(like the root NS) cannot be changed here. meta.dns_enabled: falsemeans the domain does not use our nameservers: tell the user to change the records where the DNS is hosted, or to move the nameservers (seemanage-domains).
Add a record
Check it first, then save it:
curl -sS -X POST "https://api.interweb.ao/v1/domains/mybusiness.co.ao/dns/validate" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -d '{"name": "www", "type": "A", "value": "203.0.113.10", "ttl": 3600}'
curl -sS -X POST "https://api.interweb.ao/v1/domains/mybusiness.co.ao/dns" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -d '{"name": "www", "type": "A", "value": "203.0.113.10", "ttl": 3600}'
nameis the part before the domain; use@for the domain itself.typeis one ofA,AAAA,CNAME,MX,TXT,NS,SRV,CAA.priorityis forMXandSRV(and is the flag onCAA).SRVvalue:weight port target.CAAvalue:tag value.TXT: quotes around the whole value are removed; quotes or backslashes inside the text are refused.- A
CNAMEcannot share its name with other records (409cname_conflict).
Change and delete
curl -sS -X PUT "https://api.interweb.ao/v1/domains/mybusiness.co.ao/dns/RECORD_ID" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -d '{"name": "www", "type": "A", "value": "203.0.113.20", "ttl": 3600}'
curl -sS -X DELETE "https://api.interweb.ao/v1/domains/mybusiness.co.ao/dns/RECORD_ID" -H "Authorization: Bearer $INTERWEB_API_KEY"
- The
idchanges when the name, type, value or priority changes. Always list again and use the latestid. - Before deleting or changing MX, SPF or the record of the website, say what will stop working and ask.
409withaccount_email_domain: the account login email is on this domain, so its mail records are changed in Meu Interweb only.
Backups and reset
- A copy of the zone is saved before each change (the last 20).
GET /v1/domains/{domain}/dns/backupslists them. - Undo:
POST /v1/domains/{domain}/dns/backups/{id}/restore. Ifcompleteisfalse, list the zone and check. POST /v1/domains/{domain}/dns/resetwith{"confirm": "<domain>"}removes all the user's records. Only with an explicit request.
Limits and timing
- 20 changes and 30 reads per minute per account. Group the work and do not loop.
- Changes made here show at once in the API. On the internet they take up to the old
ttlto spread: tell the user, and check withdig +short www.mybusiness.co.ao Aif they want.
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
- DNS: https://docs.interweb.ao/dns/
- Domains: https://docs.interweb.ao/domains/
- Full reference: https://api.interweb.ao/v1/openapi.json