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
HTTP client for making requests
general client
account activity client
community notes client
compliance client
connections client
users client
news client
spaces client
activity client
usage client
trends client
posts client
direct messages client
communities client
media client
webhooks client
stream client
lists 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