## GET /api/v2/domains/{id}/billing-cycle

**Get domain billing-period options**

Return the current domain renewal period, product-supported period options, prices, and the server-side action gate for changing it. Get `{id}` from `GET /api/v2/domains` `data[].id`. Always read this endpoint immediately before POST and choose one row from `options[]`; supported periods vary by TLD and product, so callers must not assume every 1-9 year value is available. For 1, 2, and 3 year rows, `billingCycle` is `annually`, `biennially`, or `triennially`. For longer rows, `billingCycle` is null and `periodYears` is the value to send. If `locked` is true or `actions.canChangeBillingCycle.allowed` is false, do not call POST until the blocker is resolved. A pending renewal order can be declined with `POST /api/v2/domains/{id}/actions/respond-to-renewal` and `{ "accept": false }`; a pending domain order can be inspected and cancelled with `GET /api/v2/orders/{id}` and `POST /api/v2/orders/{id}/actions/cancel`.

### Related Endpoints

- `POST /api/v2/domains/{id}/billing-cycle`: Change domain billing period
- `GET /api/v2/domains/{id}`: Get domain details
- `GET /api/v2/domains/{id}/renewal`: Get domain renewal state

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scope: `read:domains`

### Parameters

- `id` (path, string, required): Public domain ID from `GET /api/v2/domains` `data[].id`. Do not invent this value; use the exact ID returned by the referenced API response. Example: `dom_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Example

```bash
curl -X GET "https://cloud.hostup.se/api/v2/domains/dom_01hxa3b4c5d6e7f8g9h0j1k2m3/billing-cycle" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

### Response Schema

- `currentBillingCycle` (string,null, optional): Canonical slug for the current period when it is 1, 2, or 3 years. Null for longer domain-only periods. Example: `annually`
  Allowed values: annually, biennially, triennially, 
- `currentPeriodYears` (integer,null, optional): Current renewal period length in years. Example: `1`
- `currencyCode` (string, optional): ISO-4217 currency for all amounts in `options[]`. Example: `SEK`
- `options` (array<object>, optional): Available renewal periods for this exact domain. Select one returned row before POST; supported year counts vary by TLD/product.
- `options[].billingCycle` (string,null, required): Canonical slug for one-, two-, and three-year periods. Four- to nine-year periods return null and are selected with `periodYears`. Example: `annually`
  Allowed values: annually, biennially, triennially, 
- `options[].periodYears` (integer, required) Example: `1`
- `options[].years` (integer, required): Alias of `periodYears` kept because the upstream options endpoint already exposes `years`. Example: `1`
- `options[].amount` (number,null, required): Canonical renewal amount for this period in `currencyCode`. Example: `169`
- `options[].currencyCode` (string, required): ISO-4217 currency for this option's `amount` and legacy `renewPrice` alias. Example: `SEK`
- `options[].renewPrice` (number,null, required): Deprecated alias of `amount`, kept for old dashboard consumers during migration. Example: `169`
- `options[].isCurrent` (boolean, required) Example: `true`
- `locked` (boolean, optional) Example: `false`
- `lockReason` (string,null, optional) Example: `null`
- `pendingRenewalOrder` (null, optional) Example: `null`
- `pendingOrder` (null, optional) Example: `null`
- `actions` (object, optional)
- `actions.canChangeBillingCycle` (object, required)
- `actions.canChangeBillingCycle.allowed` (boolean, required) Example: `true`
- `actions.canChangeBillingCycle.reason` (string,null, required) Example: `null`
- `actions.canChangeBillingCycle.code` (string,null, optional) Example: `null`
  Allowed values: pending_renewal_order, pending_domain_order, locked, 

### Responses

#### 200 - Billing-period options and change gate.
```json
{
  "currentBillingCycle": "annually",
  "currentPeriodYears": 1,
  "currencyCode": "SEK",
  "options": [
    {
      "billingCycle": "annually",
      "periodYears": 1,
      "years": 1,
      "amount": 169,
      "currencyCode": "SEK",
      "renewPrice": 169,
      "isCurrent": true
    },
    {
      "billingCycle": "biennially",
      "periodYears": 2,
      "years": 2,
      "amount": 338,
      "currencyCode": "SEK",
      "renewPrice": 338,
      "isCurrent": false
    },
    {
      "billingCycle": "triennially",
      "periodYears": 3,
      "years": 3,
      "amount": 507,
      "currencyCode": "SEK",
      "renewPrice": 507,
      "isCurrent": false
    },
    {
      "billingCycle": null,
      "periodYears": 5,
      "years": 5,
      "amount": 845,
      "currencyCode": "SEK",
      "renewPrice": 845,
      "isCurrent": false
    }
  ],
  "locked": false,
  "lockReason": null,
  "pendingRenewalOrder": null,
  "pendingOrder": null,
  "actions": {
    "canChangeBillingCycle": {
      "allowed": true,
      "reason": null
    }
  }
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request body failed validation.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z",
  "errors": [
    {
      "pointer": "/items/0/domainName",
      "detail": "`domainName` is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller.
```json
{
  "type": "https://developer.hostup.se/errors/not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Too many requests. Retry after the limit resets.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
