Change a domain's renewal period
POST /api/v2/domains/{id}/billing-cycle
Change how many years a domain renews for at a time. Read GET /api/v2/domains/{id}/billing-cycle right before. Send only a period that appears in that GET response’s options[]. Send billingCycle for 1, 2 or 3 years. Send periodYears for a longer row. When you send both, they must name the same period. A period the domain does not offer returns 400 invalid_request. So does any change on a premium domain. The new period and its price apply from the next renewal. No invoice is created now. An unpaid renewal or another open order returns 409 existing_invoice_blocking. The order is then in pendingRenewalOrder or pendingOrder and its invoice in existingInvoice. Contacts on the account need permission to place orders.
Authentication: An API key with the scopes write:domains and write:billing. About keys and scopes
Request
Path parameters
idstringrequireddom_…).Body
billingCyclestringannually, biennially, triennially.periodYearsinteger | stringbillingCycle is null. 1 to 9.Example
curl -X POST "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/billing-cycle" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "billingCycle": "biennially" }'curl -X POST "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/billing-cycle" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "periodYears": 5 }'Responses
200 The domain’s billing after the change.
{ "billing": { "amount": 338, "currencyCode": "SEK", "billingCycle": "biennially", "periodYears": 2 }}Response fields
billingobjectamountnumbercurrencyCode.currencyCodestringbillingCyclestring or nullperiodYears then. One of annually, biennially, triennially.periodYearsinteger or nullinitialAmountnumberErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is domain_not_found. |
| 409 | An unpaid renewal or another open order blocks the change (existing_invoice_blocking). Pay or cancel the order in pendingRenewalOrder or pendingOrder first. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |