# Main Twitter GraphQL API Endpoints Used by Nitter: A Code-Level Analysis

> Discover the main Twitter GraphQL API endpoints Nitter uses. Analyze the Nim code in zedeus/nitter to understand how it fetches user profiles, timelines, tweets, and more.

- Repository: [Zed/nitter](https://github.com/zedeus/nitter)
- Tags: analysis
- Published: 2026-09-04

---

**Nitter constructs requests to Twitter’s private GraphQL API by prepending `graphql/` to endpoint names via logic in `src/apiutils.nim`, while feature flags defined in `src/consts.nim` activate specific queries for retrieving user profiles, timelines, tweets, followers, and Spaces data.**

The open-source Nitter project (`zedeus/nitter`) reverse-engineers Twitter’s internal API infrastructure to serve content without JavaScript tracking. To understand which main Twitter GraphQL API endpoints Nitter relies upon, you must examine the Nim source code that assembles these requests and the feature toggles that enable them.

## How Nitter Constructs GraphQL URLs

The routing logic that determines whether a request hits the GraphQL or legacy REST infrastructure resides in `src/apiutils.nim`. At line 58, the code inspects the endpoint string and prepends the GraphQL path prefix unless the request targets the older "1.1/" REST namespace.

```nim

# src/apiutils.nim (line 58)

let prefix = if url.endpoint.startsWith("1.1/"): "" else: "graphql/"

```

This conditional ensures that modern queries such as `UserByScreenName` or `TweetDetail` are automatically routed to `https://api.twitter.com/graphql/`, while legacy endpoints remain prefixed with `1.1/`.

## Feature Flags and Active GraphQL Endpoints

The specific GraphQL operations Nitter invokes are governed by boolean feature flags declared in `src/consts.nim` between lines 58 and 74. These flags signal to Twitter’s backend which query types the client supports.

Key flags include:

- **`responsive_web_graphql_timeline_navigation_enabled`** (line 58): Enables the **Timeline** endpoint for fetching user timelines.
- **`responsive_web_graphql_skip_user_profile_image_extensions_enabled`** (line 59): Controls access to user metadata via **UserByScreenName**.
- **`graphql_is_translatable_rweb_tweet_is_translatable_enabled`** (line 74): Activates **TweetDetail** queries that include translation data.

Based on these flags and the prefix logic, Nitter primarily utilizes the following main Twitter GraphQL API endpoints:

- **`graphql/UserByScreenName`**: Retrieves user profile information and metadata.
- **`graphql/TweetDetail`**: Fetches individual tweet content, engagement metrics, and translation status.
- **`graphql/Timeline`**: Powers the chronological or algorithmic user timeline navigation.
- **`graphql/Followers`** and **`graphql/Following`**: Access the social graph for account relationships.
- **`graphql/SpacesByCreators`**: Retrieves data for Twitter Spaces associated with specific accounts.

## Parsing GraphQL Responses

After receiving JSON payloads from these endpoints, Nitter processes the data through its parser layer. The `src/parser.nim` module references GraphQL processing at line 523, while experimental parsing logic in `src/experimental/parser/article.nim` (line 4) and `src/experimental/parser.nim` (lines 1-2) imports and utilizes the GraphQL-specific parsers to extract structured tweet and user data.

```nim

# src/experimental/parser.nim (lines 1-2)

import parser/[user, graphql, article]
export user, graphql, article

```

## Summary

- **Prefix Logic**: `src/apiutils.nim` at line 58 adds the `graphql/` prefix to endpoint names unless they start with `1.1/`, routing requests to Twitter’s GraphQL infrastructure.
- **Feature Activation**: `src/consts.nim` (lines 58-74) contains flags like `responsive_web_graphql_timeline_navigation_enabled` that enable specific query types.
- **Primary Endpoints**: Nitter uses `UserByScreenName`, `TweetDetail`, `Timeline`, `Followers`, `Following`, and `SpacesByCreators` as its main Twitter GraphQL API endpoints.
- **Data Processing**: Responses are parsed through `src/parser.nim` and experimental modules that import the GraphQL parser to handle the returned JSON structures.

## Frequently Asked Questions

### How does Nitter decide between GraphQL and REST API endpoints?

Nitter checks if the endpoint string begins with `1.1/` in `src/apiutils.nim` (line 58). If it does not match this legacy prefix, the code automatically prepends `graphql/`, directing the request to Twitter’s GraphQL infrastructure rather than the deprecated REST endpoints.

### What enables specific GraphQL queries like UserByScreenName in Nitter?

Boolean feature flags defined in `src/consts.nim` (lines 58-74) control which GraphQL operations are available. Flags such as `responsive_web_graphql_timeline_navigation_enabled` and `graphql_is_translatable_rweb_tweet_is_translatable_enabled` signal Twitter’s backend to process timeline and tweet detail queries for Nitter’s client session.

### Where does Nitter handle JSON responses from these GraphQL endpoints?

The application processes GraphQL JSON responses in `src/parser.nim` (referenced at line 523) and specialized experimental parsers including `src/experimental/parser/article.nim` (line 4) and `src/experimental/parser.nim` (lines 1-2), which import and execute the GraphQL parsing logic to extract usable tweet and user data.

### Are these GraphQL endpoints publicly documented by Twitter?

No, these are private, internal endpoints used by Twitter’s web and mobile applications. Nitter reverse-engineers access by maintaining the correct feature flags and URL construction patterns (as seen in `zedeus/nitter`) to interact with these undocumented GraphQL schemas.