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

# API Reference

> Client and method reference for the Ruby XDK (xdk v0.1.0).

Client setup and method reference for `xdk` `v0.1.0`.

> [card] [RubyGems](https://rubygems.org/gems/xdk)
>
> `xdk` `v0.1.0` · Ruby 3.0+

> [card] [GitHub](https://github.com/xdevplatform/xdk-ruby)
>
> Source code and issues.

## Installation

```bash theme={null}
gem install xdk
```

## `Xdk::Client` Initialization

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(bearer_token: ENV.fetch("X_BEARER_TOKEN"))
```

**bearer\_token** `String, nil`

App-only OAuth 2.0 Bearer Token for public read and search endpoints.

**access\_token** `String, nil`

OAuth 2.0 user-context access token for endpoints acting on behalf of a user.

**auth** `Xdk::OAuth1, nil`

Configured `Xdk::OAuth1` instance for OAuth 1.0a HMAC-SHA1 user-context signing.

**base\_url** `String` (default: [https://api.x.com](https://api.x.com))

Base URL for X API requests.

**timeout** `Numeric, nil`

Per-request HTTP timeout in seconds.

**max\_retries** `Integer` (default: 0)

Maximum retry attempts for transient 429 or 5xx failures.

## Clients

| Resource | Accessor | Client Class | Operations |
| :- | :- | :- | -: |
| [Account](https://docs.x.com/xdks/ruby/reference/clients/account.md) | `client.account` | `AccountClient` | 2 |
| [Account Activity](https://docs.x.com/xdks/ruby/reference/clients/account-activity.md) | `client.account_activity` | `AccountActivityClient` | 5 |
| [Activity](https://docs.x.com/xdks/ruby/reference/clients/activity.md) | `client.activity` | `ActivityClient` | 5 |
| [Articles](https://docs.x.com/xdks/ruby/reference/clients/articles.md) | `client.articles` | `ArticlesClient` | 2 |
| [Bots](https://docs.x.com/xdks/ruby/reference/clients/bots.md) | `client.bots` | `BotsClient` | 6 |
| [Broadcasts](https://docs.x.com/xdks/ruby/reference/clients/broadcasts.md) | `client.broadcasts` | `BroadcastsClient` | 41 |
| [Calls](https://docs.x.com/xdks/ruby/reference/clients/calls.md) | `client.calls` | `CallsClient` | 10 |
| [Chat](https://docs.x.com/xdks/ruby/reference/clients/chat.md) | `client.chat` | `ChatClient` | 47 |
| [Communities](https://docs.x.com/xdks/ruby/reference/clients/communities.md) | `client.communities` | `CommunitiesClient` | 2 |
| [Community Notes](https://docs.x.com/xdks/ruby/reference/clients/community-notes.md) | `client.community_notes` | `CommunityNotesClient` | 5 |
| [Compliance](https://docs.x.com/xdks/ruby/reference/clients/compliance.md) | `client.compliance` | `ComplianceClient` | 6 |
| [Connections](https://docs.x.com/xdks/ruby/reference/clients/connections.md) | `client.connections` | `ConnectionsClient` | 4 |
| [Direct Messages](https://docs.x.com/xdks/ruby/reference/clients/direct-messages.md) | `client.direct_messages` | `DirectMessagesClient` | 9 |
| [General](https://docs.x.com/xdks/ruby/reference/clients/general.md) | `client.general` | `GeneralClient` | 1 |
| [Lists](https://docs.x.com/xdks/ruby/reference/clients/lists.md) | `client.lists` | `ListsClient` | 9 |
| [Media](https://docs.x.com/xdks/ruby/reference/clients/media.md) | `client.media` | `MediaClient` | 19 |
| [News](https://docs.x.com/xdks/ruby/reference/clients/news.md) | `client.news` | `NewsClient` | 2 |
| [Posts](https://docs.x.com/xdks/ruby/reference/clients/posts.md) | `client.posts` | `PostsClient` | 17 |
| [Spaces](https://docs.x.com/xdks/ruby/reference/clients/spaces.md) | `client.spaces` | `SpacesClient` | 6 |
| [Stream](https://docs.x.com/xdks/ruby/reference/clients/stream.md) | `client.stream` | `StreamClient` | 18 |
| [Trends](https://docs.x.com/xdks/ruby/reference/clients/trends.md) | `client.trends` | `TrendsClient` | 3 |
| [Usage](https://docs.x.com/xdks/ruby/reference/clients/usage.md) | `client.usage` | `UsageClient` | 2 |
| [Users](https://docs.x.com/xdks/ruby/reference/clients/users.md) | `client.users` | `UsersClient` | 46 |
| [Webhooks](https://docs.x.com/xdks/ruby/reference/clients/webhooks.md) | `client.webhooks` | `WebhooksClient` | 8 |
