# Accounts

> Source: https://developers.cloud66.com/v3/endpoints/accounts/

## Get Account

URL: https://developers.cloud66.com/v3/endpoints/accounts/#get
Endpoint: GET /accounts/:id
OAuth scope: users

Retrieves detailed information for a specific account.

This endpoint returns comprehensive details about a single account, including optional unmanaged server information when explicitly requested.

**Related models:** Account

<Callout type="info" title="Unmanaged Servers">
The `unmanaged_servers` field is only populated when the `include_servers` parameter is set to true and only for your primary account.
</Callout>

<ResponseCodes 
  codes={[200, 400, 401, 403, 404]}
  overrides={{
    200: "Success - Returns account details",
    400: "Bad Request - Invalid request parameters or account is restricted",
    403: "Forbidden - OAuth token lacks required `users` scope or user lacks account access",
    404: "Not Found - Account doesn't exist or user lacks access"
  }}
/>

### Parameters

- `id` (integer, required) — The account ID
- `include_servers` (boolean, optional) — Include unmanaged servers in the response (only available for your primary account)

### Response

```json
{
  "response":
    {
      "id": 139,
      "owner": "test@cloud66.com",
      "created_at_iso": "2013-06-19T11:08:03Z",
      "updated_at_iso": "2014-02-20T12:55:58Z",
      "stack_count": 2,
      "used_clouds": ["digitalocean","rackspace"],
      "current_account": true,
      "friendly_name": "My Company Account",
      "unmanaged_servers": [
        {
          "id": "i-0123456789abcdef0",
          "name": "unmanaged-server-1",
          "vendor": "aws"
        }
      ],
      "server_registration_script": "curl -sSL https://get.cloud66.com | bash",
      "configstore_namespace": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    }
}
```

---

## List Accounts

URL: https://developers.cloud66.com/v3/endpoints/accounts/#list
Endpoint: GET /accounts
OAuth scope: users

Lists all accounts that the current authenticated user has access to.

This endpoint returns a paginated list of accounts with their associated metadata, including stack counts, cloud providers used, and account status information.

**Related models:** Account, Pagination

<ResponseCodes 
  codes={[200, 400, 401, 403]}
  overrides={{
    200: "Success - Returns paginated list of accounts",
    403: "Forbidden - OAuth token lacks required `users` scope"
  }}
/>

### Response

```json
{
  "response": [
    {
      "id": 139,
      "owner": "test@cloud66.com",
      "created_at_iso": "2013-06-19T11:08:03Z",
      "updated_at_iso": "2014-02-20T12:55:58Z",
      "stack_count": 2,
      "used_clouds": ["digitalocean","rackspace"],
      "current_account": true,
      "friendly_name": "My Company Account",
      "unmanaged_servers": null,
      "server_registration_script": "curl -sSL https://get.cloud66.com | bash",
      "configstore_namespace": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    }
  ],
  "count":1,
  "pagination":{
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}
```

---

## Generate OTP

URL: https://developers.cloud66.com/v3/endpoints/accounts/#otp
Endpoint: POST /accounts/otp
OAuth scope: users

Generates a one-time password (OTP) for client authentication.

This endpoint creates a temporary authentication token that can be used by Cloud 66 clients for secure web access, exclusively for the calling user. The OTP has a limited lifespan and is intended for single-use authentication scenarios.

**Related models:** Account

The generated OTP can be used by Cloud 66 command-line tools and other clients to authenticate with the web dashboard.

<ResponseCodes 
  codes={[200, 400, 401, 403]}
  overrides={{
    200: "Success - Returns generated OTP",
    403: "Forbidden - OAuth token lacks required `users` scope"
  }}
/>

### Response

```json
{
  "response": {
    "ok": true,
    "otp": "abc123def456ghi789jkl012mno345pqr678stu901vwx234"
  }
}
```
