> For the complete documentation index, see [llms.txt](https://socialdata.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-thread.md).

# Retrieve thread

{% 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 an array of tweets associated with a thread and a next\_cursor value used to retrieve more pages (if the thread contains more than 30 posts)

### Endpoint

```url
GET https://api.socialdata.tools/twitter/thread/[id]?cursor=...
```

### Endpoint parameters

| Name                                     | Description                                               | Example                         |
| ---------------------------------------- | --------------------------------------------------------- | ------------------------------- |
| <p>id<br><strong>(Required)</strong></p> | The numerical ID of a thread's first tweet                | 1549281861687451648             |
| <p>cursor<br>(Optional)</p>              | Cursor value obtained from next\_cursor response property | PAAAAPAtPBwcFoCAsrHQ6pOAKxUC... |

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

* In languages where the `id` value exceeds the default Integer type limit (e.g., Node.js), store `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 %}

### Response codes

* **HTTP 200 OK -** succeeded
* **HTTP 402 Payment Required** - not enough credits to perform this request
* **HTTP 404 Not Found** - requested tweet 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/thread/1549281861687451648"
-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: 
{
	"tweets": [
		{
			"tweet_created_at": "2022-07-19T06:35:54+00:00",
			"id": 1549281861687451648,
			"id_str": "1549281861687451648",
			"text": null,
			"full_text": "100 tips I learned growing an iOS app to ~$5M in sales in 3 yrs, going through YC 1.5 times, and co-founding @Superwall 👇",
			"source": "<a href=\"https:\/\/getchirrapp.com\" rel=\"nofollow\">chirr.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": 15118774,
				"id_str": "15118774",
				"name": "Jake Mor",
				"screen_name": "jakemor",
				"location": "New York, USA",
				"url": "http:\/\/superwall.com",
				"description": "CEO @Superwall — build & test paywalls without shipping updates. Past: Founder @FitnessAI_ (acquired). YC W20 & S21",
				"protected": false,
				"verified": true,
				"followers_count": 5423,
				"friends_count": 556,
				"listed_count": 95,
				"favourites_count": 1161,
				"statuses_count": 1683,
				"created_at": "2008-06-14T18:37:41+00:00",
				"profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/15118774\/1636564314",
				"profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/1167559170540875777\/nRn7p8em_normal.jpg",
				"can_dm": true
			},
			"quoted_status_id": null,
			"quoted_status_id_str": null,
			"is_quote_status": false,
			"quoted_status": null,
			"retweeted_status": null,
			"quote_count": 73,
			"reply_count": 105,
			"retweet_count": 492,
			"favorite_count": 9419,
			"views_count": null,
			"bookmark_count": 4614,
			"lang": "en",
			"entities": {
				"user_mentions": [
					{
						"id_str": "1427520876325613571",
						"name": "Superwall",
						"screen_name": "Superwall",
						"indices": [
							109,
							119
						]
					}
				],
				"urls": [],
				"hashtags": [],
				"symbols": []
			},
			"is_pinned": false
		},
		...
	],
	"next_cursor": "PAAAAPAtPBwcFoCAsrHQ6pOAKxUCAAAYJmNvbnZlcnNhdGlvbnRocmVhZC0xNTQ5MjgxODYyNDYzNTA0Mzg0IgAA"
}

// If failed:
{
    "status":"error",
    "message":"Tweet not found"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-thread.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
