Skip to content
Verified

Read the signed-in account

Pull the same account record a dashboard page load reads, with one call and no fields.

get_account_info is the same call the dashboard makes on every page load: no parameters beyond your credential, one account record back, covering plan, usage, storage and billing state in a single round trip. Reach for it whenever your own backend needs to know who it is talking to, or what plan and quota that account is currently on.

Method

POST/cpi/get_account_info
user

Get Account Info

Returns the account data for the requesting user, optionally enforcing usage limits.

Walkthrough

Call it with nothing but your key

get_account_info declares no fields of its own. The account it answers for is whichever one your credential authenticates, an account-scoped or project-scoped API key in the body, or a signed-in visitor's xu-gtp-token header if you are calling this from a browser session instead.

curl -s https://xuda.ai/cpi/get_account_info \
  -H 'content-type: application/json' \
  -d '{"api_key":"YOUR_API_KEY"}'
const res = await fetch('https://xuda.ai/cpi/get_account_info', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ api_key: 'YOUR_API_KEY' }),
});
const { code, data } = await res.json();
if (code > 0) console.log(data.account_info.email, data.membership_plan);
import requests

res = requests.post(
    'https://xuda.ai/cpi/get_account_info',
    json={'api_key': 'YOUR_API_KEY'},
)
body = res.json()
if body['code'] > 0:
    print(body['data']['account_info']['email'], body['data']['membership_plan'])

The response

data is the account document, trimmed to what a client should read. The fields below are the real keys get_account_data builds the response from, not a sample of a larger unknown shape:

json
{
  "code": 1,
  "data": {
    "_id": "acc_8f2a1c",
    "uid": "acc_8f2a1c",
    "account_info": {
      "email": "[email protected]",
      "first_name": "Jordan",
      "last_name": "Rivera",
      "phone_number": "+1 555 0142"
    },
    "stat": 3,
    "is_boarded": true,
    "membership_plan": "growth",
    "plan_info": { "...": "the current plan's own fields" },
    "support_plan": "standard",
    "ai_workspace_plan": "starter",
    "account_project_id": "app_5d9e21",
    "account_hosted_email": null,
    "drive_plan": "drive_free",
    "drive_usage": {
      "user_drive_size": 18291029,
      "studio_drive_size": 402981,
      "workspace_drive_size": 0,
      "total_drive_size": 18694010,
      "quota_bytes": 5368709120,
      "quota_unlimited": false
    },
    "billing_status": {
      "account_suspension_status": null,
      "account_billing_hold_status": null,
      "account_termination_status": null,
      "account_email_bounce_suspended": 0
    },
    "preferences": {},
    "login_screen": { "...": "the effective pre-auth login screen for this account" }
  }
}
  • account_info is the profile: email is the field you will key most integrations on.
  • is_boarded is an explicit boolean (never missing), the same flag the dashboard reads to decide whether to show onboarding.
  • drive_usage.quota_bytes / quota_unlimited is the same ceiling the storage bar draws from; quota_unlimited: true means read no meaning into quota_bytes for that account.
  • billing_status carries every hold/suspension/termination flag as one object. Everything in it is null (or 0) on a healthy account, so a truthy value anywhere in there is the whole signal you need to stop and show a billing message instead of proceeding.

Errors

See Errors for the codes shared by every method.

Next