> ## Documentation Index
> Fetch the complete documentation index at: https://support.configview.com/llms.txt
> Use this file to discover all available pages before exploring further.

# xAI setup

ConfigView reads your xAI (Grok API) team through the xAI Management API (`https://management-api.x.ai`), using a **management key** that a team admin creates in the xAI Console. ConfigView only reads. The one `POST` it sends is xAI's usage query, which returns numbers and changes nothing.

You will end up with **1 required secret** (`XAI_MANAGEMENT_KEY`) and **1 optional secret** (`XAI_TEAM_ID`) in ConfigView when setup is complete.

> **Scope of this integration today.** ConfigView reads every Grok API key's metadata (name, who created it, created and modified dates, expiry, disabled flag, request and token rate limits, and the model and endpoint permissions it holds), daily spend and usage for the last 30 days split by API key, user and model, the prepaid credit balance and monthly spending limits, the team audit log for the last 90 days, and the permissions of the management key itself. It does not read prompts, completions, invoices, payment methods, billing addresses or the secret value of any key.

***

## Read this first: there is no member list

The Management API has **no endpoint that lists team members**. ConfigView builds the people list from two places: the person who created each API key, and the people who appear in the audit log. A teammate who has never created a key and has no audit event in the last 90 days will not appear. Email addresses come from the audit log only, so a key creator with no recent audit event shows as a user id until they act.

***

## What you need

* An xAI Console team and a user who can create management keys (the user needs the **Management Keys** read and write permission)
* Nothing else. Any team plan can create a management key.

***

## Step 1: Open the xAI page in ConfigView

Open ConfigView in a second browser tab and leave it open:

`https://{companyname}.configview.com/admin/integrations/xai`

***

## Step 2: Create the management key

1. In the xAI Console (`https://console.x.ai`) open **Settings → Management Keys**
2. Click **Create**, name it `ConfigView`, and grant the narrowest permissions that let it read API keys, billing and audit events. Do not grant permissions to create, update, rotate or delete keys. If the Console only offers a full key, that is acceptable but broader than ConfigView needs.
3. Copy the key now. xAI shows it only once.
4. In the ConfigView tab paste it into `XAI_MANAGEMENT_KEY` under **Credentials** and click the save icon

A management key is **not** an inference API key. An inference key (`xai-...`) is refused here.

***

## Step 3: Team ID (optional)

ConfigView reads the team from the management key itself. If a check says it cannot find the team, copy the **Team ID** from the Console team settings into `XAI_TEAM_ID`.

***

## Step 4: Connect and verify

1. Click **Connect**. ConfigView creates its tables and schedules every collector at your default run time.

| Script | Notes |
| - | - |
| **Management key** | The key ConfigView uses and the permissions it holds. |
| **API keys** | Every API key with creator, expiry, limits and permissions. |
| **Daily usage** | Cost, units and requests per day by key, user and model, last 30 days. |
| **Billing** | Prepaid balance and spending limits. Skipped if the key lacks billing permission. |
| **Audit events** | The team audit log, newest 5000 events in the last 90 days. Skipped if the key lacks permission. |
| **People** | Key creators and audit actors, derived. |

2. Click **Verify now**. The health check reads the secret, validates the management key and lists one page of API keys.

If a check fails:

* **Validation fails with 401.** The key is wrong, revoked or is an inference key. Create a management key.
* **API keys fail with 403.** The management key's permissions do not include listing API keys.
* **Billing, usage or audit show as skipped.** The key lacks those permissions. Add them or accept the gap.

***

## Data Tables

Once the scripts run, these tables are created in your database. Each table has a `run_at` column and keeps the newest run only.

| Table | Source | Key Columns |
| - | - | - |
| `xai_management_key` | `GET /auth/management-keys/validation` | key\_id, name, scope, owner\_user\_id, acl\_count, has\_write\_acl, acls, created\_at |
| `xai_api_keys` | `GET /auth/teams/{teamId}/api-keys` | api\_key\_id, name, redacted\_key, creator\_user\_id, creator\_email, disabled, expires\_at, qps, qpm, tpm, all\_models, all\_endpoints, acls |
| `xai_usage_daily` | `POST /v1/billing/teams/{teamId}/usage` | usage\_date, api\_key\_id, api\_key\_name, user\_id, user\_email, description, cost\_usd, units, requests |
| `xai_billing` | `GET /v1/billing/teams/{teamId}/prepaid/balance`, `.../postpaid/spending-limits` | balance\_cents, purchase\_count, last\_purchase\_at, soft\_limit\_cents, hard\_limit\_cents |
| `xai_audit_events` | `GET /audit/teams/{teamId}/events` | event\_id, event\_time, actor\_user\_id, actor\_email, action\_kind, description |
| `xai_people` | derived from keys and audit events | user\_id, email, key\_count, active\_key\_count, audit\_event\_count, last\_event\_at, source |

***

## Things worth knowing

**Keys with no expiry or no limits.** `expires_at` empty means the key never lapses. `qps`, `qpm` and `tpm` all empty means the key has no rate or token limit. `all_models` and `all_endpoints` mark keys with wildcard permissions.

**Who is spending.** Usage is grouped by key, user and model (`description` is the product followed by the model). `units` counts tokens for token types and other units (images, audio seconds) otherwise, so use `cost_usd` and `requests` for comparisons.

**Balance.** Amounts in `xai_billing` are USD cents. xAI reports the prepaid total as negative while credit remains, so `balance_cents` is its negation.

**Audit descriptions.** `description` is free English text written by xAI, for example `API key 'Production Key' was created`. `action_kind` is a coarse label ConfigView derives from it (created, deleted, disabled, updated, invited, joined, sign\_in, other).

**Rate limit.** xAI publishes no limit for the Management API. ConfigView paces itself at 30 requests a minute and waits out any 429 using the `Retry-After` header.

## What isn't collected

* Prompts, completions and any model output
* The secret value of any API key (xAI returns it only when a key is created)
* Invoices and invoice lines, billing name, address and tax id, and payment methods
* Per-request model events (request ids, IP addresses, latency)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.