# Retrieve user's highlighted tweets

{% hint style="danger" %} <mark style="color:red;">**WARNING:**</mark>&#x20;

**You are viewing an outdated version of our documentation.** \
**For the latest and most accurate information, please visit** [**docs.socialdata.tools**](https://docs.socialdata.tools)**.**
{% endhint %}

Returns array of tweets from the user's Highlights tab. Typically Twitter returns \~20 results per page. You can request additional  results by sending another request to the same endpoint using cursor parameter.

### Endpoint

```url
GET https://api.socialdata.tools/twitter/user/[user_id]/highlights
```

### Endpoint parameters

| Name                                           | Description                                                                                                           | Example                                                                     |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| <p>user\_id<br><strong>(Required)</strong></p> | The ID of the user for whom to return results.                                                                        | 783214                                                                      |
| <p>cursor<br>(Optional)</p>                    | <p>Cursor value obtained from next\_cursor response property</p><p><br>Omit this value to retrieve the first page</p> | DAACCgACGC12FhmAJxAKAAMYLXYWGX\_Y8AgABAAAAAILAAUAAADoRW1QQzZ3QUFBZlEvZ0d... |

{% hint style="warning" %} <mark style="color:orange;">**Common Issues and Best Practices**</mark>

* In languages where the `user_id` value exceeds the default Integer type limit (e.g., Node.js), store `user_id` as a string. Use the `id_str` property returned by the API for these values
* Always URL-encode the `cursor` value when passing it back to the API for subsequent requests
  {% endhint %}

### Endpoint codes

* **HTTP 200 OK -** succeeded
* **HTTP 402 Payment Required** - not enough credits to perform this request
* **HTTP 403 Forbidden** - user's profile is set to "protected"
* **HTTP 404 Not Found** - requested user does not exist
* **HTTP 422 Unprocessable Content** - validation failed (e.g. one of the required parameters was not provided)
* **HTTP 500** **Internal Server Error** - other error, typically means that SocialData API failed to obtain the requested information and you should try again later

### Rate limits

By default each user has a limit of 120 requests per minute shared across all endpoints. Please reach out to <support@socialdata.tools> if you need to raise your rate limit.

### Example request

```bash
curl "https://api.socialdata.tools/twitter/user/783214/highlights"
-H 'Authorization: Bearer API_KEY'
-H 'Accept: application/json'
```

[![Run In Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/36444222-9d3f261a-6fc3-44cd-90eb-f0d191d6d1a8?action=collection%2Ffork\&source=rip_markdown\&collection-url=entityId%3D36444222-9d3f261a-6fc3-44cd-90eb-f0d191d6d1a8%26entityType%3Dcollection%26workspaceId%3D22407140-425b-41ff-969e-1fb938fe8e86)

### Example response

```json
// If succeeded: 
{
    "next_cursor": "DAACCgACGC12FhmAJxAKAAMYLXYWGX_Y8AgABAAAAAILAAUAAADoRW1QQzZ3QUFBZlEvZ0dKTjB2R3AvQUFBQUJNWUxTNkQyQmFoUXhndFRReS9Ga0NOR0MwZG9yS1hzU2NZTFFwYm0xY1I0aGd0YmhZc1drQ3FHQzBjUXNSV1lSZ1lMVml5V3BxQU9CZ3RMbUhUV2tDb0dDMVFuVW1YMEFzWUxKYURhOVpob3hndFZtaklGakNNR0MxWGdlT1dZSE1ZTFRYNFNwZUEraGd0Y2h2bEYxRkxHQzFNMi83V1VGc1lMTTZwemhZQWt4Z3RWMkJKbDNGN0dDMWFGTXBYUUY4WUxUUERuRlp3UVE9PQgABgAAAAAIAAcAAAAADAAICgABGCyWg2vWYaMAAAA",
    "tweets": [
        {
		"tweet_created_at": "2024-05-15T22:33:29.000000Z",
		"id": 1790873164374810919,
		"id_str": "1790873164374810919",
		"text": null,
		"full_text": "https:\/\/t.co\/mS960WQX4Y",
		"source": "<a href=\"https:\/\/mobile.twitter.com\" rel=\"nofollow\">Twitter Web App<\/a>",
		"truncated": false,
		"in_reply_to_status_id": null,
		"in_reply_to_status_id_str": null,
		"in_reply_to_user_id": null,
		"in_reply_to_user_id_str": null,
		"in_reply_to_screen_name": null,
		"user": {
			"id": 783214,
			"id_str": "783214",
			"name": "X",
			"screen_name": "X",
			"location": "everywhere",
			"url": "https:\/\/about.x.com\/",
			"description": "what's happening?!",
			"protected": false,
			"verified": true,
			"followers_count": 67739714,
			"friends_count": 0,
			"listed_count": 88755,
			"favourites_count": 5892,
			"statuses_count": 15327,
			"created_at": "2007-02-20T14:35:54.000000Z",
			"profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/783214\/1690175171",
			"profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/1683899100922511378\/5lY42eHs_normal.jpg",
			"can_dm": false
		}
	},
	...
    ]
]

// If failed:
{
    "status":"error",
    "message":"Failed to fetch data from Twitter"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://socialdata.gitbook.io/docs/twitter-users/retrieve-users-highlighted-tweets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
