Docs
Relationships with many accounts

Relationships with many accounts

Whether one account follows up to 50 others, and the other way round, in one request.

GET/user/friendships/batch

Parameters

  • source_screen_namequery · string · required

    The account to compare with the others, with or without @.

  • target_screen_namesquery · string (comma-separated) · required

    Handles separated by commas, with or without @. At most 50. Duplicates are dropped.

Notes

  • Billed one call per target handle (duplicates count once).
  • No simple format: with format=simple the response is the same as without it.

Example request

curl 'https://api.twittrapi.com/user/friendships/batch?source_screen_name=jack&target_screen_names=XDevelopers,TwitterDev' \
  --header 'X-API-KEY: YOUR_API_KEY'

Base URL https://api.twittrapi.com, key in the X-API-KEY header. Python and Node.js use the official SDKs.

Response

Built by the API: {"source_screen_name": "...", "relationships": [{"target_screen_name": "...", "relationship": {...}}], "errors": [...]}. relationship is the same object /user/friendships/show returns (source and target with following and followed_by). relationships keeps the order of target_screen_names. A handle that could not be looked up is listed in errors: [{"username": "...", "error": "upstream_error", "message": "..."}]; errors is left out when there are none.

Example response coming soon.

In the raw format, field names and nesting come from X and can change without notice. See Response format.

Errors

  • 400source_screen_name or target_screen_names is missing, or there are more than 50 targets.
  • 422A handle is not 1 to 15 letters, digits or underscores.

Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 407, 408, 409 or a 5xx error are refunded.