# Get account details

`GET https://console.advinservers.com/api/v1/client/account`

### Overview

Returns billing contact details, account email, balance, currency and the account portal URL. Missing profile values are null. `email_verified` is null when verification status is unknown. Balance amounts are formatted for display and include partial payments; do not parse them as numbers. Returns 400 if billing is unavailable or disabled.

### Permissions

Requires the account permission `account.read` (View the account).

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Response 200

The record, as a JSON object. There is no envelope.

- `profile` (object, required): The name and address used for billing. Missing values are null, not empty strings.
  - `first_name` (string | null, required): The account holder's first name, or null when it is not provided.
  - `last_name` (string | null, required): The account holder's last name, or null when it is not provided.
  - `company_name` (string | null, required): The company name used for billing, or null when it is not provided.
  - `address1` (string | null, required): The first line of the billing address, or null when it is not provided.
  - `address2` (string | null, required): The second line of the billing address, or null when it is not provided.
  - `city` (string | null, required): The billing address city, or null when it is not provided.
  - `state` (string | null, required): The billing address state, province, or region, or null when it is not provided.
  - `postcode` (string | null, required): The billing address postal code, or null when it is not provided.
  - `country` (string | null, required): An ISO 3166-1 alpha-2 code, or null where the stored value is not one.
  - `country_name` (string | null, required): The country display name, or null when the stored country code is not recognized.
  - `phone_number` (string | null, required): The billing contact phone number, or null when it is not provided.
  - `tax_id` (string | null, required): The tax identification number, or null when it is not provided.
- `balance` (object, required): The current outstanding balance, including partial payments. Amounts include currency symbols and digit separators. Display these strings directly; do not parse them as numbers.
  - `due` (string | null, required): The total unpaid balance, formatted for display, or null when unavailable.
  - `overdue` (string | null, required): The overdue balance, formatted for display, or null when unavailable.
  - `credit` (string | null, required): The available account credit, formatted for display, or null when unavailable.
  - `unpaid_invoices` (integer, required): The number of invoices with an outstanding balance.
  - `overdue_invoices` (integer, required): The number of overdue invoices.
  - `has_due` (boolean, required): Whether the account has an unpaid balance.
  - `has_overdue` (boolean, required): Whether the account has an overdue balance.
  - `currency` (string | null, required): The three-letter billing currency code, or null when it is not known.
- `currency` (string | null, required): The currency the account is billed in, or null when it is not known.
- `email` (string<email>, required): The account email address. It cannot be changed through this endpoint.
- `email_verified` (boolean | null, required): Whether the email address is verified. Null means the billing record does not provide this information; it does not mean false.
- `portal_url` (string | null, required): A link to the external account portal, or null if no portal is configured.

```json
{
  "profile": {
    "first_name": "Gordon",
    "last_name": "Freeman",
    "company_name": "Black Mesa Research Facility",
    "address1": "1 Mesa Road",
    "address2": "Sector C, Anomalous Materials Laboratory",
    "city": "Socorro",
    "state": "New Mexico",
    "postcode": "87801",
    "country": "US",
    "country_name": "United States",
    "phone_number": "+1 575 555 0198",
    "tax_id": null
  },
  "balance": {
    "due": "$42.00",
    "overdue": "$12.00",
    "credit": "$10.00",
    "unpaid_invoices": 2,
    "overdue_invoices": 1,
    "has_due": true,
    "has_overdue": true,
    "currency": "USD"
  },
  "currency": "USD",
  "email": "gordon.freeman@blackmesa.example.com",
  "email_verified": true,
  "portal_url": "https://clients.advinservers.com"
}
```

## Errors

- `400`: The account's billing record could not be reached, this installation has none behind it, or the change was refused with a reason of its own. The message says which.
- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request GET \
  --url 'https://console.advinservers.com/api/v1/client/account' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json'
```
