Skip to content

Twitter Search Timeline API (V1) ​

GET
API health status
Healthy Available Limited Mostly unavailable No data
Loading health status...

Searches X (Twitter) by keyword across top, latest, media, people, or list result modes with cursor pagination. Use it to find public conversations, accounts, media, or lists related to a topic.

Parameters ​

NameInTypeRequiredDefaultDescription
tokenquerystringYes-Authentication token required for API access.
keywordquerystringYes-Search keyword.
searchTypequerystringNoTopSearch result type.


Available Values:

- TOP: Top search results

- LATEST: Latest search results

- MEDIA: Media search results

- PEOPLE: People search results

- LISTS: List search results
cursorquerystringNoPagination cursor returned by the previous response.

Code Samples ​

bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE'
text
I want to use the "Search Timeline (V1)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE
API Endpoint: BASE_URL + /api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE
HTTP Method: GET
Authentication: Append the "token" query parameter to the URL.
OpenAPI Definition: https://docs.justoneapi.com/openapi/twitter/search-timeline-v1-en.json

Parameters:
- token (query): Authentication token required for API access. (Required)
- keyword (query): Search keyword. (Required)
- searchType (query): Search result type.

Available Values:
- `TOP`: Top search results
- `LATEST`: Latest search results
- `MEDIA`: Media search results
- `PEOPLE`: People search results
- `LISTS`: List search results
- cursor (query): Pagination cursor returned by the previous response.

Return format: safely handle JSON or text according to the actual Content-Type.

Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set the request timeout to 120 seconds. If 120 seconds is too long for your use case, use at least 60 seconds, but a small number of requests may time out before receiving a result.
3. Business Code Reference:
   - 0: Success
   - 100: Invalid or Inactive Token
   - 301: Collection Failed. Please Retry.
   - 302: Rate Limit Exceeded
   - 303: Daily Quota Exceeded
   - 400: Invalid Parameters
   - 500: Internal Server Error
   - 600: Permission Denied
   - 601: Insufficient Balance
   - 602: Token Budget Exceeded
4. Code 601 means the shared account balance is insufficient. Code 602 means the current API token's own cumulative budget limit has been reached. Token budget limits do not transfer funds out of the shared account balance.

Please help me write a script in my preferred programming language to call this API and handle the response.
python
import requests

BASE_URL = "https://api.justoneapi.com"  # Provided by OpenAPI servers

url = BASE_URL + "/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
    content_type = response.headers.get("content-type", "").lower()
    if "json" in content_type:
        try:
            print(response.json())
        except ValueError:
            print(response.text)
    elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
        print(response.text)
    else:
        with open("response.bin", "wb") as output:
            output.write(response.content)
        print(f"Saved {len(response.content)} bytes to response.bin")
js
const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE";

const response = await fetch(url, {
  method: "GET",
  signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
  const mediaType = contentType.split(";", 1)[0].trim();
  const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
  if (textual) {
    const responseText = new TextDecoder().decode(responseBytes);
    let data = responseText;
    if (contentType.includes("json")) {
      try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
    }
    console.log(data);
  } else {
    console.log(`Received ${responseBytes.byteLength} binary bytes`);
  }
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static void main(String[] args) throws Exception {
        final String BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
        final String url = BASE_URL + "/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE";

        HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
        HttpRequest.Builder builder = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .timeout(Duration.ofSeconds(120))
            .method("GET", HttpRequest.BodyPublishers.noBody());

        HttpRequest request = builder.build();

        HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
        System.out.println(response.statusCode());
        String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
        String mediaType = contentType.split(";", 2)[0].trim();
        if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
            System.out.println(new String(response.body(), StandardCharsets.UTF_8));
        } else {
            Files.write(Path.of("response.bin"), response.body());
            System.out.println("Saved " + response.body().length + " bytes to response.bin");
        }
    }
}
go
package main

import (
	"fmt"
	"io"
	"os"
	"strings"
	"net/http"
	"time"
)

const BASE_URL = "https://api.justoneapi.com" // Provided by OpenAPI servers

func main() {
	client := &http.Client{Timeout: 120 * time.Second}
	url := BASE_URL + "/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	fmt.Println(resp.StatusCode)
	bodyBytes, _ := io.ReadAll(resp.Body)
	contentType := strings.ToLower(resp.Header.Get("Content-Type"))
	mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
	if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
		fmt.Println(string(bodyBytes))
	} else {
		os.WriteFile("response.bin", bodyBytes, 0600)
		fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
	}
}
php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/twitter/search/v1?token=YOUR_API_KEY&keyword=VALUE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
    echo $response;
} else {
    file_put_contents('response.bin', $response);
    echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}

Response Fields ​

Key fields in a successful response (code = 0).

Search results and pagination5 fields

data

One page of X search results with pagination cursors.

FieldTypeDescription
statusstringStatus text reported for the search response.
next_cursorstringOpaque cursor for requesting the next page. Pass it unchanged as cursor with the same keyword and searchType. A cursor can be present on an empty page.
prev_cursorstringOpaque cursor supplied for the preceding page. A cursor can be present on an empty page.
timelinearrayEntries returned for this search page. Read each entry's type to identify what it contains. PEOPLE and LISTS searches can also return posts, and a search can return an empty array.
timeline[]objectOne entry in the search results.
Entry and post content17 fields

data.timeline[]

FieldTypeDescription
typestringEntry type label returned in the search results.
screen_namestringPublic X username attached to the search result.
sourcestring | nullPosting client or source label as returned by X, when available.
display_text_rangearrayOffsets for the visible portion of the post text, in the original X format.
display_text_range[]integerOne offset in the post's display text range.
placeobjectPlace label attached to the post, when available.
place.namestringPlace name reported by X.
place.full_namestringFull display name of the place.
place.countrystringCountry name supplied for the place.
place.country_codestringCountry code supplied for the place.
place.place_typestringType label associated with the place.
tweet_idstringX post ID represented as text.
conversation_idstring | nullID of the post's conversation, represented as text when supplied.
created_atstringPost publication time in X's original timestamp format.
textstringPost text returned by X.
langstringLanguage code supplied for the post.
sensitiveboolean | nullSensitive-content flag when supplied.
Engagement6 fields

data.timeline[]

FieldTypeDescription
viewsstring | nullReported view count as numeric text when available.
favoritesintegerLike count reported for the post.
bookmarksintegerBookmark count reported for the post.
repliesintegerReply count reported for the post.
retweetsintegerRepost count reported for the post.
quotesintegerQuote count reported for the post.
Account profile10 fields

data.timeline[].user_info

Profile information for the user shown on the search result.

FieldTypeDescription
rest_idstringX account ID represented as text.
screen_namestringPublic X username of the account.
namestringDisplay name of the account.
created_atstringAccount creation time in X's original timestamp format.
avatarstringAddress of the account's avatar image.
verifiedbooleanVerification flag reported for the account.
verified_typestring | nullVerification category reported for the account, when available.
followers_countintegerFollower count reported for the account.
favorites_countintegerNumber of posts liked by the account, as reported by X.
locationstring | nullPublic profile location text, when provided.
Hashtags, mentions, and links24 fields

data.timeline[].entities

References attached to the post text and media, such as hashtags, mentions, and URLs.

FieldTypeDescription
hashtagsarrayHashtags referenced in the post text.
hashtags[]objectOne hashtag reference in the post text.
hashtags[].textstringHashtag text supplied for the reference.
hashtags[].indicesarrayText offsets associated with this entity, in the original X format.
hashtags[].indices[]integerOne text offset associated with the entity.
symbolsarrayCashtag symbols referenced in the post text.
symbols[]objectOne cashtag reference in the post text.
symbols[].textstringText of the cashtag reference.
symbols[].indicesarrayText offsets associated with this entity, in the original X format.
symbols[].indices[]integerOne text offset associated with the entity.
user_mentionsarrayAccount mentions referenced in the post text.
user_mentions[]objectOne account mention in the post text.
user_mentions[].id_strstringMentioned X account ID represented as text.
user_mentions[].namestringDisplay name of the mentioned account.
user_mentions[].screen_namestringPublic X username of the mentioned account.
user_mentions[].indicesarrayText offsets associated with this entity, in the original X format.
user_mentions[].indices[]integerOne text offset associated with the entity.
urlsarrayLinks referenced by the post.
urls[]objectOne link referenced by the post.
urls[].urlstringURL present in the post entity.
urls[].expanded_urlstringExpanded address for the link when supplied.
urls[].display_urlstringDisplay text for the link.
urls[].indicesarrayText offsets associated with this entity, in the original X format.
urls[].indices[]integerOne text offset associated with the entity.
Photos and videos22 fields

data.timeline[].media

Media attached to the post. It can be an object with media lists or an empty array.

FieldTypeDescription
photoarrayPhoto attachments for the post.
photo[]objectOne photo attachment on the post.
photo[].idstringPhoto ID represented as text.
photo[].media_url_httpsstringHTTPS address supplied for the photo.
photo[].sizesobjectDimensions reported for the photo.
photo[].sizes.wintegerPhoto width in pixels.
photo[].sizes.hintegerPhoto height in pixels.
videoarrayVideo attachments for the post.
video[]objectOne video attachment on the post.
video[].idstringVideo ID represented as text.
video[].media_url_httpsstringHTTPS preview image address supplied for the video.
video[].durationinteger | nullVideo duration in milliseconds when available.
video[].aspect_ratioarrayAspect ratio reported as width and height proportions.
video[].aspect_ratio[]integerOne value in the width and height ratio.
video[].original_infoobjectOriginal video dimensions reported for the media.
video[].original_info.widthintegerOriginal video width in pixels.
video[].original_info.heightintegerOriginal video height in pixels.
video[].variantsarrayAvailable playback variants for the video.
video[].variants[]objectOne playback variant.
video[].variants[].content_typestringMedia type of the playback variant.
video[].variants[].bitrateintegerReported bitrate for this playback variant.
video[].variants[].urlstringPlayback address for this variant.
Media entity details51 fields

data.timeline[].entities

FieldTypeDescription
mediaarrayMedia entities referenced by the post.
media[]objectOne media entity referenced by the post.
media[].id_strstringMedia entity ID represented as text.
media[].typestringMedia type label reported by X.
media[].media_url_httpsstringHTTPS image address attached to the media entity.
media[].urlstringURL for the media entity in the post.
media[].display_urlstringDisplay text for the media link.
media[].expanded_urlstringExpanded address for the media link when supplied.
media[].ext_alt_textstringAlternative text supplied for the media.
media[].source_status_id_strstringID of the source post for this media, represented as text.
media[].source_user_id_strstringID of the source account for this media, represented as text.
media[].ext_media_availabilityobjectMedia availability details, when supplied.
media[].ext_media_availability.statusstringAvailability status label returned for the media.
media[].allow_download_statusarray | objectDownload availability details for the media. This field can also be an empty array.
media[].allow_download_status.allow_downloadbooleanWhether downloading is marked as allowed.
media[].additional_media_infoobjectAdditional descriptive metadata for the media, when supplied.
media[].additional_media_info.titlestringTitle supplied for the media.
media[].additional_media_info.descriptionstringDescription supplied for the media.
media[].additional_media_info.embeddablebooleanWhether embedding is marked as allowed.
media[].additional_media_info.monetizablebooleanWhether the media is marked as eligible for monetization.
media[].original_infoobjectOriginal media dimensions, when supplied.
media[].original_info.widthintegerOriginal media width in pixels.
media[].original_info.heightintegerOriginal media height in pixels.
media[].sizesobjectAvailable image sizes reported for the media entity.
media[].sizes.largeobjectLarge image dimensions.
media[].sizes.large.wintegerImage width in pixels.
media[].sizes.large.hintegerImage height in pixels.
media[].sizes.large.resizestringResize method label reported for this image size.
media[].sizes.mediumobjectMedium image dimensions.
media[].sizes.medium.wintegerImage width in pixels.
media[].sizes.medium.hintegerImage height in pixels.
media[].sizes.medium.resizestringResize method label reported for this image size.
media[].sizes.smallobjectSmall image dimensions.
media[].sizes.small.wintegerImage width in pixels.
media[].sizes.small.hintegerImage height in pixels.
media[].sizes.small.resizestringResize method label reported for this image size.
media[].sizes.thumbobjectThumbnail image dimensions.
media[].sizes.thumb.wintegerImage width in pixels.
media[].sizes.thumb.hintegerImage height in pixels.
media[].sizes.thumb.resizestringResize method label reported for this image size.
media[].video_infoobjectVideo-specific metadata for the media entity.
media[].video_info.duration_millisintegerVideo duration in milliseconds.
media[].video_info.aspect_ratioarrayVideo aspect ratio reported as width and height proportions.
media[].video_info.aspect_ratio[]integerOne value in the width and height ratio.
media[].video_info.variantsarrayPlayback variants reported for the media entity.
media[].video_info.variants[]objectOne playback variant.
media[].video_info.variants[].content_typestringMedia type of the playback variant.
media[].video_info.variants[].bitrateintegerReported bitrate for this playback variant.
media[].video_info.variants[].urlstringPlayback address for this variant.
media[].indicesarrayText offsets associated with this entity, in the original X format.
media[].indices[]integerOne text offset associated with the entity.
Quoted post19 fields

data.timeline[].quoted

Details of the post quoted by this result, when available.

FieldTypeDescription
tweet_idstringX post ID represented as text.
conversation_idstringID of the post's conversation, represented as text when supplied.
created_atstringPost publication time in X's original timestamp format.
textstringPost text returned by X.
langstringLanguage code supplied for the post.
viewsstringReported view count as numeric text when available.
favoritesintegerLike count reported for the post.
bookmarksintegerBookmark count reported for the post.
repliesintegerReply count reported for the post.
retweetsintegerRepost count reported for the post.
quotesintegerQuote count reported for the post.
sensitiveboolean | nullSensitive-content flag when supplied.
authorobjectProfile information for the author of this post.
author.rest_idstringX account ID represented as text.
author.screen_namestringPublic X username of the account.
author.namestringDisplay name of the account.
author.created_atstringAccount creation time in X's original timestamp format.
author.avatarstringAddress of the account's avatar image.
author.blue_verifiedbooleanWhether the response marks the account as blue verified.
Quoted post media22 fields

data.timeline[].quoted.media

Media attached to the post. It can be an object with media lists or an empty array.

FieldTypeDescription
photoarrayPhoto attachments for the post.
photo[]objectOne photo attachment on the post.
photo[].idstringPhoto ID represented as text.
photo[].media_url_httpsstringHTTPS address supplied for the photo.
photo[].sizesobjectDimensions reported for the photo.
photo[].sizes.wintegerPhoto width in pixels.
photo[].sizes.hintegerPhoto height in pixels.
videoarrayVideo attachments for the post.
video[]objectOne video attachment on the post.
video[].idstringVideo ID represented as text.
video[].media_url_httpsstringHTTPS preview image address supplied for the video.
video[].durationintegerVideo duration in milliseconds when available.
video[].aspect_ratioarrayAspect ratio reported as width and height proportions.
video[].aspect_ratio[]integerOne value in the width and height ratio.
video[].original_infoobjectOriginal video dimensions reported for the media.
video[].original_info.widthintegerOriginal video width in pixels.
video[].original_info.heightintegerOriginal video height in pixels.
video[].variantsarrayAvailable playback variants for the video.
video[].variants[]objectOne playback variant.
video[].variants[].content_typestringMedia type of the playback variant.
video[].variants[].bitrateintegerReported bitrate for this playback variant.
video[].variants[].urlstringPlayback address for this variant.
Repost source1 field

data.timeline[].retweeted

Reference to the original post attached to a repost.

FieldTypeDescription
idstringX post ID of the reposted original, represented as text.
Original post in a repost17 fields

data.timeline[].retweeted_tweet

Details of the original post attached to a repost, when available.

FieldTypeDescription
tweet_idstringX post ID represented as text.
conversation_idstringID of the post's conversation, represented as text when supplied.
created_atstringPost publication time in X's original timestamp format.
textstringPost text returned by X.
langstringLanguage code supplied for the post.
favoritesintegerLike count reported for the post.
bookmarksintegerBookmark count reported for the post.
repliesintegerReply count reported for the post.
retweetsintegerRepost count reported for the post.
quotesintegerQuote count reported for the post.
sensitiveboolean | nullSensitive-content flag when supplied.
authorobjectProfile information for the author of this post.
author.rest_idstringX account ID represented as text.
author.screen_namestringPublic X username of the account.
author.namestringDisplay name of the account.
author.avatarstringAddress of the account's avatar image.
author.blue_verifiedbooleanWhether the response marks the account as blue verified.
Original post media in a repost19 fields

data.timeline[].retweeted_tweet.media

Media attached to the post. It can be an object with media lists or an empty array.

FieldTypeDescription
photoarrayPhoto attachments for the post.
photo[]objectOne photo attachment on the post.
photo[].idstringPhoto ID represented as text.
photo[].media_url_httpsstringHTTPS address supplied for the photo.
videoarrayVideo attachments for the post.
video[]objectOne video attachment on the post.
video[].idstringVideo ID represented as text.
video[].media_url_httpsstringHTTPS preview image address supplied for the video.
video[].durationintegerVideo duration in milliseconds when available.
video[].aspect_ratioarrayAspect ratio reported as width and height proportions.
video[].aspect_ratio[]integerOne value in the width and height ratio.
video[].original_infoobjectOriginal video dimensions reported for the media.
video[].original_info.widthintegerOriginal video width in pixels.
video[].original_info.heightintegerOriginal video height in pixels.
video[].variantsarrayAvailable playback variants for the video.
video[].variants[]objectOne playback variant.
video[].variants[].content_typestringMedia type of the playback variant.
video[].variants[].bitrateintegerReported bitrate for this playback variant.
video[].variants[].urlstringPlayback address for this variant.

Response Example ​

Loading the response example...