This integration uses the X API v2. You need a valid bearer token from the X Developer Portal to get started.
Prerequisites
Before setting up the X integration, you need:- A Nia API key — Get one at app.trynia.ai
- An X API bearer token — Create a project and app in the X Developer Portal to obtain a bearer token with read access
Getting Started
Get Your X API Bearer Token
Sign up at the X Developer Portal, create a project and app, and copy the bearer token from the “Keys and Tokens” section.
Create an Installation
Register the X account you want to index by providing the username and your bearer token via the Nia API.
Trigger Indexing
Start the indexing job. Nia fetches posts from the account, chunks and embeds them, and stores everything in the vector index.
Creating an Installation
Register an X account for indexing:Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Yes | The X/Twitter username (without the @) |
bearer_token | string | Yes | X API v2 bearer token |
display_name | string | No | A friendly label for this installation |
max_results | integer | No | Number of posts to fetch per indexing run (1—500, default 100) |
include_replies | boolean | No | Include reply tweets (default false) |
include_retweets | boolean | No | Include retweets (default false) |
The
max_results parameter controls how many of the most recent posts are fetched each time indexing runs. Set it higher to capture more history, or lower to focus on recent content.Managing Installations
List All X Installations
Get a Single Installation
Delete an Installation
Remove an installation and all its indexed data:Indexing
Trigger Indexing
Start an indexing job to fetch and index posts from the configured X account:Check Indexing Status
| Status | Meaning |
|---|---|
created | Installation created, not yet indexed |
processing | Indexing is in progress |
indexed | Indexing completed successfully |
failed | Indexing encountered an error |
Configuration Options
Control what gets indexed by adjusting the installation parameters at creation time.max_results
Fetch between 1 and 500 of the most recent posts per indexing run. Higher values capture more history but take longer.
include_replies
When enabled, reply tweets from the account are included in the index. Useful for capturing conversational context.
include_retweets
When enabled, retweets are included. Disable to focus only on original content from the account.
Searching Indexed Posts
Once indexed, posts from X accounts are searchable through Nia’s unified search endpoint:API Reference
| Method | Endpoint | Description |
|---|---|---|
GET | /v2/x/installations | List all X installations |
POST | /v2/x/installations | Create a new installation |
GET | /v2/x/installations/{id} | Get installation details |
DELETE | /v2/x/installations/{id} | Delete an installation |
POST | /v2/x/installations/{id}/index | Trigger indexing |
GET | /v2/x/installations/{id}/status | Get indexing status |
FAQ: How often should I re-index?
FAQ: How often should I re-index?
Re-index whenever you want to capture new posts. Since the integration fetches the most recent posts (up to
max_results), running indexing periodically keeps the content fresh. You can trigger it manually or build automation around the API.FAQ: Does this work with private/protected accounts?
FAQ: Does this work with private/protected accounts?
The X API v2 bearer token only provides access to public tweets. Protected accounts cannot be indexed unless you use an OAuth token with appropriate access, which is not currently supported by this integration.
FAQ: What X API plan do I need?
FAQ: What X API plan do I need?
A Basic or Pro plan on the X Developer Portal is sufficient. The Free tier has limited tweet read access and may not support the
max_results range needed. Check the X API documentation for current tier details.
