Example
Constructors
constructor
• new Client(config): Client
Creates a new X API client instance
Parameters
| Name | Type | Description | 
|---|---|---|
config | any | Configuration options for the client | 
Returns
Client
Example
Properties
Base URL for API requests
Bearer token for authentication
OAuth2 access token
OAuth1 instance for authentication
Headers for requests
Request timeout in milliseconds
Whether to automatically retry failed requests
Maximum number of retry attempts
User agent string
HTTP client for making requests
users client
community notes client
lists client
connections client
posts client
spaces client
media client
direct messages client
communities client
account activity client
webhooks client
trends client
activity client
stream client
usage client
compliance client
general client
Make an authenticated request to the X APIThis method handles authentication, request formatting, and error handling
for all API requests. It automatically adds the appropriate authentication
headers based on the client configuration.
Check if the OAuth2 token is expired
Refresh the OAuth2 token
Get the current authentication status
Map OpenAPI security scheme names to internal authentication types
Validate that the required authentication method is available
Get available authentication types