# Upscrape Google Maps LLM Integration Prompt

Give this to an LLM or coding agent. It must fetch the OpenAPI spec first and use this brief only for orientation.

## First Step

Fetch and read this OpenAPI spec before writing code:

https://data.upscrape.com/catalog/platforms/googlemaps/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAApnb29nbGVtYXBzbgYAzaXUSp8BYgABUYA.Oivek-BOZBZJTIa39aDcx7zXxYiMQE2nTJYDELz4zpo
This signed OpenAPI URL is valid for approximately 7 days.

## Hard Rules

- Use the OpenAPI spec as the source of truth for endpoints, request bodies, response bodies, errors, and JSON schemas.
- Do not infer fields from capability descriptions; fetch the spec and use its component schemas.
- Authenticate every request with `Authorization: Bearer YOUR_API_KEY`.
- Start runs with `POST /execute`; do not invent platform-specific execute endpoints.
- Poll `GET /jobs/{id}` or `GET /jobs/{id}/result` until `state` is `completed` or `failed`.
- Optionally send `Prefer: wait=N` on `POST /execute` to wait up to N seconds for inline results.
- If the response is `200`, the job completed — read `results[0].data`. If `202`, poll `GET /jobs/{id}`.
- `stream` is public-facing but must remain `false` today.

## API Base

- Base URL: `https://data.upscrape.com`
- OpenAPI spec: `https://data.upscrape.com/catalog/platforms/googlemaps/openapi.json?token=SFMyNTY.g2gDdAAAAAFtAAAAC3BsYXRmb3JtX2lkbQAAAApnb29nbGVtYXBzbgYAzaXUSp8BYgABUYA.Oivek-BOZBZJTIa39aDcx7zXxYiMQE2nTJYDELz4zpo`
- Execute endpoint: `POST /execute`
- Job poll endpoint: `GET /jobs/{id}`
- Result alias: `GET /jobs/{id}/result`
- Content-Type: `application/json`
- Optional header: `Idempotency-Key`
- Optional header: `Prefer: wait=N` (hold connection up to N seconds for synchronous result)

## Execution Flow

1. Send `POST /execute` with a platform capability ID and its `input` object.
2. The API responds with a queued `job_id`.
3. Poll the job endpoint until `state` becomes `completed` or `failed`.
4. If completed, read `results[0].data`; its exact shape is defined by the OpenAPI component schema for the selected capability.

## Example Execute Request

```json
{
  "capability": "enrich.google-maps",
  "input": {
    "business_name": "Apple Inc",
    "city": "Cupertino",
    "state": "CA"
  }
}
```

## Optional Request Fields

- `network.session_id`: explicit reusable session identifier
- `network.session_key`: stable key used to derive a reusable session
- `network.sticky`: reuse the resolved session when `true`
- `timeout_ms`: per-capability timeout override up to the capability maximum listed below
- `stream`: must be `false`

## Supported Capabilities

- `enrich.google-maps` - Enrich Business. Unified enrichment lookup: find a business on Google Maps by name + optional city/state and return the best-match Place with phone, website, address, rating, hours, coordinates. Max `timeout_ms`: 30000. Streaming: disabled.
- `googlemaps.nearby` - Search Nearby. Search for places near a coordinate — returns name, address, phone, website, rating, coordinates, and categories for businesses within a given radius. Supports keyword filtering and place type constraints. Max `timeout_ms`: 120000. Streaming: disabled.
- `googlemaps.place` - Get Place. Fetch full details for a single place — name, address, phone, website, rating, review count, coordinates, categories, opening hours, photos, and Google Maps URL. Provide a search query or a Maps URL. Max `timeout_ms`: 30000. Streaming: disabled.
- `googlemaps.reviews` - List Reviews. Stream all reviews for a place. Provide one of: feature_id (preferred), place_id, cid, or url. If feature_id is not provided, an extra request is made to resolve it. Max `timeout_ms`: 120000. Streaming: disabled.
- `googlemaps.search` - Search Places. Search Google Maps for businesses by keyword and optional location — returns name, address, phone, website, rating, coordinates, categories, and place IDs. Supports geo-bias via lat/lng/zoom and country filtering. Max `timeout_ms`: 120000. Streaming: disabled.