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

# X (Twitter) API TypeScript types for accounts & keys

> Copy TypeScript types for Xquik accounts, API keys, connected X accounts, support tickets, and API error responses. Use them to type each call in your own code.

> For the complete documentation index, see [llms.txt](https://docs.xquik.com/llms.txt).

These types belong to the [X API TypeScript types](https://docs.xquik.com/guides/x-api-typescript-types.md) set. Copy them into your `xquik-types.ts` file.

## Types

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
// ─── Account ─────────────────────────────────────────────

interface Account {
  plan: "active" | "inactive";
  monitorsAllowed: number;
  monitorsUsed: number;
  creditInfo?: {
    balance: number;
    lifetimePurchased: number;
    lifetimeUsed: number;
    autoTopupEnabled: boolean;
  };
  xUsername?: string;
}

// ─── API Keys ────────────────────────────────────────────

// Returned when creating a new key (includes full key)
interface ApiKeyCreated {
  id: string;
  fullKey: string;
  prefix: string;
  name: string;
  createdAt: string;
}

// Returned when listing keys (full key is never exposed)
interface ApiKey {
  id: string;
  name: string;
  prefix: string;
  isActive: boolean;
  createdAt: string;
  lastUsedAt?: string;
}

// ─── X Accounts ───────────────────────────────────────────

interface XAccount {
  id: string;
  username: string;
  displayName: string;
  isActive: boolean;
  createdAt: string;
}

// ─── Support Tickets ──────────────────────────────────────

interface SupportTicket {
  publicId: string;
  subject: string;
  status: "open" | "in_progress" | "resolved" | "closed";
  messageCount: number;
  createdAt: string;
  updatedAt: string;
}

interface SupportTicketDetail {
  publicId: string;
  subject: string;
  status: "open" | "in_progress" | "resolved" | "closed";
  createdAt: string;
  updatedAt: string;
  messages: SupportMessage[];
}

interface SupportMessage {
  body: string;
  sender: "user" | "support";
  createdAt: string;
}

// ─── Error Response ──────────────────────────────────────

type ApiErrorType =
  | "api_error"
  | "authentication_error"
  | "billing_error"
  | "dependency_error"
  | "invalid_request_error"
  | "permission_error"
  | "rate_limit_error";

interface StructuredApiError {
  message: string;
  type: ApiErrorType;
  code: string;
}

interface ApiError {
  error: string | StructuredApiError;
  message?: string;
  reason?: string;
  retryAfter?: number;
  retryAfterMs?: number;
}
```

## Next steps

* [X API TypeScript types](https://docs.xquik.com/guides/x-api-typescript-types.md)
* [Shared types](https://docs.xquik.com/guides/x-api-typescript-shared-types.md)


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