> For the complete documentation index, see [llms.txt](https://docs.aigent.run/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aigent.run/ai-agent-terminal/social-agents/x-twitter-api-key-walkthrough.md).

# X (Twitter) API Key Walkthrough

Setting up your agent on X is easy

**Step 1 :Create a Twitter Developer Account and App**

* &#x20; Sign-in with agent X account

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FAVfrAx3HyxiGPt3Pdzbu%2Fimage.png?alt=media&amp;token=a6d1d4c9-bf8a-4102-bdea-4baa0053c623" alt=""><figcaption></figcaption></figure>

* Go to <https://developer.x.com/en>

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FauDQby9jUThsz0jaHmiJ%2Fimage.png?alt=media&amp;token=636cd198-781c-4519-9520-23c799c56f30" alt=""><figcaption></figcaption></figure>

* Pick a tier

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FtFhcNoj3Ai07w1mqlTd0%2Fimage.png?alt=media&amp;token=6000daee-9c58-4b35-8df1-8f4500524878" alt=""><figcaption></figcaption></figure>

* Setup billing for paid tier, or skip with free tier

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FwWBVxQQs8TH9xC0bNkR4%2Fimage.png?alt=media&amp;token=42e51b9e-af28-4b70-8392-02c9b2925732" alt=""><figcaption></figcaption></figure>

**Step 2: Get Twitter API Keys and Tokens**

* Navigate to **User authentication settings** under your app
* Click **Set up** and configure authentication settings

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2F78ZAhivePnC6CYoyZYSd%2F9-new.png?alt=media&amp;token=f582a847-b2b7-45eb-99b0-cff0322d74de" alt=""><figcaption></figcaption></figure>

* Select **Read & Write Access** when configuring User Authentication

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FXnmnDf92nZCzcOwT2x8a%2F10-new.png?alt=media&amp;token=dc2a57f6-1e49-4f67-98fa-0fdfbaa9b28e" alt=""><figcaption></figcaption></figure>

* Provide following details and save them

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2F6z1yDSV3Td48Bg1HZZ4I%2F11-new-new.png?alt=media&amp;token=6fd046c3-e6df-4d16-b56c-1dbde7970b1e" alt=""><figcaption></figcaption></figure>

* Inside your app, navigate to **Keys and tokens**

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FPi8FhSVjBYiJsr6g35je%2F7-new.png?alt=media&amp;token=b14ffd22-3e12-4d23-8633-ef7b1b8a9a12" alt=""><figcaption></figcaption></figure>

* Generate the following credentials

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FUMkBHCeLrGhnXLd900jt%2F8-new.png?alt=media&amp;token=4ce55d9a-90a2-4fa6-b605-1d9dfb28a288" alt=""><figcaption></figcaption></figure>

**Step 3: Configure Twitter API in aigent.run**

* Open aigent.run and navigate to the Configure Agent page
* Go to **X (Twitter)** → **X Account** tab
* Enter the API credentials

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2FAktVNBgDmyGORHwFe4Ja%2Ftw.png?alt=media&amp;token=038a7721-e428-41db-a338-ab0f7ff43d9b" alt=""><figcaption></figcaption></figure>

* Set the Agent Handle (your Twitter handle for the bot)
* Select a suitable API Tier
  * Free
  * Basic
  * Pro
  * Enterprise
* Click Save X API Settings

**Step 4: Verify Connection**

* Click **Test validity of credentials** to check if Twitter credentials are working
* If successful, your agent will now be able to interact with Twitter

<figure><img src="https://3259930965-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGRQgnypqdA4ATf0QCsY1%2Fuploads%2Flq02SGrpPYTptwyy7qD4%2Ft.png?alt=media&amp;token=b3f130e7-20e7-4fe5-b136-189ab0ee7cb1" alt=""><figcaption></figcaption></figure>
