openapi: 3.0.0
info:
  title: Google Forums API
  description: |
    The Google Forums API provides programmatic access to Google search results specifically focused on forum and discussion content. This API enables searching across various online forums and discussion boards indexed by Google.

    **Cross-linking**: Forum results often contain threads with multiple answers. Individual posts can be further analyzed or specific forum domains can be targeted using the Google Search API with site-specific queries.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Forums Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Engine to use for the search
          schema:
            type: string
            enum: ["google_forums"]
            default: "google_forums"
        - name: q
          in: query
          required: true
          description: Search query
          schema:
            type: string
        - name: device
          in: query
          required: false
          description: Device type for search results
          schema:
            type: string
            enum: ["desktop", "mobile", "tablet"]
            default: "desktop"
        - name: location
          in: query
          required: false
          description: Location name for localized results
          schema:
            type: string
        - name: uule
          in: query
          required: false
          description: Google encoded location parameter
          schema:
            type: string
        - name: hl
          in: query
          required: false
          description: Interface language
          schema:
            type: string
            enum: ["af", "ak", "sq", "am", "ar", "hy", "az", "eu", "be", "bem", "bn", "bh", "xx-bork", "bs", "br", "bg", "km", "ca", "chr", "ny", "zh-CN", "zh-TW", "co", "hr", "cs", "da", "nl", "xx-elmer", "en", "eo", "et", "ee", "fo", "tl", "fi", "fr", "fy", "gaa", "gl", "ka", "de", "el", "gn", "gu", "xx-hacker", "ht", "ha", "haw", "iw", "hi", "hu", "is", "ig", "id", "ia", "ga", "it", "ja", "jw", "kn", "kk", "rw", "rn", "xx-klingon", "kg", "ko", "kri", "ku", "ckb", "ky", "lo", "la", "lv", "ln", "lt", "loz", "lg", "ach", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mfe", "mo", "mn", "sr-ME", "ne", "pcm", "nso", "no", "nn", "oc", "or", "om", "ps", "fa", "xx-pirate", "pl", "pt-BR", "pt-PT", "pa", "qu", "ro", "rm", "nyn", "ru", "gd", "sr", "sh", "st", "tn", "crs", "sn", "sd", "si", "sk", "sl", "so", "es", "es-419", "su", "sw", "sv", "tg", "ta", "tt", "te", "th", "ti", "to", "lua", "tum", "tr", "tk", "tw", "ug", "uk", "ur", "uz", "vi", "cy", "wo", "xh", "yi", "yo", "zu"]
            default: "en"
        - name: gl
          in: query
          required: false
          description: Country for search results
          schema:
            type: string
            enum: ["af", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "il", "it", "jm", "jp", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "sh", "kn", "lc", "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sk", "si", "sb", "so", "za", "gs", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "ae", "uk", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw", "gg", "je", "im", "me"]
            default: "us"
        - name: lr
          in: query
          required: false
          description: Language restriction for results
          schema:
            type: string
        - name: cr
          in: query
          required: false
          description: Country restriction for results
          schema:
            type: string
            enum: ["af", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt", "bo", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck", "cr", "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gn", "gw", "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", "il", "it", "jm", "jp", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "nc", "nz", "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "sh", "kn", "lc", "pm", "vc", "ws", "sm", "st", "sa", "sn", "cs", "rs", "sc", "sl", "sg", "sk", "si", "sb", "so", "za", "gs", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg", "vi", "wf", "eh", "ye", "zm", "zw"]
        - name: nfpr
          in: query
          required: false
          description: Auto-correction filter
          schema:
            type: string
            enum: ["0", "1"]
        - name: filter
          in: query
          required: false
          description: Duplicate content and host crowding filter
          schema:
            type: string
            enum: ["0", "1"]
        - name: safe
          in: query
          required: false
          description: SafeSearch filtering level
          schema:
            type: string
            enum: ["active", "blur", "off"]
            default: "blur"
        - name: page
          in: query
          required: false
          description: Page number for pagination
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: time_period
          in: query
          required: false
          description: Time period filter
          schema:
            type: string
            enum: ["last_hour", "last_day", "last_week", "last_month", "last_year"]
        - name: time_period_min
          in: query
          required: false
          description: 'Minimum date for custom time range. Format: MM/DD/YYYY'
          schema:
            type: string
            pattern: '^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/(19|20)\d\d$'
        - name: time_period_max
          in: query
          required: false
          description: 'Maximum date for custom time range. Format: MM/DD/YYYY'
          schema:
            type: string
            pattern: '^(0?[1-9]|1[0-2])/(0?[1-9]|[12][0-9]|3[01])/(19|20)\d\d$'
        - name: sort_by
          in: query
          required: false
          description: Sort order for results
          schema:
            type: string
            enum: ["most_recent"]
        - name: verbatim
          in: query
          required: false
          description: Verbatim search mode
          schema:
            type: string
            enum: ["true"]
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '400':
          description: Validation Error. There is an issue with query parameters, such as missing required parameters or invalid values.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication Error. The API key is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate Limit Exceeded. The number of allowed requests has been exceeded. Consider upgrading your plan or waiting for the limit to reset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server Error. Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Timeout. We could not retrieve results in 90 seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use Bearer authentication. Format: "Bearer YOUR_API_KEY"'
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Pass API key as query parameter
  schemas:
    SearchResponse:
      type: object
      properties:
        search_metadata:
          $ref: '#/components/schemas/SearchMetadata'
        search_parameters:
          $ref: '#/components/schemas/SearchParameters'
        search_information:
          $ref: '#/components/schemas/SearchInformation'
        organic_results:
          type: array
          items:
            $ref: '#/components/schemas/OrganicResult'
        related_searches:
          type: array
          items:
            $ref: '#/components/schemas/RelatedSearch'
        pagination:
          $ref: '#/components/schemas/Pagination'
        error:
          type: string
          description: Error message when search fails
    SearchMetadata:
      type: object
      required: [id, status, created_at]
      properties:
        id:
          type: string
          description: "Unique identifier for the search request"
        status:
          type: string
          description: "Status of the search request"
        created_at:
          type: string
          format: date-time
          description: "Timestamp when the search was created"
        request_time_taken:
          type: number
          description: "Time taken to make the request in seconds"
        parsing_time_taken:
          type: number
          description: "Time taken to parse the results in seconds"
        total_time_taken:
          type: number
          description: "Total time taken for the search in seconds"
        request_url:
          type: string
          description: "Google Forums URL for this search"
        html_url:
          type: string
          description: "URL to view HTML results"
        json_url:
          type: string
          description: "URL to view JSON results"
    SearchParameters:
      type: object
      properties:
        engine:
          type: string
          description: Engine used for the search
        q:
          type: string
          description: Search query
        device:
          type: string
          description: Device type used for search
        location:
          type: string
          description: Location specified for search
        location_used:
          type: string
          description: Actual location used by Google
        uule:
          type: string
          description: Google encoded location parameter
        hl:
          type: string
          description: Interface language
        gl:
          type: string
          description: Country for results
        lr:
          type: string
          description: Language restriction
        cr:
          type: string
          description: Country restriction
        nfpr:
          type: string
          description: Auto-correction filter value
        filter:
          type: string
          description: Duplicate filter value
        safe:
          type: string
          description: SafeSearch filter value
        page:
          type: integer
          description: Page number
        time_period:
          type: string
          description: Time period filter
        time_period_min:
          type: string
          description: Minimum date for custom range
        time_period_max:
          type: string
          description: Maximum date for custom range
        sort_by:
          type: string
          description: Sort order
        verbatim:
          type: string
          description: Verbatim search mode
    SearchInformation:
      type: object
      required: [query_displayed, total_results, time_taken_displayed]
      properties:
        query_displayed:
          type: string
          description: Query as displayed by Google
        total_results:
          type: integer
          description: Estimated total number of results
        time_taken_displayed:
          type: number
          description: Search time in seconds
        detected_location:
          type: string
          description: Location detected by Google
    OrganicResult:
      type: object
      required: [position, title, link, source, domain, displayed_link, snippet]
      properties:
        position:
          type: integer
          description: Position in search results
        title:
          type: string
          description: Title of the result
        link:
          type: string
          description: URL of the result
        source:
          type: string
          description: Source of the forum post
        domain:
          type: string
          description: Domain of the result
        displayed_link:
          type: string
          description: Displayed URL text
        snippet:
          type: string
          description: Text snippet from the result
        snippet_highlighted_words:
          type: array
          items:
            type: string
          description: Highlighted words in snippet
        favicon:
          type: string
          description: URL of the site's favicon
        sitelinks:
          type: object
          properties:
            list:
              type: array
              items:
                type: object
                required: [title, link, answer_count, date]
                properties:
                  title:
                    type: string
                    description: Sitelink title
                  link:
                    type: string
                    description: Sitelink URL
                  answer_count:
                    type: integer
                    description: Number of answers in thread
                  date:
                    type: string
                    description: Date of the post
        rich_snippet:
          type: object
          properties:
            detected_extensions:
              type: array
              items:
                type: object
                properties:
                  answer_link:
                    type: string
                    description: Link to best answer
                  answer_count:
                    type: integer
                    description: Total answer count
                  top_answer:
                    type: string
                    description: Preview of top answer
    RelatedSearch:
      type: object
      required: [query, link]
      properties:
        query:
          type: string
          description: Related search query
        link:
          type: string
          description: URL for the related search
    Pagination:
      type: object
      properties:
        current:
          type: integer
          description: Current page number
        previous:
          type: string
          description: URL for previous page
        next:
          type: string
          description: URL for next page
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong