Retrieve large number of search results

Returns array of tweets provided by Twitter search page. Although Twitter returns ~20 search results per page, this endpoint will attempt to retrieve more results by sending additional requests until max_count is reached.

Endpoint

POST https://api.socialdata.tools/twitter/search/asyncJob

Endpoint parameters

Name
Description
Example

query (Required)

A UTF-8, URL-encoded search query , including any operators supported by Twitter website search.

from:elon_musk since_id:123 max_id:345

type (optional)

Search type (Latest for recent tweets or Top for popular tweets)

Default: Latest

Latest

since_id (optional)

Job will stop execution once this Tweet ID is reached

166251761328391335

max_id (optional)

Tweet ID to start scraping from. This will be appended to your search query as max_id:[ID]

176251765328391335

max_count (optional)

Maximum number of tweets to be returned. Use this to control your costs Default: 20

100

compress (optional)

Indicates whether dataset should be compressed to zip before uploading to S3

Default: false

false

output_format (optional)

Preferred output file format. Supported values: csv, json, xlsx. Json recommended due to more detailed output Default: json

json

Response codes

  • HTTP 200 OK - succeeded

  • HTTP 402 Payment Required - not enough credits to perform this request

  • HTTP 422 Unprocessable Content - validation failed (e.g. one of the required parameters was not provided)

  • HTTP 500 Internal Server Error - other error (highly unlikely)

Example response

// If succeeded: 
{
    "status": "success",
    "job_id": 42
}

Example job status response

Once a job is processed, the following response will be provided by GET /jobs/[job_id] endpoint or by webhook event:

{
    "job_id": 42
    "status": "success",
    "result": {
        "is_compressed": false,
        "datafile_url": "https://s3.amazonaws.com/..."
    }
}

Last updated