---
title: "X get user by ID API: GET /2/users/{id}"
description: "When PubNio calls X's get user by ID request, GET /2/users/{id}: the scopes it needs, the errors PubNio handles for it, and its pinned spec revision."
---

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

# X get user by ID API: GET /2/users/{id}

PubNio calls X's `GET /2/users/{id}` (`getUsersById`) to read an X account's follower count.

## How PubNio calls it

- Account analytics: the account sync makes this call; [`GET /api/v1/workspaces/{workspaceId}/analytics/accounts/{accountId}`](https://pubnio.com/api/v1/docs#tag/analytics/GET/api/v1/workspaces/{workspaceId}/analytics/accounts/{accountId}) returns what it stored.
- PubNio asks for `user.fields=public_metrics` and stores `followers_count` as the account's follower total on the day it reads it.
- Every account read starts here, before any post totals are paged in. If this request fails, the whole account read fails and nothing is stored for that run.

## Scopes

- The pinned spec lists 2 scopes, all required: `users.read` and `tweet.read`.
- PubNio's X sign-in requests every one of them.
- Before the account analytics sync makes this call, PubNio checks that the account granted `tweet.read` and `users.read`.

## Errors

PubNio has no X error code pages yet. [Provider error codes](https://pubnio.com/docs/errors/providers/) covers the providers that have them.

## Spec and changes

`getUsersById` in the pinned spec, revision `2.175`.

Checked weekly; no change to `GET /2/users/{id}` recorded since this revision. [Change tracker](https://pubnio.com/docs/changes/).

## Limits

- PubNio reads only the connected account; it does not look up other users.

## Sources

- [X API v2 OpenAPI document](https://api.x.com/2/openapi.json)

## Related

- [Provider API operations PubNio calls](https://pubnio.com/docs/providers/operations/)
- [X rate limits and quota](https://pubnio.com/docs/providers/x/quota/)

Source: https://pubnio.com/docs/providers/x/operations/get-users-by-id/index.mdx
