Get Community Members - API Reference
Returns array of users who are admins, moderators or regular members of a community. Typically Twitter returns ~20 results per page. You can request additional results by sending another request to the same endpoint using cursor
parameter.
GET https://api.socialdata.tools/twitter/community/{community_id}/members?cursor={cursor}
Headers
Authorization string required
Authorization Bearer header containing your SocialData API key
Example: Bearer YOUR_API_KEY
Path Parameters
community_id integer required
Target community ID
Example: 1493446837214187523
Query Parameters
cursor string optional
Cursor value obtained from next_cursor
response property. Used to retrieve additional pages for the same query
Example: DAACCgACGC12FhmAJxAKAAMYLXYWGX_Y8AgABAAAAAILAAUAAADoRW1QQzZ3QUFBZlEvZ0d...
Code Examples
curl "https://api.socialdata.tools/twitter/community/1493446837214187523/members" -H 'Authorization: Bearer API_KEY' -H 'Accept: application/json
const communityId = '1493446837214187523';const API_KEY = 'YOUR_API_KEY_HERE';
fetch(`https://api.socialdata.tools/twitter/community/${communityId}/members`, { method: 'GET', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Accept': 'application/json' }}).then(response => response.json()).then(response => console.log(response)).catch(err => console.error(err));
import requests
communityId = '1493446837214187523'API_KEY = 'YOUR_API_KEY_HERE'
url = f'https://api.socialdata.tools/twitter/community/{communityId}/members'
headers = { 'Authorization': f'Bearer {API_KEY}', 'Accept': 'application/json'}
response = requests.get(url, headers=headers)
if response.status_code == 200: data = response.json() print(data)else: print(f"Error: {response.status_code}") print(response.text)
$communityId = '1493446837214187523';$API_KEY = 'YOUR_API_KEY_HERE';
$url = "https://api.socialdata.tools/twitter/community/{$communityId}/members";
$ch = curl_init();
curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer $API_KEY", "Accept: application/json" ]]);
$response = curl_exec($ch);$data = json_decode($response, true);print_r($data);
curl_close($ch);
Example Responses
{ "next_cursor": "CycRAAAAAAwABAwKmwzBVQo+vQ0OGGp8lQABCm07AAABkNDNH5sADJorCj69f\/\/\/\/\/\/\/\/\/8KbTt\/\/\/\/\/\/\/\/\/\/wAIP8AAAAADAAAA", "users": [ { "id": 3119483308, "id_str": "3119483308", "screen_name": "onofregasent", "name": "Onofre", "protected": false, "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/1726870714131640320\/Hsxgtxw9_normal.jpg", "community_role": "Member" }, { "id": 338944755, "id_str": "338944755", "screen_name": "bohdanbasov", "name": "Bohdan Basov", "protected": false, "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/1803862687895388160\/2h7gpQ5U_normal.jpg", "community_role": "Moderator" }, ... ]}
{ "status": "error", "message": "Insufficient balance"}
{ "status": "error", "message": "User not found"}
{ "status": "error", "message": "Failed to fetch data from Twitter"}
Response Codes
- 200 OK - request succeeded
- 402 Payment Required - not enough credits to perform this request
- 404 Not Found - requested comminity does not exist
- 422 Unprocessable Content - validation failed (e.g. one of the required parameters was not provided)
- 500 Internal Error - API internal error, typically means that SocialData API failed to obtain the requested information and you should try again later