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

# X Integration: Posts, Timelines & DMs for AI Agents

> Agents can read and write posts, timelines, follows, likes, lists, and DMs on X. Connect with your own X developer app.

## Overview

OneCLI connects AI agents to [X](https://x.com) through OAuth. Agents can search and read posts, read timelines and mentions, and post, like, follow, or send DMs. The gateway injects the token into every request, so your agent never sees it.

X uses **your own X developer app**, on OneCLI Cloud and self-hosted alike. Setup takes about five minutes, once.

<a id="self-hosted" style={{ scrollMarginTop: "8rem" }} />

## Connect X

<Steps>
  <Step title="Create an X app">
    In the [X Developer Portal](https://developer.x.com/en/portal/dashboard), open **Projects & Apps** and create an app. Under **User authentication settings**, turn on OAuth 2.0, set the type to **Web App**, and set permissions to **Read and write and Direct message**.
  </Step>

  <Step title="Add the callback URL">
    In OneCLI, open **Connections** > **X** > **Custom credentials** and copy the **Redirect URI**. Paste it into the X app's **Callback URI / Redirect URL** and save.
  </Step>

  <Step title="Add your credentials and connect">
    Copy the app's OAuth 2.0 **Client ID** and **Client Secret** into **Custom credentials**, click **Save credentials**, then click **Connect X** and **Authorize app** on X.

    <Frame caption="The X connect window in OneCLI before credentials are added.">
      <img src="https://mintcdn.com/chartdbinc/yFw2bbdvTPdZgMOT/images/integrations/x/onecli-connect-x.png?fit=max&auto=format&n=yFw2bbdvTPdZgMOT&q=85&s=c08d5f08de4aea7998188f1271109db1" alt="OneCLI connect window for X showing Configuration required, the setup guide link, and the Configure credentials button." width="1056" height="1084" data-path="images/integrations/x/onecli-connect-x.png" />
    </Frame>
  </Step>
</Steps>

## What agents can do

| Area | What agents can do |
| - | - |
| **Read** | Look up users and posts, search posts, read timelines, mentions, followers, following, likes, bookmarks, lists, blocks, mutes, and DMs |
| **Write** | Post and delete posts, like, repost, follow, bookmark, block, mute, send DMs, upload media, create lists, and hide replies |

## Controlling access

[Grant](/docs/guides/agent-access) the connection to each agent that needs it, and choose per tool what runs freely, what needs approval, and what's blocked. Anything that posts publicly or messages people (**Create post**, **Send DM**, **Repost**, **Follow**) belongs behind approval. Organization [rules](/docs/guides/rules) add guardrails on top. A blocked request never reaches X.

To disconnect, remove the connection in **Connections** > **X**, then revoke OneCLI on X under **Settings** > **Security and account access** > **Apps and sessions**.


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