Skip to content

Orders and payment

Ordering a server, an upgrade, extra bandwidth or a new IP address creates an order. The order pays for itself from the project owner's account credit when the credit covers it. Otherwise it waits until its invoice is paid, in the console or with Pay an invoice. You follow an order from its invoice to the server it delivers.

Endpoints

Endpoint What it does
GET /projects/{slug}/products/ List products
GET /projects/{slug}/images/ List images
GET /projects/{slug}/locations/ List locations
GET /projects/{slug}/pricing/ Get pricing
GET /projects/{slug}/promo-codes/{code}/ Check a promo code
POST /projects/{slug}/servers/ Order a server
GET /projects/{slug}/servers/{id}/upgrade-options/ List upgrade options
POST /projects/{slug}/servers/{id}/upgrade/ Upgrade a server
POST /projects/{slug}/servers/{id}/bandwidth/ Buy extra bandwidth
GET /projects/{slug}/servers/{id}/ip-change-options/ List IP change options
POST /projects/{slug}/servers/{id}/ip-change/ Change an IP address
GET /projects/{slug}/orders/ List orders
GET /projects/{slug}/orders/{id}/ Get an order
GET /invoices/ List invoices
GET /invoices/{id}/ Get an invoice
POST /invoices/{id}/pay/ Pay an invoice

How ordering works

  1. Look up what you can order: products, images, locations and prices.
  2. Place the order, with an Idempotency-Key. The answer is 201 with the order.
  3. The order is paid from the project owner's credit if it covers the invoice. Otherwise it waits in awaiting_payment, with a link to the invoice. The owner can pay it through the API.
  4. Poll the order until it is completed. A server order then has the new server's id in server_id, and for 15 minutes its root password in root_password.

Only the project's owner can order, upgrade, buy bandwidth and change IP addresses, and it is billed to the owner's account. Orders have a rate limit of their own: 10 a minute per key.

Payment

When the order's invoice is created, the project owner's account credit is applied to it if the credit covers what the invoice still owes. The order then moves on by itself.

If the credit doesn't cover it, the order waits in awaiting_payment, and invoice.url links to the invoice. The project's owner pays it in the console, or with their own key through Pay an invoice, using the order's invoice.id. Once it is paid, the order continues, and polling it shows the progress.

The credit used is the project owner's. The owner sees its balance in billing_account.credit_balance of the current user.

The order object

{
  "id": 55,
  "type": "server",
  "status": "awaiting_payment",
  "server_id": null,
  "root_password": null,
  "request": {
    "hostname": "web-02", "product_id": 123, "location": "AMS", "image": "almalinux10",
    "billing_cycle": "monthly", "ipv4_additional": 0, "ipv6": true,
    "ssh_keys": [3731], "snapshot_id": null, "promo_code": null, "has_user_data": false
  },
  "invoice": {"id": 777, "status": "unpaid", "total": "12.00", "currency": "USD", "url": "https://console.hosthatch.com/billing/invoice/777/"},
  "action_id": null,
  "warnings": [],
  "created_at": "2026-10-19T10:00:00Z",
  "updated_at": "2026-10-19T10:00:00Z"
}
Field Type Description
id integer The order's id.
type string server, upgrade, bandwidth or ip_change.
status string See Order statuses.
server_id string or null The server. For a server order it is set once the server exists; for an upgrade, bandwidth or IP change order, from the start.
root_password string or null For a server order, the new server's root password, for 15 minutes after the order completed. It is shown only when you read this one order, never in a list or a replay, and only to an owner's or admin's key that isn't read-only. It works once the server has started. null otherwise, and for a server made from a snapshot, which keeps the snapshot's password. Once the 15 minutes are up, reset the root password to get a new one.
request object What you ordered. For a server, the order's fields with the billing cycle it got, and has_user_data in place of user_data, which is never stored. For an upgrade, product_id and upgrade_disk. For bandwidth, size_gb. For an IP change, address, scope and subnet.
invoice object or null The invoice: id, status as billing last showed it, such as unpaid, total, currency, and url, where the project's owner can pay it. null while the order has none.
action_id integer or null For an IP change, the server.change_ip action that makes it, once the invoice is paid and the action has started. null otherwise.
warnings array Things that went wrong after billing took the order, each with a code and a message. credit_unconfirmed means paying the invoice from account credit couldn't be confirmed, and support checks it. ip_change_failed means an IP change's action failed after its invoice was paid, and whmcs_ips_not_updated that the change was made but billing's record of the server's addresses wasn't updated. review_ticket_failed means an order under review got no ticket: open one. The message says what happens next.
created_at, updated_at string When the order was placed, and last changed.

Order statuses

Status Meaning
submitting Being placed. It lasts a few seconds.
under_review Placed in the console for a manual check. Its invoice can't be paid until we have checked it, and we reply in the ticket we opened for it.
awaiting_payment Its invoice waits to be paid. Pay it at invoice.url, or with Pay an invoice.
provisioning Paid, and being delivered: the server is being set up, the bandwidth added, or the address changed.
completed Delivered. A server order has its server_id.
cancelled Cancelled in billing: its invoice was cancelled or refunded, or the new server's service was cancelled.
failed Billing refused the order. Nothing was charged, unless its invoice shows paid: then contact support instead of ordering again.
unknown Billing didn't confirm the order when it was placed, so whether it went through is being checked. It is never placed again. Poll it: it moves on once that is settled, by support if billing can't tell. Don't order again meanwhile.

The catalogue

What you can order, as the project's owner can order it. The catalogue can be up to 5 minutes old. The examples' prices are illustrations: the endpoints answer with yours.

List products

GET /projects/{slug}/products/

Any member · Read-only keys: yes · Returns 200 Product[]

The products you can order.

{
  "id": 123,
  "name": "Cloud VPS 2x4",
  "category": "Cloud Servers",
  "description": ["2 vCPU", "4 GB RAM", "80 GB NVMe"],
  "prices": {"monthly": "12.00", "quarterly": "34.00", "annually": "120.00"},
  "setup_fees": {"monthly": "0.00"},
  "currency": "USD",
  "billing_cycles": ["monthly", "quarterly", "annually"],
  "default_billing_cycle": "monthly",
  "locations": [{"code": "AMS", "in_stock": true, "upgrade_in_stock": true}],
  "images": ["almalinux10", "ubuntu24"]
}

locations says where the product is in stock for new servers (in_stock) and for upgrades (upgrade_in_stock). images lists the images it can be installed with.

List images

GET /projects/{slug}/images/

Any member · Read-only keys: yes · Returns 200 Image[]

The images a server can be installed with. name is what an order and a reinstall take.

{"name": "almalinux10", "distro": "AlmaLinux", "version": "10", "display_name": "AlmaLinux 10"}

List locations

GET /projects/{slug}/locations/

Any member · Read-only keys: yes · Returns 200 Location[]

The locations that at least one product is offered in. code is what an order takes.

{"code": "AMS", "city": "Amsterdam", "country": "The Netherlands", "country_code": "NL"}

Get pricing

GET /projects/{slug}/pricing/

Any member · Read-only keys: yes · Returns 200 Pricing

What a new server's extras cost on top of its product's price: additional IPv4 addresses, IPv6 and extra bandwidth.

{
  "currency": "USD",
  "ipv4_additional": [
    {"count": 0, "prices": {"monthly": "0.00"}, "setup_fees": {"monthly": "0.00"}},
    {"count": 1, "prices": {"monthly": "2.00"}, "setup_fees": {"monthly": "0.00"}}
  ],
  "ipv6": {"prices": {"monthly": "0.00"}, "setup_fees": {"monthly": "0.00"}},
  "extra_bandwidth": [{"size_gb": 500, "price": "2.00"}, {"size_gb": 1000, "price": "4.00"}],
  "ip_change": [{"scope": "any", "price": "5.00"}, {"scope": "other_subnet", "price": "10.00"}]
}

ipv4_additional has an entry for each count of additional addresses an order can ask for, starting at 0. Each entry, and ipv6, has a recurring price and a setup fee per billing cycle. ipv6 is null when no product offers IPv6. These are the prices of the first product that offers each extra: billing charges a product that prices them differently its own price.

extra_bandwidth lists the sizes Buy extra bandwidth takes, each with its one-time price.

ip_change lists what changing an IP address costs, once, for each scope.

Check a promo code

GET /projects/{slug}/promo-codes/{code}/

Owner · Read-only keys: yes · Returns 200 PromoCode

Whether a promo code applies to a product on a billing cycle, and the discount it gives, as an order with that promo_code would get it.

curl "https://console.hosthatch.com/api/v1/projects/acme/promo-codes/SPRING25/?product=123&billing_cycle=monthly" \
  -H "Authorization: Bearer $HOSTHATCH_API_KEY"
{"code": "SPRING25", "type": "percentage", "value": "25.00"}

product and billing_cycle are required. type says what value is: percentage off the price, fixed_amount off it in USD, price_override, the price itself, or free_setup, a waived setup fee. code is spelled as an order's promo_code takes it.

A code that doesn't exist or has expired answers 404 not_found, and one that isn't for the product or the billing cycle 400 promo_code_not_applicable. Only the project's owner can check a code, as only they order.

Ordering

Order a server

POST /projects/{slug}/servers/

Owner · Read-only keys: no · Returns 201 Order

Order a new server in the project.

curl -X POST "https://console.hosthatch.com/api/v1/projects/acme/servers/" \
  -H "Authorization: Bearer $HOSTHATCH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 3b9f7c2e-8d41-4a6f-b0c5-9e2a7d1f4c88" \
  -d '{
    "hostname": "web-02", "product_id": 123, "location": "AMS", "image": "almalinux10",
    "billing_cycle": "monthly", "ssh_keys": [3731], "ipv4_additional": 0, "ipv6": true,
    "promo_code": null, "snapshot_id": null, "user_data": null
  }'
Field Type Description
hostname string Required. The same rules as renaming a server.
product_id integer Required. A product's id.
location string Required. A location code where the product is in stock.
billing_cycle string One of the product's billing_cycles. Leave it out for its default_billing_cycle.
image string or null One of the product's images. Send image or snapshot_id: one of them, not both.
snapshot_id integer or null A completed snapshot of the project to create the server from, instead of an image.
ssh_keys array of integers Ids of the project's SSH keys to install, up to 100.
ipv4_additional integer How many IPv4 addresses to add to the first one, 0 by default. Pricing lists the counts.
ipv6 boolean Give the server an IPv6 subnet.
promo_code string or null A promotion code: letters, digits, hyphens and underscores, up to 64 characters.
user_data string or null Not available yet: sending it answers 400 feature_unavailable. Cloud-init user data, up to 65536 characters, starting with #cloud-config or #!.

A choice the product doesn't offer answers 400 validation_error on that field: a location without stock, a billing cycle it isn't sold with, an image it doesn't take, more additional addresses than it allows, IPv6 it can't have, a snapshot whose image it can't be ordered with, or a key or snapshot that isn't the project's. The answer is 201 with the order, of type server.

To put the server on its location's private network, start its enable-private-network action once the order is completed.

A new customer's first server has to be ordered in the console. Through the API it answers 403 order_refused: detail says so, order_id names the order, recorded as failed, and the Idempotency-Key isn't spent.

List upgrade options

GET /projects/{slug}/servers/{id}/upgrade-options/

Any member · Read-only keys: yes · Returns 200 UpgradeOption[]

The products the server can be upgraded to, with their prices. One that isn't in_stock can't be ordered in the server's location now.

{"product_id": 41, "name": "Cloud VPS 4x8", "prices": {"monthly": "24.00"}, "currency": "USD", "in_stock": true}

Upgrade a server

POST /projects/{slug}/servers/{id}/upgrade/

Owner · Read-only keys: no · Returns 201 Order

Move the server to one of its upgrade options. It keeps its billing cycle, and billing invoices what is left of the current term.

{"product_id": 41, "upgrade_disk": true}
Field Type Description
product_id integer Required. One of the server's upgrade options. Any other answers 400 validation_error.
upgrade_disk boolean Also grow the server's disk to the new plan's size when the upgrade is applied. Left out or false, the disk keeps its size.

The answer is 201 with an order of type upgrade, which completes once its invoice is paid. If the server then shows pending_changes: true, a reboot through the API applies the new plan.

A server takes one upgrade at a time. While one is unpaid or its outcome is unknown, another answers 409 conflict, with the open order's id in order_id when it is the project's. An option that isn't in_stock answers 409 insufficient_capacity.

Buy extra bandwidth

POST /projects/{slug}/servers/{id}/bandwidth/

Owner · Read-only keys: no · Returns 201 Order

Add bandwidth to the server's allowance for this month.

{"size_gb": 1000}

size_gb is one of the sizes in pricing's extra_bandwidth, and the price is the one listed there. The answer is 201 with an order of type bandwidth. It is provisioning while the bandwidth is added, and completed once the server's bandwidth.extra_gb has it.

List IP change options

GET /projects/{slug}/servers/{id}/ip-change-options/

Any member · Read-only keys: yes · Returns 200 IPChangeOption[]

For each of the server's IPv4 addresses, the primary first, whether a new address is free right now under each scope of an IP change.

{"address": "203.0.113.24", "any": true, "other_subnet": true, "subnets": ["192.0.2.0/24", "198.51.100.0/24"]}
Field Type Description
address string One of the server's IPv4 addresses.
any boolean Whether a new address is free for scope any.
other_subnet boolean Whether a new address in another subnet is free, for scope other_subnet.
subnets array of strings The other subnets with a free address, sorted. Scope other_subnet takes one of them.

Change an IP address

POST /projects/{slug}/servers/{id}/ip-change/

Owner · Read-only keys: no · Returns 201 Order

Replace one of the server's IPv4 addresses with a new one, picked at random.

curl -X POST "https://console.hosthatch.com/api/v1/projects/acme/servers/774736/ip-change/" \
  -H "Authorization: Bearer $HOSTHATCH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a9e-4b7d-4e3a-9c58-2d0e7b1a3f64" \
  -d '{"address": "203.0.113.24", "scope": "other_subnet", "subnet": "198.51.100.0/24"}'
Field Type Description
address string Required. The server's IPv4 address to replace.
scope string Required. any: a new address in the same subnet when one is free, otherwise in another. other_subnet: a new address in the subnet given in subnet. Pricing lists the price of each.
subnet string Required with other_subnet, and not allowed with any. One of the subnets the options list for the address.

The answer is 201 with an order of type ip_change. The change is made once its invoice is paid, as a server.change_ip action that the order names in action_id. The order is completed once that action has succeeded, and the action's result has the new address.

  • A primary address is applied with a power cycle, a hard reset, as soon as the invoice is paid, and the server is started again. For a clean shutdown, shut the server down from inside its operating system before you pay.
  • An additional address needs no restart, but the old address stops working at once, and you configure the new one inside the server.

A scope without a free address answers 409 insufficient_capacity, and a subnet the options don't list is a validation_error on subnet. A server takes one IP change at a time: another, while one is unpaid, being made or unknown, answers 409 conflict, with the open order's id in order_id when it is the project's. A suspended server answers 409 conflict, one with an action running 409 action_in_progress, and more than 10 changes of a server within 30 days 409 ip_change_limit_reached.

Orders

List orders

GET /projects/{slug}/orders/

Any member · Read-only keys: yes · Returns 200 Order[]

The project's orders, newest first. Lists show each order as last recorded: poll the order itself to follow it.

Get an order

GET /projects/{slug}/orders/{id}/

Any member · Read-only keys: yes · Returns 200 Order

One order, checked against billing for its latest state before the answer.

If you lose the answer

Send an Idempotency-Key with every order, as for actions. If you send the same order again with the same key, you get the first order back, with 200 and Idempotent-Replayed: true, instead of buying twice. The same key with a different body answers 409 idempotency_key_reused.

When billing doesn't answer, the order is still recorded: the answer is 502 upstream_error with the order's id in order_id, and the order is unknown while it is checked. Poll that order rather than ordering again. If it ends failed and its invoice isn't paid, place a new order with a new key.

Invoices

Your own invoices: those for your orders, placed through the API or in the console, and your renewals. They belong to your billing account, not to a project, so their paths have no project slug, and a key sees only its own user's invoices. An order's invoice is the project owner's, so only the owner's key can pay it.

{
  "id": 715020,
  "status": "unpaid",
  "date": "2026-11-14",
  "due_date": "2026-11-21",
  "total": "12.00",
  "balance": "12.00",
  "currency": "USD",
  "items": [{"description": "Cloud VPS 2 GB - web-01.example.com (2026-11-21 - 2026-12-20)", "amount": "12.00"}],
  "url": "https://console.hosthatch.com/billing/invoices/715020/"
}
Field Type Description
id integer The invoice's id. An order has it in invoice.id.
status string As billing shows it, in lower case: unpaid, paid, cancelled, refunded, collections, draft or payment pending. Only an unpaid invoice can be paid.
date string When the invoice was raised.
due_date string When payment is due.
total string The invoice's total, a decimal string with two places.
balance string What is still due while the invoice is unpaid. Paying the invoice pays this. Billing can show an invoice it paid from credit by itself with its whole total here, so go by status.
currency string ISO 4217, such as USD.
items array The invoice's lines, each with a description and an amount.
url string Where the invoice can be seen and paid in the console.

Lists show each invoice without balance and items.

List invoices

GET /invoices/

Any member · Read-only keys: yes · Returns 200 InvoiceSummary[]

Your newest 1000 invoices, newest first. ?status=unpaid lists only those waiting to be paid, and status takes any of the other statuses too.

curl "https://console.hosthatch.com/api/v1/invoices/?status=unpaid" \
  -H "Authorization: Bearer $HOSTHATCH_API_KEY"

Get an invoice

GET /invoices/{id}/

Any member · Read-only keys: yes · Returns 200 Invoice

One of your invoices, with its lines and what is still due.

Pay an invoice

POST /invoices/{id}/pay/

Any member · Read-only keys: no · Returns 200 InvoicePayment

Pay what is still due on one of your unpaid invoices. The request has no body.

curl -X POST "https://console.hosthatch.com/api/v1/invoices/715020/pay/" \
  -H "Authorization: Bearer $HOSTHATCH_API_KEY"
{"invoice_id": 715020, "paid_with": "card", "status": "paid"}

The invoice is paid with:

  • your account credit, when it covers the whole balance. An invoice that adds credit is never paid with credit;
  • otherwise your first saved card that can be charged. The API charges your cards up to $500 in any 30 days, unless support has set another limit for your account. Over it, the answer is 409 card_limit_reached, with the limit in limit and what was charged in charged. An invoice under $4 can only be paid with credit.

paid_with is credit or card. status is paid once billing shows the invoice paid, or processing when the money was taken and billing shows it paid shortly. Don't pay a processing invoice again. For an order's invoice, poll the order to follow what it bought.

Each call tries one card. Every decline counts against the card, as declines in the console do, and a card that fails three times in a row is blocked until support lifts the block. So don't retry card_declined: for a day, paying the same invoice through the API gets the same answer back, or 409 conflict once another card comes first. Pay that invoice in the console instead.

The invoice itself keeps it from being paid twice, so this endpoint takes no Idempotency-Key. While a payment for the invoice is being processed, another call answers 409 payment_in_progress, and once it is paid, 409 invoice_not_payable. After 502 payment_outcome_unknown the money may have been taken, so don't pay the invoice another way. Within 30 minutes it is booked, or released to be paid again.

Paying counts against the orders rate limit of 10 a minute per key.

Errors

Status Code When
400 validation_error A field is invalid, or the product doesn't offer that choice.
400 feature_unavailable user_data in an order.
400 promo_code_not_applicable The promo code isn't for the product or the billing cycle.
402 card_declined The saved card was declined. Pay the invoice in the console.
403 insufficient_role Only the project's owner can order and check promo codes.
403 read_only_key Ordering or paying with a read-only key.
403 billing_account_required The project's owner has no billing account, or, for invoices, you have none.
403 project_not_ready The project is still being set up.
403 order_refused A new customer's first server, which has to be ordered in the console.
403 card_payments_not_enabled The invoice needs a card, and support has turned off card payments through the API for your account.
404 not_found No such order or server in the project, or no such invoice of yours.
409 idempotency_key_reused The key was used for another request.
409 conflict The server has an upgrade or IP change that isn't paid or settled yet, or its billing service can't be found. An IP change of a suspended server too. For an invoice, it changed while it was being paid, it is under $4, or it was tried with another card in the last day.
409 insufficient_capacity The upgrade is out of stock in the server's location, or no new address is free for the IP change.
409 action_in_progress An IP change on a server with another action running.
409 ip_change_limit_reached The server has had 10 IP changes in the last 30 days.
409 invoice_not_payable The invoice isn't unpaid.
409 payment_in_progress A payment for the invoice is still being processed.
409 no_usable_card No saved card can be charged.
409 card_limit_reached The charge would go over your limit for card payments through the API, $500 in any 30 days unless support set another.
429 rate_limited More than 10 orders and invoice payments a minute with one key.
502 upstream_error Billing failed or didn't answer. With an order_id, poll that order.
502 payment_outcome_unknown The payment's answer was lost. Don't pay the invoice again.
503 upstream_unavailable Billing is unavailable for now.