Search typeahead suggestions
const url = 'https://api.fxtwitter.com/2/typeahead?q=example&result_type=events%2Cusers%2Ctopics&src=search_box';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.fxtwitter.com/2/typeahead?q=example&result_type=events%2Cusers%2Ctopics&src=search_box'Autocomplete suggestions from X/Twitter search
Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Example
examplePrefix or query string
Example
events,users,topicsComma-separated suggestion kinds to request from X: events, users, topics (default: all three). Other values are ignored. Hashtag-style hits appear under topics.
Example
search_boxUpstream src hint (default: search_box)
Responses
Section titled “ Responses ”Typeahead payload
object
object
Discriminator: full user profile (API v2).
object
object
Facet kind: e.g. url, mention, hashtag, bold, media, custom_emoji (Mastodon custom emoji image)
Start and end UTF-16 indices
object
object
object
object
object
object
object
object
object
object
Example
{ "users": [ { "type": "profile", "verification": { "type": "organization" } } ]}Invalid query parameters
object
Example
{ "code": 400}Upstream returned an error payload for this query
object
object
Discriminator: full user profile (API v2).
object
object
Facet kind: e.g. url, mention, hashtag, bold, media, custom_emoji (Mastodon custom emoji image)
Start and end UTF-16 indices
object
object
object
object
object
object
object
object
object
object
Example
{ "users": [ { "type": "profile", "verification": { "type": "organization" } } ]}Upstream or processing error
object
object
Discriminator: full user profile (API v2).
object
object
Facet kind: e.g. url, mention, hashtag, bold, media, custom_emoji (Mastodon custom emoji image)
Start and end UTF-16 indices
object
object
object
object
object
object
object
object
object
object
Example
{ "users": [ { "type": "profile", "verification": { "type": "organization" } } ]}