Skip to content

List VPS billing cycle options

GET /api/v2/vps/{id}/actions/billing-cycle

List the billing cycles a VPS can switch to and the price of each. currentBillingCycle is the cycle it has now. Each amount is the price for one period of that cycle, with the VPS’s current resources, in the account’s currency.

Check actions.canChangeBillingCycle before you call POST /api/v2/vps/{id}/actions/billing-cycle. The gate is closed while an unpaid invoice or open order exists for the VPS. blockingInvoices then lists those invoices. It is also closed when the plan has only one cycle.

Authentication: An API key with the scope read:vm. About keys and scopes

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Example

GET /api/v2/vps/{id}/actions/billing-cycle
curl "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/billing-cycle" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

200 The billing cycle options.

Response 200
{
"currentBillingCycle": "monthly",
"cycles": [
{
"billingCycle": "monthly",
"amount": 99,
"currencyCode": "SEK",
"isCurrent": true
},
{
"billingCycle": "annually",
"amount": 999,
"currencyCode": "SEK",
"isCurrent": false
}
],
"actions": {
"canChangeBillingCycle": {
"allowed": true,
"reason": null
}
}
}
Response fields
currentBillingCyclestring
The billing cycle the VPS has now. One of monthly, quarterly, semiannually, annually, biennially, triennially, free.
cyclesarray of object
The cycles the VPS can have.
billingCyclestring
The billing cycle. One of monthly, quarterly, semiannually, annually, biennially, triennially, free.
amountnumber
Price for one period of this cycle.
currencyCodestring
ISO 4217 currency code.
isCurrentboolean
true for the cycle the VPS has now.
blockingInvoicesarray of object
Unpaid invoices that block a change. Present only when there are some.
idstring or null
The invoice ID.
numberstring or null
The invoice number.
amountnumber or null
Invoice total.
currencyCodestring
ISO 4217 currency code.
dueAtstring or null
When the invoice is due.
statusstring
Invoice status. One of unpaid, paid, cancelled, refunded, collections, unknown.
paymentUrlstring or null
Client-area path where the invoice can be paid.
actionsobject
canChangeBillingCycleobject
Whether the billing cycle can be changed now. reason says why not.
allowedboolean
reasonstring or null

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is vps_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.