POST /2/lists/:id/members

POST /2/lists/:id/members

Enables the authenticated user to add a member to a List they own.

Endpoint URL

https://api.twitter.com/2/lists/:id/members

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 2.0 Authorization Code with PKCE

OAuth 1.0a is also available for this endpoint.

Rate limit

User rate limit (User context): 300 requests per 15-minute window per each authenticated user

OAuth 2.0 scopes required by this endpoint

tweet.read

users.read

list.write

Learn more about OAuth 2.0 Authorization Code with PKCE

Path parameters

NameTypeDescription
id
 Required 
stringThe ID of the List you are adding a member to.


JSON body parameters

NameTypeDescription
user_id
 Required 
stringThe ID of the user you wish to add as a member of the List.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  try {
    const addMember = await twitterClient.lists.listAddMember(
      //The ID of the user to be added as a member of the List
      2244994945,

      //The ID of the List to add a member
      1441162269824405510
    );
    console.dir(addMember, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      // Set the params values

// String | The ID of the user to be added as a member of the List
String usersId = "2244994945"
ListAddMemberRequest listAddMemberRequest = new ListAddMemberRequest();
listAddMemberRequest.userId(usersId);

// String | The ID of the List to add a member
String id = "1441162269824405510";

try {
    ListMemberResponse result = apiInstance.lists().listAddMember(listAddMemberRequest, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ListsApi#listAddMember");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());
    e.printStackTrace();
}

    

Example responses

Successful response
      {
  "data": {
    "is_member": true
  }
}
    

Response fields

NameTypeDescription
is_memberbooleanIndicates whether the member specified in the request has been added to the List.