{
  "openapi": "3.0.3",
  "info": {
    "title": "Web Data Toolkit",
    "version": "1.0.0",
    "description": "Four production data endpoints behind one key: YouTube transcripts (single video or a whole channel), Google Trends, and Google Play reviews. HTTP only, no browsers. Every endpoint returns clean JSON with a count and the rows. An App Store reviews endpoint was offered until 2026-09-14 and was withdrawn because Apple's public customer-reviews feed stopped returning entries."
  },
  "servers": [
    {
      "url": "https://web-data-toolkit.vercel.app",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/youtube/transcript": {
      "get": {
        "operationId": "youtubeTranscript",
        "summary": "Transcript for one or more YouTube videos",
        "description": "Full transcript text plus language, auto-generated flag, word count, title and channel. Comma-separate up to 50 video URLs or ids. Videos without captions come back with a status and no charge.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "description": "YouTube URL or 11-character id; comma-separate up to 50"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "en"
            },
            "description": "Preferred language codes in order, comma separated"
          },
          {
            "name": "translateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Translate the transcript into this language code"
          },
          {
            "name": "segments",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ],
              "default": "0"
            },
            "description": "1 to include timestamped segments"
          }
        ],
        "responses": {
          "200": {
            "description": "Transcripts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "Missing parameter"
          },
          "401": {
            "description": "Missing or invalid key"
          }
        }
      }
    },
    "/api/youtube/channel": {
      "get": {
        "operationId": "youtubeChannel",
        "summary": "Every video of a channel or playlist, with transcripts",
        "description": "Lists the newest videos of a channel, handle or playlist and returns each one's metadata and transcript in a single call.",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "@Apify",
            "description": "@handle, channel URL or id, or a playlist"
          },
          {
            "name": "max",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 25,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Newest N videos"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Videos with transcripts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          }
        }
      }
    },
    "/api/trends": {
      "get": {
        "operationId": "googleTrends",
        "summary": "Google Trends interest, regions and related queries",
        "description": "Interest over time, interest by region, and top plus rising related queries for up to five keywords.",
        "parameters": [
          {
            "name": "keyword",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "moissanite ring",
            "description": "Comma-separate up to 5 keywords"
          },
          {
            "name": "geo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "US",
            "description": "Country or region code; empty means worldwide"
          },
          {
            "name": "timeframe",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "today 12-m"
            },
            "description": "Any Google Trends range, e.g. now 7-d, today 3-m, today 5-y"
          },
          {
            "name": "byRegion",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ],
              "default": "1"
            }
          },
          {
            "name": "related",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ],
              "default": "1"
            }
          },
          {
            "name": "trending",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ],
              "default": "0"
            },
            "description": "1 adds today's trending searches for the location"
          }
        ],
        "responses": {
          "200": {
            "description": "Trends rows",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          }
        }
      }
    },
    "/api/google-play/reviews": {
      "get": {
        "operationId": "googlePlayReviews",
        "summary": "Google Play reviews by app and country",
        "description": "Rating, text, author, thumbs-up, app version and the developer's reply for any Android app, per country and language.",
        "parameters": [
          {
            "name": "app",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "com.whatsapp",
            "description": "Google Play URL or package name; comma-separate up to 20"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "us"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "en"
            }
          },
          {
            "name": "max",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "rating",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 5,
              "default": 0
            },
            "description": "1-5 to keep only that star rating"
          }
        ],
        "responses": {
          "200": {
            "description": "Reviews",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "health",
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Result": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "count": {
            "type": "integer",
            "description": "Number of rows returned"
          },
          "seconds": {
            "type": "number",
            "description": "Server time for the call"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "The rows"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ]
}
