openapi: 3.0.0
info:
  title: Google Place API
  description: |
    The Google Place API provides detailed information about a specific place or business using Google's Knowledge Graph MID (kgmid).

    **Cross-linking**: The kgmid parameter can be obtained from various Google search APIs:
    - Google Search API - returns kgmid in local_results
    - Google Maps API - returns kgmid in local_results
    - Google Local Services API - returns kgmid in results

  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Place Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Search engine type
          schema:
            type: string
            enum: ["google_place"]
            default: "google_place"
        - name: kgmid
          in: query
          required: true
          description: Google Knowledge Graph Machine ID for the place
          schema:
            type: string
        - name: hl
          in: query
          required: false
          description: Language code
          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", "kl", "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", "my", "ms", "ml", "mt", "mv", "mi", "mr", "mfe", "mo", "mn", "sr-me", "ne", "pcm", "nso", "no", "nn", "oc", "or", "om", "ps", "fa", "xx-pirate", "pl", "pt", "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", "vu", "vi", "cy", "wo", "xh", "yi", "yo", "zu"]
            default: "en"
        - name: gl
          in: query
          required: false
          description: Country code
          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"
      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'
        place_result:
          $ref: '#/components/schemas/PlaceResult'
    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 Place 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: Search engine used
        kgmid:
          type: string
          description: Google Knowledge Graph Machine ID
        hl:
          type: string
          description: Language code
        gl:
          type: string
          description: Country code
    PlaceResult:
      type: object
      properties:
        title:
          type: string
          description: Name of the place
        price:
          type: object
          properties:
            text:
              type: string
              description: Price range text display
            min:
              type: integer
              description: Minimum price value
            max:
              type: integer
              description: Maximum price value
        type:
          type: string
          description: Type or category of the place
        description:
          type: string
          description: Description of the place
        address:
          type: string
          description: Physical address of the place
        address_link:
          type: string
          description: Link to the address on Google Maps
        directions_link:
          type: string
          description: Link to get directions to the place
        phone:
          type: string
          description: Phone number of the place
        rating:
          type: number
          format: float
          description: Average rating of the place
        reviews:
          type: integer
          description: Total number of reviews
        tickets:
          type: array
          items:
            type: object
            properties:
              link:
                type: string
                description: Link to purchase tickets
              text:
                type: string
                description: Ticket option text
              price:
                type: string
                description: Ticket price text
              extracted_price:
                type: number
                description: Extracted numeric price value
        menu:
          type: object
          properties:
            link:
              type: string
              description: Link to the menu
        place_actions:
          type: array
          items:
            type: object
            properties:
              link:
                type: string
                description: Action link URL
              text:
                type: string
                description: Action text description
        order_online:
          type: object
          properties:
            delivery:
              type: array
              items:
                $ref: '#/components/schemas/OrderProvider'
            pickup:
              type: array
              items:
                $ref: '#/components/schemas/OrderProvider'
        review_summary:
          type: string
          description: AI-generated summary of reviews
        review_results:
          type: array
          items:
            type: object
            properties:
              link:
                type: string
                description: Link to the full review
              text:
                type: string
                description: Review text excerpt
              rating:
                type: number
                description: Rating given in this review
        open_state:
          type: string
          description: Current open/closed status
        open_hours:
          type: array
          items:
            type: object
            properties:
              day:
                type: string
                description: Day of the week
              time:
                type: string
                description: Opening hours for this day
        images:
          type: array
          items:
            type: string
            description: Image URL
        popular_times:
          type: object
          properties:
            live:
              type: object
              properties:
                time:
                  type: string
                  description: Current time information
                info:
                  type: string
                  description: Current busyness information
            people_typically_spend:
              type: string
              description: Typical visit duration
            chart:
              type: object
              properties:
                monday:
                  $ref: '#/components/schemas/PopularTimesDay'
                tuesday:
                  $ref: '#/components/schemas/PopularTimesDay'
                wednesday:
                  $ref: '#/components/schemas/PopularTimesDay'
                thursday:
                  $ref: '#/components/schemas/PopularTimesDay'
                friday:
                  $ref: '#/components/schemas/PopularTimesDay'
                saturday:
                  $ref: '#/components/schemas/PopularTimesDay'
                sunday:
                  $ref: '#/components/schemas/PopularTimesDay'
        menu_highlights:
          type: array
          items:
            type: object
            properties:
              image:
                type: string
                description: Menu item image URL
              description:
                type: string
                description: Menu item description
        menu_images:
          type: array
          items:
            type: string
            description: Menu image URL
        social_media_updates:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Update title
              link:
                type: string
                description: Link to the social media post
              duration:
                type: string
                description: Video duration if applicable
              account:
                type: string
                description: Social media account name
              social_media_name:
                type: string
                description: Social media platform name
              published_at:
                type: string
                description: Publication date
              thumbnail:
                type: string
                description: Thumbnail image URL
        more_information:
          type: string
          description: Link to more information about the place
    OrderProvider:
      type: object
      properties:
        name:
          type: string
          description: Provider name
        thumbnail:
          type: string
          description: Provider logo URL
        link:
          type: string
          description: Link to order from this provider
        delivery_time:
          type: string
          description: Estimated delivery time
        fee_description:
          type: string
          description: Delivery fee information
    PopularTimesDay:
      type: array
      items:
        type: object
        properties:
          time:
            type: string
            description: Time of day
          info:
            type: string
            description: Busyness information
          busyness_score:
            type: integer
            description: Busyness score (0-100)
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong