## GET /api/v2/domains

**List domains**

Return domains on the account with canonical lifecycle, billing, dates, tags, and pin state. Use `name=example.com` to find the public `dom_...` ID when the caller only knows the domain name; do not pass FQDNs as `{id}` to detail/action routes. Use `GET /api/v2/domains/{id}` for nameservers, transfer secrets state, pending orders, registry-lock gates, and other per-domain actions.

### Related Endpoints

- `GET /api/v2/domains/{id}`: Get domain details
- `PATCH /api/v2/domains/{id}`: Update domain settings
- `DELETE /api/v2/domains/{id}`: Delete domain

### Headers

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

### Parameters

- `limit` (query, integer) [min: 1, max: 1000]: Maximum domains to return in this page.
- `cursor` (query, string): Opaque cursor from `nextCursor` for the next page.
- `include` (query, string): Comma-separated optional expansions. Currently supports `hostingConnection`. Example: `hostingConnection`
- `name` (query, string): Exact domain name to find, for example `example.com`. Use this to get the public `dom_...` ID before calling domain detail or action endpoints. Example: `example.com`

### Request Example

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

### Response Schema

- `data` (array<object>, optional)
- `data[].id` (string, required) Example: `dom_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `data[].name` (string, required) Example: `example.com`
- `data[].serviceStatus` (string, required) Example: `active`
  Allowed values: active, suspended, terminated, pending, cancelled, expired, fraud, unknown
- `data[].orderId` (string, optional) Example: `ord_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `data[].lifecycle` (object, required)
- `data[].lifecycle.type` (string, required): Normalized lifecycle type. Common values are standard, registration, transfer, and renewal. Example: `standard`
- `data[].lifecycle.autoRenewEnabled` (boolean,null, required) Example: `true`
- `data[].lifecycle.registrarLockEnabled` (boolean,null, required) Example: `false`
- `data[].lifecycle.transferInProgress` (boolean, required) Example: `false`
- `data[].billing` (object, required)
- `data[].billing.amount` (number, required) Example: `159`
- `data[].billing.currencyCode` (string, required) Example: `SEK`
- `data[].billing.billingCycle` (string,null, required): Canonical cycle slug for 1-3 year periods. Four- to nine-year domain periods return null and use periodYears. Example: `annually`
  Allowed values: annually, biennially, triennially, 
- `data[].billing.periodYears` (integer,null, required) Example: `1`
- `data[].billing.initialAmount` (number, optional): First-period amount when it differs from the recurring amount. Example: `99`
- `data[].createdAt` (string,null, required) Example: `2025-04-27T09:00:00.000Z`
- `data[].expiresAt` (string,null, required) Example: `2027-04-27T21:59:59.000Z`
- `data[].nextDueAt` (string,null, required) Example: `2027-03-28T00:00:00.000Z`
- `data[].tags` (array<string>, required) Example: `["production"]`
- `data[].pinned` (boolean, required) Example: `false`
- `data[].hostingConnection` (object, optional)
- `data[].hostingConnection.type` (string, required) Example: `hosting`
  Allowed values: standalone, hosting, wordpress
- `data[].hostingConnection.hostingAccountId` (string,null, required) Example: `acct_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `data[].hostingConnection.hostingAccountName` (string,null, required) Example: `Webbhotell Start`
- `data[].hostingConnection.hostingAccountDomain` (string,null, required) Example: `example.com`
- `data[].hostingConnection.ssl` (object,null, required)
- `hasMore` (boolean, optional) Example: `false`
- `nextCursor` (string,null, optional) Example: `null`

### Responses

#### 200 - Cursor-paginated list.
```json
{
  "data": [
    {
      "id": "dom_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "name": "example.com",
      "serviceStatus": "active",
      "lifecycle": {
        "type": "registration",
        "autoRenewEnabled": true,
        "registrarLockEnabled": false,
        "transferInProgress": false
      },
      "billing": {
        "amount": 159,
        "currencyCode": "SEK",
        "billingCycle": "annually",
        "periodYears": 1
      },
      "createdAt": "2025-04-27T09:00:00.000Z",
      "expiresAt": "2027-04-27T21:59:59.000Z",
      "nextDueAt": "2027-03-28T00:00:00.000Z",
      "tags": [
        "production"
      ],
      "pinned": false
    }
  ],
  "hasMore": false,
  "nextCursor": 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"
}
```
