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

# Connect your app to X (Twitter)

> Connect your app to X with an app-only Bearer token to look up users, search recent public posts, and build social integrations from your Lovable app.

export const connector_0 = "X (Twitter)"

[X](https://x.com/) is a social platform for public posts and conversations. The X (Twitter) connector lets your Lovable app call the [X API v2](https://docs.x.com/x-api/introduction) using an app-only Bearer token from your X Developer account. It's designed for apps that look up profiles, search recent public posts, or build read-only social dashboards.

With X, your app can:

* Look up users by username or ID
* Search recent public posts
* Read public post metadata by ID
* Build dashboards and integrations on top of X API v2 data

The connector uses an app-only Bearer token, so it supports read-only access to public data. It cannot post, like, follow, or send DMs on behalf of a user account. It's a good fit for profile lookups, keyword monitoring, and public content feeds.

## Common use cases and example apps

| Example app                      | Example prompt                                                                          | Description                                                                                                                                  |
| :------------------------------- | :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------- |
| **Profile lookup page**          | *Use X and build a page that shows profile info for an X username.*                     | **Display public profile details from X.**<br />The app fetches user metadata by username and renders name, handle, and other public fields. |
| **Keyword monitoring dashboard** | *Use X and build a dashboard that searches recent posts on X for a keyword.*            | **Track public conversation around a topic.**<br />The app queries recent post search results and presents them in a filterable feed.        |
| **Social proof widget**          | *Use X and build a widget that shows recent posts from a list of accounts.*             | **Surface curated public posts in your app.**<br />The app looks up posts by ID or username and renders a timeline-style view.               |
| **Influencer directory**         | *Use X and build a directory where I enter usernames and see follower counts and bios.* | **Aggregate public profile stats for a roster of accounts.**<br />The app batches user lookups and displays bios and metrics in a table.     |
| **Event hashtag tracker**        | *Use X and build a live feed of posts matching an event hashtag.*                       | **Monitor public posts for a campaign or event.**<br />The app searches recent posts for a hashtag and refreshes results on a schedule.      |
| **Competitive mentions board**   | *Use X and build a board that tracks recent posts mentioning our brand name.*           | **Watch brand mentions across public posts.**<br />The app runs scheduled searches and highlights new matches for the team.                  |
| **Research and reporting tool**  | *Use X and build an internal tool that exports recent posts about a topic as JSON.*     | **Pull public post data for analysis or reporting.**<br />The app searches and fetches post metadata through the gateway for downstream use. |

## How to connect X

Workspace **admins** and **owners** can connect X.

You can create multiple X connections using different Bearer tokens, which is useful for separating environments (for example, development and production) or using tokens from different X apps.

When the connection is created, X becomes available across all projects in the workspace. Anyone building in a project can ask Lovable in chat to link their project to it.

### Prerequisites

Before connecting X, make sure you have:

* An [X Developer account](https://developer.x.com/)
* An X app with an app-only Bearer token
* Lovable workspace **owner** or **admin** role

<Note>
  All API requests made through this connector count toward your X API access tier and rate limits. Billing and quota are handled directly by X, not Lovable.
</Note>

### Step 1: Get an X app-only Bearer token

An app-only Bearer token lets your Lovable app authenticate with the X API v2 for read-only public data. You generate it in the X Developer Portal for a specific app.

To create an X Bearer token:

<Steps>
  <Step title="Open the X Developer Portal">
    Sign in to the [X Developer Portal](https://developer.x.com/en/portal/dashboard).
  </Step>

  <Step title="Create or open a project and app">
    Create a **Project** and **App** if you do not have one yet, or open the app you want to use.
  </Step>

  <Step title="Open keys and tokens">
    In your app settings, go to **Keys and tokens** (or **User authentication settings** → **Keys and tokens**, depending on your portal layout).
  </Step>

  <Step title="Generate the Bearer token">
    Under **Authentication Tokens**, find **Bearer Token** and click **Generate** (or **Regenerate**). Copy the token and store it securely.
  </Step>
</Steps>

<Warning>
  Your Bearer token functions like a password. Keep it secure and never share it publicly. You'll need it in the next step.
</Warning>

See X documentation for details on access tiers, endpoints, and rate limits: [X API introduction](https://docs.x.com/x-api/introduction).

### Step 2: Connect X to Lovable

You can create multiple connections using different Bearer tokens.

<Steps>
  <Step title="Open X in Connectors">
    Go to **Connectors → App connectors** and select **X (Twitter)**.
  </Step>

  <Step title="Add a connection">
    Click **Add connection**.
  </Step>

  <Step title="Configure the connection">
    1. **Display name**: name the connection, for example `X Prod`. This name is only used inside Lovable to identify the connection.
    2. **Bearer token**: paste your app-only Bearer token from the X Developer Portal.
  </Step>

  <Step title="Choose who can access this connection">
    Under **Who can access this connection**, decide who in your workspace can use the connection:

    * **Only you** (default): only the person creating the connection can use it and its associated data.
    * **Invite specific people**: only you and explicitly added workspace members can use the connection and its associated data.
    * **Invite entire workspace**: click **Invite entire workspace** to make the connection available to everyone in your Lovable workspace.

    See [Connection-level access](/integrations/introduction#connection-level-access) for more information.
  </Step>

  <Step title="Connect">
    Click **Connect**. Lovable verifies the token against the X API before saving the connection.
  </Step>
</Steps>

When connected, anyone building in a project can ask Lovable in chat to link their project to X (based on configured connection-level access). Your Lovable apps can then look up users and search recent public posts through the connector.

## Limitations

The X connector is read-only with an app-only Bearer token. It cannot:

* Post, reply, like, repost, or follow on behalf of a user
* Send or read direct messages
* Access protected accounts or a user's private timeline
* Support per-end-user X login. Each connection uses a single shared Bearer token across all projects linked to it
* Bypass X API rate limits. Cache results, back off on `429` responses, and avoid tight polling loops

If you revoke or regenerate the Bearer token in the X Developer Portal, update the connection in Lovable with the new token before API calls can succeed again.

## How to unlink projects from a {connector_0} connection

Editors and above can remove specific projects from a connection without deleting the connection entirely. The connection will remain available for other projects.

To unlink projects:

<Steps>
  <Step title="Open Connectors">
    Open **Connectors**, then go to **App connectors**, and select **{connector_0}**.
  </Step>

  <Step title="Open the connection">
    Open the connection you want to manage.
  </Step>

  <Step title="Select projects">
    Under **Linked projects**, check the projects you want to unlink.
  </Step>

  <Step title="Confirm">
    Click **Unlink projects** and confirm.
  </Step>
</Steps>

When unlinked, those projects will no longer have access to {connector_0} through this connection. If a project needs {connector_0} again, you can link it to any available connection.

## How to delete a {connector_0} connection

Workspace admins and owners can delete {connector_0} connections. Other members can delete a connection if they created it, or if they have been explicitly granted access to it.

<Warning>
  Deleting a connection is permanent and cannot be undone. It will remove the credentials from all linked projects, and any apps using this connection will stop working until a new connection is added.
</Warning>

Before deleting, review the **Linked projects** section to see which projects are currently using the connection.

To delete a connection:

<Steps>
  <Step title="Open Connectors">
    Open **Connectors**, then go to **App connectors**, and select **{connector_0}**.
  </Step>

  <Step title="Open the connection">
    Open the connection you want to remove.
  </Step>

  <Step title="Review linked projects">
    Review the **Linked projects** section.
  </Step>

  <Step title="Delete">
    Under **Delete this connection**, click **Delete** and confirm.
  </Step>
</Steps>
