Skip to content

List billing periods for web hosting

GET /api/v2/shared-hosting/{accountId}/actions/billing-cycle

List the billing periods a web hosting account can switch to, with the price of each in the account’s currency. To change the period, pick a row from cycles and send it to POST /api/v2/shared-hosting/{accountId}/actions/billing-cycle. actions.canChangeBillingCycle is closed while an order or an unpaid renewal invoice is open for the account. Those invoices are listed in blockingInvoices. The gate is also closed when the plan has no other period. The gate is closed with code: "overdue_invoice" when the paid period has ended and the renewal invoice is still unpaid. It is also closed with that code when an invoice in blockingInvoices is past its dueAt. That invoice must be paid first. Sending cancelExistingInvoice: true does not lift it. The account must be active. A contact needs permission to place orders.

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

Request

Path parameters

accountIdstringrequired
The web hosting account ID (acct_…).

Example

GET /api/v2/shared-hosting/{accountId}/actions/billing-cycle
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/billing-cycle" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

200 The billing periods and whether the period can be changed now.

{
"currentBillingCycle": "annually",
"cycles": [
{
"billingCycle": "monthly",
"amount": 19,
"currencyCode": "SEK",
"isCurrent": false
},
{
"billingCycle": "annually",
"amount": 99,
"currencyCode": "SEK",
"isCurrent": true
}
],
"actions": {
"canChangeBillingCycle": {
"allowed": true,
"reason": null
}
}
}
Response fields
currentBillingCyclestring
The account’s billing period now. One of monthly, quarterly, semiannually, annually, biennially, triennially, free.
cyclesarray of object
The billing periods on offer.
billingCyclestring
The billing period. One of monthly, quarterly, semiannually, annually, biennially, triennially, free.
amountnumber
The price per period in currencyCode.
currencyCodestring
The account’s currency.
isCurrentboolean
True for the account’s current period.
blockingInvoicesarray of object
Unpaid invoices that block a change. Pay or cancel them first. Only present when there are any.
idstring or null
The invoice ID.
numberstring or null
The invoice number.
amountnumber or null
The invoice total.
currencyCodestring
dueAtstring or null
When the invoice is due.
statusstring
The invoice status, for example unpaid.
paymentUrlstring or null
Where the invoice is paid in the client area.
actionsobject
canChangeBillingCycleobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.

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 shared_hosting_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.