openapi: 3.0.0
info:
  title: Google Maps Photo Meta API
  description: |
    The Google Maps Photo Meta API returns the details of a single photo or video on Google Maps: the full-size image, its caption, size, location and dates, the contributor who posted it, and the place it belongs to.

    **Cross-linking**: Each photo in a Google Maps Photos API response has a `photo_id`. Pass it as the `photo_id` parameter to get that photo's details. The `data_id` and `place_id` of `place_result` work with the Google Maps Place, Google Maps Reviews and Google Maps Photos APIs.
  version: 1.0.0
servers:
  - url: https://www.searchapi.io/api/v1
paths:
  /search:
    get:
      summary: Google Maps Photo Meta Search
      security:
        - ApiKeyAuth: []
        - ApiKeyQuery: []
      parameters:
        - name: engine
          in: query
          required: true
          description: Must be set to google_maps_photo_meta
          schema:
            type: string
            enum: ["google_maps_photo_meta"]
        - name: photo_id
          in: query
          required: true
          description: ID of a Google Maps photo or video, from the photos[].photo_id field of the Google Maps Photos API
          schema:
            type: string
            pattern: "^[A-Za-z0-9_-]{16,128}$"
        - name: hl
          in: query
          required: false
          description: Language for the search results
          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"
      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"
        photo:
          $ref: "#/components/schemas/Photo"
        user:
          $ref: "#/components/schemas/User"
        place_result:
          $ref: "#/components/schemas/PlaceResult"
        error:
          type: string
          description: Error message explaining why no photo was returned
    SearchMetadata:
      type: object
      required: [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 Maps Photo Meta 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
        photo_id:
          type: string
          description: Photo ID used for the search
        hl:
          type: string
          description: Interface language used
    Photo:
      type: object
      required: [photo_id, image, width, height, gps_coordinates, date, capture_date]
      properties:
        photo_id:
          type: string
          description: ID of the photo or video
        image:
          type: string
          description: URL of the full-size image
        video:
          type: string
          description: URL of the highest-resolution video file
        width:
          type: integer
          description: Width of the photo in pixels
        height:
          type: integer
          description: Height of the photo in pixels
        description:
          type: string
          description: Caption the contributor wrote for the photo
        gps_coordinates:
          $ref: "#/components/schemas/GPSCoordinates"
        date:
          type: string
          format: date
          description: Date the photo was posted, in YYYY-MM-DD format
        capture_date:
          type: string
          description: Date the photo was taken, in YYYY-MM-DD or YYYY-MM format
    GPSCoordinates:
      type: object
      required: [latitude, longitude]
      properties:
        latitude:
          type: number
          description: Latitude where the photo was taken
        longitude:
          type: number
          description: Longitude where the photo was taken
    User:
      type: object
      required: [name, link, contributor_id, thumbnail]
      properties:
        name:
          type: string
          description: Name of the contributor who posted the photo
        link:
          type: string
          description: URL of the contributor's Google Maps profile
        contributor_id:
          type: string
          description: Google Maps contributor ID of the user
        thumbnail:
          type: string
          description: URL of the contributor's profile picture
        is_owner:
          type: boolean
          description: Whether the place's owner posted the photo
    PlaceResult:
      type: object
      required: [title, type, data_id, ludocid, place_id]
      properties:
        title:
          type: string
          description: Name of the place the photo belongs to
        type:
          type: string
          description: Category of the place
        data_id:
          type: string
          description: Google Maps data ID of the place
        ludocid:
          type: string
          description: Google ludocid (CID) of the place
        place_id:
          type: string
          description: Google place ID of the place
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Error message describing what went wrong
