Backups, extra IP and extra disk through the API

API & DocumentationWhat You Can Automate·· 8 views· 4 min read

In short: on your clients' VPS and Cloud servers, the API takes backups and restores them, and buys an additional IP or more disk, up to 100 GB extra, paid from credit. You see the price before you buy, and the extra's monthly amount joins the server's renewal. For dedicated servers, add-ons are agreed with our team. See the server reseller page.

Backups: list, take and restore

For Request Permission
Listing backups GET /v1/servers/{id}/backups vps:read
Taking a backup POST /v1/servers/{id}/backups vps:write
Going back to a backup POST /v1/servers/{id}/restore vps:restore (sensitive)

Each server keeps 4 backups at most, counting the automatic ones. In the list, kind tells you whether a backup is automatic or on_demand. A new backup takes a name made of letters, digits, dots, hyphens and underscores, up to 30, and can take up to 50 minutes to show up:

curl https://api.interweb.co.mz/v1/servers/700/backups -X POST \
-H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "before-update"}'

With 4 backups the request answers 409 backup_limit_reached. Downloading and deleting backups is done in Meu Interweb: delete an old one there and ask again.

Restoring wipes whatever changed after the backup. POST /v1/servers/{id}/restore takes the backup id in backup, the server name in confirm and the Idempotency-Key header. A backup's id changes when the backup changes, so use the one from the latest list. It counts towards the limit of 3 reinstalls or restores per hour across the account.

Extra IP and disk: check the price first

GET /v1/servers/{id}/extras (with vps:read) tells you what an additional IP and each extra disk size cost on that server: 10, 20, 50 or 100 GB. monthly_amount is added to every renewal; amount_today is what you pay now, from today to the next renewal. These amounts are before tax. When an extra is not available, reason says why: extra_not_available, ip_limit_reached or disk_limit_reached.

Buying the extra

1 Place the order with POST /v1/servers/{id}/extras: type set to ip or disk and, for disk, size_gb. It needs billing:purchase, vps:write and the Idempotency-Key header.
2 To lock in the price, send expected_amount. If the price has changed, it answers 409 price_changed and the purchase does not go ahead.
3 Keep the extra_id from the response. The extra is delivered after payment, and you follow it with GET /v1/extras/{id} (needs extras:read).

curl https://api.interweb.co.mz/v1/servers/700/extras -X POST \
-H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: client-700-disk-20" \
-d '{"type": "disk", "size_gb": 20}'

Answer When What to do
402 insufficient_credit Not enough credit. Nothing was charged. Top up your credit and try again.
403 spending_limit_exceeded The purchase goes over the key's spending limit. Use a key with a higher limit.
409 invoice_open There is already an unpaid invoice for this same extra. Pay that invoice first.
409 price_changed The price changed since you saw it. Check the price again and confirm with your client.
Remember the extra stays on the renewal. Its monthly amount becomes part of every renewal of the server, so adjust what you charge your client. Extras do not take promo codes. If the new IP will send e-mail, set its name with PUT /v1/servers/{id}/reverse-dns (needs vps:write), as we explain in PTR and reverse DNS. To decide whether your client really needs an IP of their own, see dedicated or shared IP.

Want to sell backups, IPs and disk to your clients from your own system? See the server reseller page.

See server reselling

SEE ALSO

Controlling a VPS through the API: start, stop, restart, root password, reinstall and backups

Backing up a VPS: snapshots or files

PTR and reverse DNS: why your e-mail depends on it

Dedicated or shared IP: which one you need, and when

Idempotency-Key in our API: repeating a purchase, payment or ticket without doing it twice

Catalogue and extras through the API: showing prices on your site and buying SSL or SiteLock

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $5.36/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.