6,8 KiB
name: email-center description: Send transactional and marketing email from an application through the Interweb Angola E-mail Center API: verify a sender domain with DKIM, SPF and DMARC, send one email or a batch, use templates with variables, schedule, follow statuses and webhooks, manage suppressions, contacts and campaigns. Use when the user wants their code or site to send email, set up a sender domain, or check why an email did not arrive.
Interweb Angola E-mail Center
Use this skill for email sent by applications (order confirmations, password resets, newsletters). Mailboxes of a hosting plan are in manage-hosting.
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
email_center:read(andemail_center:writeto send and 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.
Before sending
- E-mail Center must be active on the account. Otherwise the API answers
403withdetails.reasonemail_account_required: the user turns it on in Meu Interweb. - The sender must be on a verified domain (or a subdomain of it).
Verify a sender domain
curl -sS -X POST "https://api.interweb.ao/v1/email/domains" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" -d '{"domain": "mybusiness.co.ao"}'
- The answer has
dns_records: a DKIMTXT(required), SPFTXTand DMARCTXT(recommended). - If the domain uses our DNS, offer to add them with the
manage-dnsskill. Otherwise show the user the exact records to add where their DNS is. - Then
POST /v1/email/domains/{domain}/verify. DNS can take a few hours;foundon each record shows progress. When DKIM is live, the domain isverified. - Optional:
PUT /v1/email/domains/{domain}/mail-fromwith a subdomain such asbounce, and add the extraCNAMEit returns.
Send an email
curl -sS -X POST "https://api.interweb.ao/v1/email/messages" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" \
-d '{"from": "My Company <notifications@mybusiness.co.ao>", "to": ["customer@example.org"], "subject": "Your order is ready", "html": "<p>Hello, your order is ready.</p>", "text": "Hello, your order is ready."}'
to,ccandbcctake one address, a comma list or an array; at most 50 recipients per email, and each recipient uses one email credit.- Templates:
template_idplusvariables(the template uses placeholders such as{{name}}). Manage them at/v1/email/templates. send_at(ISO 8601 with time zone, for example2026-12-01T09:00:00+01:00) schedules; cancel withPOST /v1/email/messages/{id}/cancel.- Batch:
POST /v1/email/messages/batch. Attachments:attachmentsin base64, up to 5 MB in total. - With a
sandbox_key nothing is sent and nothing is charged. - In application code, read the key from the environment and send from the server side only.
Limits and balance
GET /v1/email/balance shows monthly_limits (emails and different recipients, both reset on the 1st). When one runs out, sending answers 422 with details.limit monthly_emails or monthly_recipients: show the message as it comes. Extra emails: GET /v1/email/credits/prices, then POST /v1/email/credits/purchase (charges credit, ask first).
Delivery problems
GET /v1/email/messages/{id}shows the status and events.GET /v1/email/statsgives totals.- Suppressed addresses (bounces, complaints, unsubscribes):
GET /v1/email/suppressions; remove one withDELETE /v1/email/suppressions/{email}only if the user confirms the person wants mail again. - Webhook for events:
PUT /v1/email/webhook, test withPOST /v1/email/webhook/test.
Marketing
Contacts (/v1/email/contacts), groups, forms and campaigns (/v1/email/campaigns): create a campaign, run GET /v1/email/campaigns/{id}/spam-check, send a test with POST .../test, and only then send or schedule, after the user approves. Only write to people who agreed to receive email.
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
- E-mail Center: https://docs.interweb.ao/email-center/
- DNS: https://docs.interweb.ao/dns/
- Full reference: https://api.interweb.ao/v1/openapi.json