POST /2/users/:id/pinned_lists

POST /2/users/:id/pinned_lists

Enables the authenticated user to pin a List.

Endpoint URL

https://api.x.com/2/users/:id/pinned_lists

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 1.0a is also available for this endpoint.

OAuth 2.0 Authorization Code with PKCE

Rate limit

User rate limit (User context): 50 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 user ID who you are pinning a List on behalf of. It must match your own user ID or that of an authenticating user, meaning that you must pass the Access Tokens associated with the user ID when authenticating your request.


JSON body parameters

NameTypeDescription
list_id
 Required 
stringThe ID of the List that you would like the user id to pin.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  try {
    const pinList = await twitterClient.lists.listUserPin(
      //The ID of the authenticated source user that will pin the List
      2244994945,
      
      //The ID of the List to be pinned
      1441162269824405510
    );
    console.dir(pinList, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      // Set the params values

// String | The ID of the List to be pinned
String listsId = "1441162269824405510";
ListPinRequest listPinRequest = new ListPinRequest();
listPinRequest.listId(listsId);

// String | The ID of the authenticated source user that will pin the List
String id = "2244994945"; 

try {
    ListPinnedResponse result = apiInstance.lists().listUserPin(listPinRequest, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ListsApi#listUserPin");
    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": {
    "pinned": true
  }
}
    

Response fields

NameTypeDescription
pinnedbooleanIndicates whether the user pinned the specified List as a result of the request.