curl \
-H "Authorization: Bearer API_KEY" \
-H "x-twitter-oauth1-api-key: YOUR_TWITTER_API_KEY" \
-H "x-twitter-oauth1-api-secret: YOUR_TWITTER_API_SECRET" \
-X GET "https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15"
const API_KEY = "API_KEY";
fetch(
"https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15",
{
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`,
"x-twitter-oauth1-api-key": "YOUR_TWITTER_API_KEY",
"x-twitter-oauth1-api-secret": "YOUR_TWITTER_API_SECRET"
}
}
)
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
'Authorization': 'Bearer API_KEY',
'x-twitter-oauth1-api-key': 'YOUR_TWITTER_API_KEY',
'x-twitter-oauth1-api-secret': 'YOUR_TWITTER_API_SECRET'
}
params = {
'query': 'ayrshare OR #socialmedia',
'platform': 'twitter',
'limit': 15
}
r = requests.get('https://api.ayrshare.com/api/listen/keyword', headers=headers, params=params)
print(r.json())
{
"status": "success",
"platform": "twitter",
"query": "ayrshare OR #socialmedia",
"tweets": [
{
"id": "1234567890",
"text": "Just discovered @ayrshare for managing social media APIs!",
"createdAt": "2026-03-22T14:30:00.000Z",
"user": {
"id": "987654321",
"name": "Jane Doe",
"screenName": "janedoe",
"profileImageUrl": "https://pbs.twimg.com/profile_images/..."
},
"metrics": {
"retweetCount": 5,
"favoriteCount": 12
},
"entities": {
"hashtags": ["socialmedia"],
"mentions": ["ayrshare"],
"urls": []
},
"inReplyToStatusId": null,
"isRetweet": false,
"lang": "en"
}
],
"meta": {
"pagination": {
"hasMore": true,
"next": "b26v89c19zqg8o3fpds7h...",
"limit": 15
}
}
}
{
"action": "listen",
"status": "error",
"code": 428,
"message": "Missing required `query` parameter for keyword search"
}
{
"action": "listen",
"status": "error",
"code": 429,
"message": "Missing or unsupported `platform` parameter. Currently only `twitter` is supported"
}
{
"action": "listen",
"status": "error",
"code": 430,
"message": "Keyword search requires Premium, Launch, Business, or Enterprise tier"
}
{
"action": "listen",
"status": "error",
"code": 431,
"message": "Keyword search requires BYOK (Bring Your Own Keys) for X/Twitter"
}
{
"action": "listen",
"status": "error",
"code": 432,
"message": "Daily keyword search limit exceeded. Limit resets at midnight UTC"
}
Keyword
Tweets nach Keyword suchen
Durchsuchen Sie X/Twitter nach Tweets zu Keywords, Hashtags und Suchoperatoren und erhalten Sie Nutzerinformationen und Engagement-Metriken mit BYOK.
GET
/
listen
/
keyword
curl \
-H "Authorization: Bearer API_KEY" \
-H "x-twitter-oauth1-api-key: YOUR_TWITTER_API_KEY" \
-H "x-twitter-oauth1-api-secret: YOUR_TWITTER_API_SECRET" \
-X GET "https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15"
const API_KEY = "API_KEY";
fetch(
"https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15",
{
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`,
"x-twitter-oauth1-api-key": "YOUR_TWITTER_API_KEY",
"x-twitter-oauth1-api-secret": "YOUR_TWITTER_API_SECRET"
}
}
)
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
'Authorization': 'Bearer API_KEY',
'x-twitter-oauth1-api-key': 'YOUR_TWITTER_API_KEY',
'x-twitter-oauth1-api-secret': 'YOUR_TWITTER_API_SECRET'
}
params = {
'query': 'ayrshare OR #socialmedia',
'platform': 'twitter',
'limit': 15
}
r = requests.get('https://api.ayrshare.com/api/listen/keyword', headers=headers, params=params)
print(r.json())
{
"status": "success",
"platform": "twitter",
"query": "ayrshare OR #socialmedia",
"tweets": [
{
"id": "1234567890",
"text": "Just discovered @ayrshare for managing social media APIs!",
"createdAt": "2026-03-22T14:30:00.000Z",
"user": {
"id": "987654321",
"name": "Jane Doe",
"screenName": "janedoe",
"profileImageUrl": "https://pbs.twimg.com/profile_images/..."
},
"metrics": {
"retweetCount": 5,
"favoriteCount": 12
},
"entities": {
"hashtags": ["socialmedia"],
"mentions": ["ayrshare"],
"urls": []
},
"inReplyToStatusId": null,
"isRetweet": false,
"lang": "en"
}
],
"meta": {
"pagination": {
"hasMore": true,
"next": "b26v89c19zqg8o3fpds7h...",
"limit": 15
}
}
}
{
"action": "listen",
"status": "error",
"code": 428,
"message": "Missing required `query` parameter for keyword search"
}
{
"action": "listen",
"status": "error",
"code": 429,
"message": "Missing or unsupported `platform` parameter. Currently only `twitter` is supported"
}
{
"action": "listen",
"status": "error",
"code": 430,
"message": "Keyword search requires Premium, Launch, Business, or Enterprise tier"
}
{
"action": "listen",
"status": "error",
"code": 431,
"message": "Keyword search requires BYOK (Bring Your Own Keys) for X/Twitter"
}
{
"action": "listen",
"status": "error",
"code": 432,
"message": "Daily keyword search limit exceeded. Limit resets at midnight UTC"
}
Durchsuchen Sie X/Twitter nach Tweets, die Keywords, Hashtags und erweiterten Suchoperatoren entsprechen. Gibt normalisierte Tweet-Daten zurück, einschließlich Nutzerinformationen, Engagement-Metriken und Entitäten.
Dieser Endpunkt erfordert Bring Your Own Keys (BYOK) für X/Twitter.
Wichtige Einschränkungen
- Es sind nur Tweets aus den letzten ~7 Tagen verfügbar (Einschränkung der X-API).
- Standardmäßiges Tageslimit von 25 Aufrufen.
- BYOK-Schlüssel für X/Twitter sind erforderlich.
Header-Parameter
Query-Parameter
Keyword-Suchanfrage. Unterstützt X/Twitter-Suchoperatoren (siehe Tabelle unten).Beispiele:
ayrshare, #socialmedia, ayrshare OR #socialmedia, from:ayrshare.Gibt Tweets mit einer ID zurück, die größer (neuer) als dieser Wert ist. Nützlich, um nur neue Tweets seit einer vorherigen Anfrage abzurufen.
Gibt Tweets mit einer ID zurück, die kleiner (älter) als dieser Wert ist. Nützlich, um rückwärts durch Ergebnisse zu paginieren.
Paginierungstoken aus dem
meta.pagination.next einer vorherigen Antwort. Verwenden Sie dies, um die nächste Ergebnisseite abzurufen.Suchoperatoren
Der Parameterquery unterstützt die folgenden X/Twitter-Suchoperatoren:
| Operator | Beschreibung | Beispiel |
|---|---|---|
AND | Beide Begriffe müssen vorkommen (Standardverhalten) | social AND media |
OR | Einer der Begriffe muss vorkommen | ayrshare OR socialmedia |
from: | Tweets von einem bestimmten Nutzer | from:ayrshare |
to: | Tweets, die an einen bestimmten Nutzer gerichtet sind | to:ayrshare |
# | Übereinstimmung mit einem Hashtag | #socialmedia |
@ | Übereinstimmung mit einer Erwähnung | @ayrshare |
- | Einen Begriff ausschließen | social -spam |
lang: | Nach Sprache filtern | ayrshare lang:en |
filter: | Nach Inhaltstyp filtern | ayrshare filter:links |
url: | Übereinstimmung mit einer URL | url:ayrshare.com |
curl \
-H "Authorization: Bearer API_KEY" \
-H "x-twitter-oauth1-api-key: YOUR_TWITTER_API_KEY" \
-H "x-twitter-oauth1-api-secret: YOUR_TWITTER_API_SECRET" \
-X GET "https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15"
const API_KEY = "API_KEY";
fetch(
"https://api.ayrshare.com/api/listen/keyword?query=ayrshare%20OR%20%23socialmedia&platform=twitter&limit=15",
{
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`,
"x-twitter-oauth1-api-key": "YOUR_TWITTER_API_KEY",
"x-twitter-oauth1-api-secret": "YOUR_TWITTER_API_SECRET"
}
}
)
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {
'Authorization': 'Bearer API_KEY',
'x-twitter-oauth1-api-key': 'YOUR_TWITTER_API_KEY',
'x-twitter-oauth1-api-secret': 'YOUR_TWITTER_API_SECRET'
}
params = {
'query': 'ayrshare OR #socialmedia',
'platform': 'twitter',
'limit': 15
}
r = requests.get('https://api.ayrshare.com/api/listen/keyword', headers=headers, params=params)
print(r.json())
{
"status": "success",
"platform": "twitter",
"query": "ayrshare OR #socialmedia",
"tweets": [
{
"id": "1234567890",
"text": "Just discovered @ayrshare for managing social media APIs!",
"createdAt": "2026-03-22T14:30:00.000Z",
"user": {
"id": "987654321",
"name": "Jane Doe",
"screenName": "janedoe",
"profileImageUrl": "https://pbs.twimg.com/profile_images/..."
},
"metrics": {
"retweetCount": 5,
"favoriteCount": 12
},
"entities": {
"hashtags": ["socialmedia"],
"mentions": ["ayrshare"],
"urls": []
},
"inReplyToStatusId": null,
"isRetweet": false,
"lang": "en"
}
],
"meta": {
"pagination": {
"hasMore": true,
"next": "b26v89c19zqg8o3fpds7h...",
"limit": 15
}
}
}
{
"action": "listen",
"status": "error",
"code": 428,
"message": "Missing required `query` parameter for keyword search"
}
{
"action": "listen",
"status": "error",
"code": 429,
"message": "Missing or unsupported `platform` parameter. Currently only `twitter` is supported"
}
{
"action": "listen",
"status": "error",
"code": 430,
"message": "Keyword search requires Premium, Launch, Business, or Enterprise tier"
}
{
"action": "listen",
"status": "error",
"code": 431,
"message": "Keyword search requires BYOK (Bring Your Own Keys) for X/Twitter"
}
{
"action": "listen",
"status": "error",
"code": 432,
"message": "Daily keyword search limit exceeded. Limit resets at midnight UTC"
}