{
  "openapi": "3.0.1",
  "info": {
    "title": "X (Twitter) Sentiment Analysis",
    "description": "Collect public X (Twitter) posts in bulk with advanced search queries, handle lists, date ranges, language targeting and optional AI sentiment tagging. No login required.",
    "version": "1.0",
    "x-build-id": "hfXpedDbCJgXGsxq3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lofomachines~x-twitter-sentiment-analysis/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lofomachines-x-twitter-sentiment-analysis",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/lofomachines~x-twitter-sentiment-analysis/runs": {
      "post": {
        "operationId": "runs-sync-lofomachines-x-twitter-sentiment-analysis",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/lofomachines~x-twitter-sentiment-analysis/run-sync": {
      "post": {
        "operationId": "run-sync-lofomachines-x-twitter-sentiment-analysis",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Keywords, phrases, hashtags or full X search queries — one per line. Each line runs as its own search. You can use plain words (<code>climate summit</code>), exact phrases (<code>\"black friday\"</code>), hashtags (<code>#Bitcoin</code>), or advanced operators (<code>tesla OR rivian</code>, <code>nike min_faves:100</code>).",
            "items": {
              "type": "string"
            }
          },
          "twitterHandles": {
            "title": "X (Twitter) handles",
            "type": "array",
            "description": "Usernames whose posts you want to collect — one per line, with or without the <code>@</code>. Each handle returns that account's own posts.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Maximum posts per search",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "How many posts to collect for each search term and each handle. A job with 3 terms and a limit of 100 returns up to 300 posts.",
            "default": 100
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "latest",
              "top",
              "latest_and_top"
            ],
            "type": "string",
            "description": "<b>Latest</b> returns the most recent posts. <b>Top</b> returns the highest-engagement posts. <b>Latest + Top</b> combines both and removes duplicates for the widest coverage.",
            "default": "latest"
          },
          "language": {
            "title": "Language",
            "enum": [
              "any",
              "en",
              "it",
              "es",
              "fr",
              "de",
              "pt",
              "nl",
              "pl",
              "ru",
              "tr",
              "ar",
              "hi",
              "id",
              "ja",
              "ko",
              "zh",
              "sv",
              "da",
              "no",
              "fi",
              "el",
              "cs",
              "ro",
              "hu",
              "uk",
              "he",
              "th",
              "vi",
              "fa",
              "bn",
              "ta"
            ],
            "type": "string",
            "description": "Only return posts written in this language. Leave as <b>Any language</b> to collect everything.",
            "default": "any"
          },
          "startDate": {
            "title": "Posted after",
            "type": "string",
            "description": "Only collect posts published on or after this date. Accepts a date (<code>2024-01-31</code>) or a relative value (<code>7 days</code>, <code>3 months</code>)."
          },
          "endDate": {
            "title": "Posted before",
            "type": "string",
            "description": "Only collect posts published before this date. Accepts a date (<code>2024-12-31</code>) or a relative value (<code>1 day</code>)."
          },
          "sentimentAnalysis": {
            "title": "Add AI sentiment analysis (paid plans only)",
            "type": "boolean",
            "description": "Tag every post as <b>positive</b>, <b>negative</b>, <b>neutral</b> or <b>mixed</b>, with a confidence score and the emotional tone. Adds a small amount of processing time.<br><br><b>Available on paid Apify plans only.</b> On the free plan this option is ignored, and posts are returned without sentiment fields — everything else works exactly the same.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}