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