Skip to content

Errors

Every error is a problem details document (RFC 9457), sent as application/problem+json. Its code is stable and made for code to act on. Its type links to the code's section on this page.

One answer is an HTML page instead: the limit in front of the API answers 429 without problem details. See Rate limits.

{
  "type": "https://docs.hosthatch.com/api/errors#validation_error",
  "title": "Validation failed",
  "status": 400,
  "detail": "One or more fields are invalid.",
  "code": "validation_error",
  "instance": "/api/v1/projects/acme/servers/774736/",
  "errors": [
    {"field": "hostname", "code": "invalid", "message": "Enter a valid hostname (letters, numbers, hyphens, and dots). Labels cannot start or end with a hyphen."}
  ]
}
Field Description
type A link to this page's section for the code.
title A short summary of the code.
status The HTTP status.
detail A sentence for people. It can change, so don't act on it.
code The stable code, one of those below.
instance The path of the request.
errors On validation_error only: each problem, with its field (null for the whole request), a code and a message.

Some errors add a member that names a resource: action_id, order_id, key_id, group_id, rule_id or servers. Each code's section says when.

Handle errors

  • Act on code. Don't parse detail or title.
  • A 4xx usually means the request has to change, and sending it again unchanged gets the same answer. Some describe a state that passes with time, such as 409 action_in_progress, 429 rate_limited, 403 project_not_ready and 409 insufficient_capacity. Each code's section below says whether waiting helps.
  • A 5xx is worth retrying after a short wait. Repeat an action or an order with the same Idempotency-Key, so it can't happen twice. Before you repeat any other write, check whether the first one went through, unless its page says it is safe to send again.
  • When there is a Retry-After header, wait that many seconds.
  • New codes can appear in v1. Treat a code you don't know by its HTTP status.
  • Check the Content-Type before you parse the body as problem details, because of that one HTML answer.

Codes

Code Status Title
validation_error 400 Validation failed
feature_unavailable 400 Feature unavailable
promo_code_not_applicable 400 Promo code not applicable
authentication_required 401 Authentication required
invalid_api_key 401 Invalid API key
api_key_expired 401 API key expired
card_declined 402 Card declined
permission_denied 403 Permission denied
insufficient_role 403 Insufficient role
read_only_key 403 Read-only API key
billing_account_required 403 Billing account required
project_not_ready 403 Project not ready
order_refused 403 Order refused
card_payments_not_enabled 403 Card payments not enabled
not_found 404 Not found
method_not_allowed 405 Method not allowed
not_acceptable 406 Not acceptable
conflict 409 Conflict
action_in_progress 409 Action in progress
already_enabled 409 Already enabled
not_eligible 409 Not eligible
reinstall_required 409 Reinstall required
insufficient_capacity 409 Insufficient capacity
snapshot_limit_reached 409 Snapshot limit reached
iso_limit_reached 409 ISO limit reached
ip_change_limit_reached 409 IP change limit reached
card_limit_reached 409 Card limit reached
invoice_not_payable 409 Invoice not payable
payment_in_progress 409 Payment in progress
no_usable_card 409 No usable card
iso_mounted 409 ISO mounted
name_taken 409 Name taken
group_in_use 409 Group in use
key_exists 409 Key exists
rule_exists 409 Rule exists
idempotency_key_reused 409 Idempotency key reused
unsupported_media_type 415 Unsupported media type
rate_limited 429 Rate limited
internal_error 500 Internal error
upstream_error 502 Upstream error
payment_outcome_unknown 502 Payment outcome unknown
node_maintenance 503 Node maintenance
reverse_dns_unavailable 503 Reverse DNS unavailable
upstream_unavailable 503 Upstream unavailable

400 Bad Request

validation_error

400 Validation failed

When: The request body, a query parameter or the Idempotency-Key header is invalid, or the body is not valid JSON. errors lists each problem: the field (null when it is about the whole request), a code and a message.

What to do: Correct the fields that errors names and send the request again. Sending it unchanged gets the same answer.

Default detail: “One or more fields are invalid.”

feature_unavailable

400 Feature unavailable

When: The request uses a feature that is not available yet: user_data (cloud-init) on a reinstall or a new server, or uploading an ISO.

What to do: Leave user_data out. For an ISO, mount one from the library instead.

Default detail: “This feature is not available yet.”

promo_code_not_applicable

400 Promo code not applicable

When: The promo code exists, but not for the product or the billing cycle you chose.

What to do: Choose a product and billing cycle the code is for, or order without it.

Default detail: “This promo code does not apply to the chosen product or billing cycle.”

401 Unauthorized

authentication_required

401 Authentication required

When: The request carries no API key, or its Authorization header uses a scheme other than Bearer. The response has a WWW-Authenticate: Bearer header.

What to do: Send Authorization: Bearer <key>. See Authentication.

Default detail: “Authentication credentials were not provided.”

invalid_api_key

401 Invalid API key

When: The key is unknown, malformed or revoked, or the user it belongs to is deactivated. Changing or resetting your password revokes every key you have.

What to do: Create a new key on your profile page. After 20 failed attempts in 10 minutes, every key attempt from your address is refused with rate_limited until the 10 minutes are over.

Default detail: “The API key is unknown, revoked or malformed.”

api_key_expired

401 API key expired

When: The key is past the expiry date it was created with.

What to do: Create a new key on your profile page.

Default detail: “The API key has expired. Create a new one on your profile page.”

402 Payment Required

card_declined

402 Card declined

When: Paying an invoice charged your saved card, and the bank declined it, asked you to authenticate the payment, or the card couldn't be charged. Nothing was charged. 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.

What to do: Don't send the payment again: for a day, paying the same invoice through the API gets the same answer. Pay that invoice in the console, or add another card there.

Default detail: “The card was declined. Pay the invoice in the console, or add another card.”

403 Forbidden

permission_denied

403 Permission denied

When: You are signed in, but not allowed to do this, and no more specific code applies. For example, deleting a library ISO, which every project shares.

What to do: Check that the key is yours and that you have the role the endpoint needs. Contact support if you think it is a mistake.

Default detail: “You do not have permission to perform this action.”

insufficient_role

403 Insufficient role

When: The endpoint needs a role you don't have in the project. Ordering, upgrading, buying bandwidth, changing an IP address, checking a promo code, moving a server and adding a server in no project are for the owner. Resetting a root password, cancelling a server and withdrawing a cancellation need the admin or owner role.

What to do: Ask an admin or the owner of the project. See Projects and roles.

Default detail: “Your role in the project does not allow this action.”

read_only_key

403 Read-only API key

When: A read-only key sent a request that would change something. Read-only keys can only read and poll.

What to do: Use a key that is not read-only.

Default detail: “This API key is read-only, so it cannot make changes.”

billing_account_required

403 Billing account required

When: The project's owner has no billing account yet, which the project's servers and other resources need. For invoices, you have none.

What to do: The project's owner sets one up on their profile page in the console.

Default detail: “The project owner needs to create a billing account first.”

project_not_ready

403 Project not ready

When: The project is still being set up, so its servers and other resources can't be reached yet.

What to do: Wait a minute and try again. Contact support if it lasts.

Default detail: “The project is still being set up. Please try again shortly.”

order_refused

403 Order refused

When: Our check turned the order down. A new customer's first server has to be ordered in the console. order_id names the order, recorded as failed, and the Idempotency-Key is not spent.

What to do: Read detail, which says what to do. Place your first order in the console.

Default detail: “Our check turned this order down. The detail says what to do.”

card_payments_not_enabled

403 Card payments not enabled

When: Paying the invoice needs a card, because your credit doesn't cover it or the invoice adds credit, and support has turned off card payments through the API for your account.

What to do: Pay the invoice in the console. An invoice that doesn't add credit can also be paid through the API once your credit covers it. Contact support to turn card payments through the API back on.

Default detail: “Paying by card through the API is not enabled on this account. Contact support to have it enabled.”

404 Not Found

not_found

404 Not found

When: The resource does not exist, belongs to another project, or is in a project you are not a member of. An invoice of another account answers this too. A path the API does not have, a malformed id, and a page past the end of a list answer this too.

What to do: Check the project slug, the id and the path. A 404 never says whether the resource exists somewhere you can't see.

Default detail: “The resource does not exist, or you do not have access to it.”

405 Method Not Allowed

method_not_allowed

405 Method not allowed

When: The path exists, but not with this method.

What to do: Check the method on the endpoint's page, for example PATCH rather than PUT.

Default detail: “This method is not allowed on this resource.”

406 Not Acceptable

not_acceptable

406 Not acceptable

When: The request's Accept header rules out JSON, which is the only format the API answers with.

What to do: Send Accept: application/json, or no Accept header.

Default detail: “This API only answers with JSON.”

409 Conflict

conflict

409 Conflict

When: The resource is not in a state that allows the request, and no more specific code applies. For example, the server has an upgrade that isn't paid or settled yet, the ISO to mount hasn't finished downloading, a cancellation of the other kind is already requested, or the same SSH key is being added by another request at that moment. A refused upgrade carries the open upgrade's id in order_id. For an invoice, it changed while it was being paid, it is under $4 and can only be paid with credit, or it was tried with another card in the last day.

What to do: Read detail, check the resource's current state, and try again once it has changed.

Default detail: “The resource is not in a state that allows this request.”

action_in_progress

409 Action in progress

When: Another exclusive action is still running on the server, or its outcome is still being confirmed. action_id names it when it is in your project.

What to do: Poll that action until it finishes, then send your request again. See Actions.

Default detail: “Another action is still running on this server.”

already_enabled

409 Already enabled

When: IPv6 or the private network is already enabled on the server.

What to do: Nothing to do. The server's network shows the subnet or the private network.

Default detail: “This is already enabled.”

not_eligible

409 Not eligible

When: The server can't have this. The private network is not available for it, or it is a legacy server, which can't take snapshots.

What to do: Contact support if you need it.

Default detail: “This server is not eligible for this action.”

reinstall_required

409 Reinstall required

When: The server's installation stopped before its disk was built, so it can't be started, its root password can't be reset and no ISO can be attached.

What to do: Reinstall the server, or restore a snapshot on it. Contact support if that fails too.

Default detail: “The server's installation did not finish. Reinstall it, or contact support.”

insufficient_capacity

409 Insufficient capacity

When: There is no capacity for this right now, for example no free IPv6 block for the server's location, or no stock in the server's location of the product an upgrade asks for.

What to do: Try again later, or contact support.

Default detail: “There is not enough capacity for this right now.”

snapshot_limit_reached

409 Snapshot limit reached

When: The project owner's account has as many snapshots as it is allowed, across all the owner's projects. Failed snapshots don't count.

What to do: Delete a snapshot of the project that you no longer need, or ask the project's owner to delete one, then try again.

Default detail: “The account has reached its snapshot limit.”

iso_limit_reached

409 ISO limit reached

When: The project already has a custom ISO. A project can hold one. iso_id names it when it can be read: after an upload whose answer was lost, it is the ISO that upload started.

What to do: Use the ISO in iso_id, or delete it and upload again.

Default detail: “The project already has a custom ISO.”

ip_change_limit_reached

409 IP change limit reached

When: The server has had 10 IP changes in the last 30 days, the most allowed.

What to do: Contact support if you need another.

Default detail: “This server has had its IP changed as often as allowed in the last 30 days. Contact support for another.”

card_limit_reached

409 Card limit reached

When: Charging the card would take what the API charged your cards in the last 30 days past your account's limit, which is $500 unless support has set another. A payment whose outcome is still being checked counts too. limit is the limit and charged what was charged, both in USD.

What to do: Pay the invoice in the console, or ask support to raise the limit.

Default detail: “This payment would go over the account's 30-day limit for card payments through the API. Pay it in the console, or contact support to raise the limit.”

invoice_not_payable

409 Invoice not payable

When: The invoice isn't unpaid. It is paid, cancelled or refunded, for example, or nothing is left to pay on it.

What to do: Fetch the invoice to see its state. A paid invoice needs nothing more.

Default detail: “This invoice is not awaiting payment.”

payment_in_progress

409 Payment in progress

When: A payment for the invoice is still being processed, through the API or in the console, or money was taken for it and billing hasn't booked it yet.

What to do: Don't pay the invoice another way. Fetch it again in a few minutes. A payment is booked, or the invoice released, within 30 minutes.

Default detail: “A payment for this invoice is still being processed. Please wait before paying again.”

no_usable_card

409 No usable card

When: Paying the invoice needs a card, and no saved card can be charged. There is none, the cards are blocked after failed payments, or card payments are suspended on your account.

What to do: Add a card in the console, or contact support about a blocked card.

Default detail: “The account has no saved card that can be charged. Add one in the console.”

iso_mounted

409 ISO mounted

When: The ISO you are deleting is mounted on a server.

What to do: Unmount it from every server first.

Default detail: “The ISO is mounted on a server.”

name_taken

409 Name taken

When: Another firewall group in the project has this name. group_id names it when it can be read back.

What to do: Choose another name. If you were retrying a create whose answer you lost, the group with this name is the one you created: it is in group_id, or in the project's list of groups.

Default detail: “The name is already in use.”

group_in_use

409 Group in use

When: The firewall group you are deleting is still attached to servers. servers lists their ids.

What to do: Detach the group from those servers first. Deleting it would change what they allow.

Default detail: “The firewall group is still attached to servers.”

key_exists

409 Key exists

When: The public key is already in the project, whatever its comment. key_id names it.

What to do: Use the existing key. If you were retrying a create whose answer you lost, it is the one you added.

Default detail: “This public key is already in the project.”

rule_exists

409 Rule exists

When: The firewall group already has a rule that matches the same traffic, however it is spelled. rule_id names it when it can be read back.

What to do: Use the existing rule: it is in rule_id, or in the group's list of rules. If you were retrying a create whose answer you lost, it is the one you added.

Default detail: “An identical rule is already in the group.”

idempotency_key_reused

409 Idempotency key reused

When: The Idempotency-Key was already used in this project for a request with another method, path or body.

What to do: Use a new key for every new request, and the same key only to repeat the same request.

Default detail: “This Idempotency-Key was already used for a different request.”

415 Unsupported Media Type

unsupported_media_type

415 Unsupported media type

When: The request body is not JSON.

What to do: Send the body as JSON with Content-Type: application/json.

Default detail: “Send the request body as application/json.”

429 Too Many Requests

rate_limited

429 Rate limited

When: The key, or your address, has used its budget for now. Retry-After says how many seconds to wait.

What to do: Wait for Retry-After, then continue at a slower pace. See Rate limits, which also covers the plain HTML 429 that can come before the API's own.

Default detail: “Too many requests. Wait for the time given in Retry-After.”

500 Internal Server Error

internal_error

500 Internal error

When: Something went wrong on our side.

What to do: Try again after a short wait. Repeat an action or an order with the same Idempotency-Key, so it can't happen twice. Before you repeat any other write, check whether it went through, unless its page says it is safe to send again. Contact support with the time and the path if it keeps happening.

Default detail: “Something went wrong on our side. Please try again.”

502 Bad Gateway

upstream_error

502 Upstream error

When: A system behind the API refused the request or did not answer. When an action or order was already recorded, the response carries its id in action_id or order_id, because the operation may have happened.

What to do: With action_id or order_id, poll that action or order instead of sending the request again. After an ISO upload, list the project's ISOs, or send the upload again: if it had started, the answer is 409 iso_limit_reached with its id. Otherwise try again after a short wait.

Default detail: “The request could not be completed. Please try again.”

payment_outcome_unknown

502 Payment outcome unknown

When: The payment of an invoice was sent, and its answer was lost, so the money may have been taken.

What to do: Don't pay the invoice again, in any way. Within 30 minutes the payment is booked, or the invoice is released and can be paid again. Fetch it then. Support checks a payment billing can't settle.

Default detail: “We couldn't confirm the payment. Don't pay the invoice again. We are checking it.”

503 Service Unavailable

node_maintenance

503 Node maintenance

When: The host the server runs on is in maintenance. Retry-After is 300 seconds.

What to do: Try again after Retry-After.

Default detail: “The server's host is in maintenance. Please try again later.”

reverse_dns_unavailable

503 Reverse DNS unavailable

When: The reverse DNS service is unavailable. Retry-After is 300 seconds.

What to do: Try again after Retry-After.

Default detail: “Reverse DNS is unavailable. Please try again later.”

upstream_unavailable

503 Upstream unavailable

When: A service behind the API, such as billing, is unavailable for now. Retry-After says when to try again.

What to do: Try again after Retry-After.

Default detail: “A service behind the API is unavailable right now.”

Action errors

An action that fails reports its own codes in error.code: failed, outcome_unknown, task_result_unavailable, timeout and resource_moved. See Actions.