get_account_data

To get information about the account of the current user and its billing plan (billing plan name, balance, days left, available services), use the core/get_account_data method.

Endpoint

Copied!
svc=core/get_account_data&params={
  "type": <uint>
}

Parameters

The request must contain the following parameter:

Parameter Description
type Type of the returned information. Possible values:

Response

If the request is completed successfully, the response contains basic or detailed information, depending on the value of the type parameter.

If the request is executed for a top account, the response doesn’t contain the parentAccountName, parentAccountId, and parentEnabled fields, since a top account has no parent account.

Basic information

If the type parameter is 1, the response is returned in the following format:

Copied!
{
  "parentAccountName": <text>,  /* Parent account name. */
  "parentAccountId": <long>,    /* Parent account ID. */
  "parentEnabled": <int>,       /* Parent account state: 0 (blocked), 1 (active). */
  "plan": <text>,               /* Billing plan name. */
  "enabled": <int>,             /* Account state: 0 (blocked), 1 (active). */
  "switchTime": <uint>,         /* Last time the account state was changed (Unix time). */
  "created": <uint>,            /* Account creation time (Unix time). */
  "flags": <uint>,              /* Billing plan flags. */
  "balance": <text>,            /* Balance (with currency). */
  "daysCounter": <int>,         /* Day counter. */
  "services": {                 /* Services. */
    <text>: {                   /* Service name. */
      "type": <int>,            /* Service type: 1 (on demand), 2 (periodic). */
      "usage": <uint>,          /* Number of used items of this service. */
      "maxUsage": <int>         /* Maximum number of items of this service. */
    },
    ...
  },
  "dealerRights": <int>,        /* Dealer rights for the billing plan: 0 (no), 1 (yes). Returned only if the account has dealer rights. */
  "subPlans": [<text>]          /* Subordinate billing plans. Returned only if the account has dealer rights. */
}

Detailed information

If the type parameter is 2 or 10, the response is returned in the following format:

Response
Copied!
{
  "parentAccountName": <text>,  /* Parent account name. */
  "parentAccountId": <long>,    /* Parent account ID. */
  "parentEnabled": <int>,       /* Parent account state: 0 (blocked), 1 (active). */
  "plan": <text>,               /* Billing plan name. */
  "enabled": <int>,             /* Account state: 0 (blocked), 1 (active). */
  "switchTime": <uint>,         /* Last time the account state was changed (Unix time). */
  "created": <uint>,            /* Account creation time (Unix time). */
  "flags": <uint>,              /* Billing plan flags. Duplicates the flags of the billing plan settings. */
  "balance": <text>,            /* Balance (with currency). */
  "daysCounter": <int>,         /* Day counter. */
  "settings": {                 /* Settings. */
    "balance": <double>,        /* Balance. */
    "plan": {                   /* Billing plan settings. */
      "flags": <uint>,          /* Billing plan flags. */
      "blockBalance": <double>, /* Balance below which the account is blocked. */
      "denyBalance": <double>,  /* Balance below which paid services are unavailable. */
      "minDaysCounter": <int>,  /* Number of days below which the account is blocked. */
      "historyPeriod": <uint>,  /* Message storage period, in days. 0 means unlimited. */
      "currencyFormat": <text>, /* Currency format. */
      "services": {             /* Services. */
        <text>: {               /* Service name. */
          "type": <int>,        /* Service type: 1 (on demand), 2 (periodic). */
          "usage": <uint>,      /* Number of used items of this service. */
          "maxUsage": <int>,    /* Maximum number of items of this service. */
          "cost": <text>,       /* Cost table. */
          "interval": <int>,    /* Reset interval: 0 (none), 1 (hourly), 2 (daily), 3 (weekly), 4 (monthly). */
          "descr": <text>       /* Description. */
        },
        ...
      }
    },
    "personal": {               /* Account settings. */
      ...                       /* In the same format as the billing plan settings, without currencyFormat. */
    },
    "combined": {               /* Combined settings of the billing plan and the account. */
      ...                       /* In the same format as the billing plan settings, without currencyFormat. */
    },
    "siteAccess": {             /* Sites available to the account. */
      <text>: <text>,           /* Key: service name. Value: DNS name or, if the type parameter is 10, site details. */
      ...
    },
    "serviceKeys": {            /* External map providers. */
      ...
    }
  },
  "dealerRights": <int>,        /* Dealer rights for the billing plan: 0 (no), 1 (yes). */
  "subPlans": [<text>]          /* Subordinate billing plans. */
}

The account and billing plan flags, the service key types, the list of services, and the format of the site details are described on the account/get_account_data page.

For more information about the account and billing plan settings, see account/update_billing_plan.

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters, or failed to get the current user or their account.

If you find a mistake in the text, please select it and press Ctrl+Enter.