{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Maps Directions & Route Report API",
    "description": "Get structured Google Maps route reports with the included SerpApi provider or direct Google Routes BYOK. Returns distance, duration, alternatives, optional steps, provenance, and terminal outcomes.",
    "version": "0.5",
    "x-build-id": "LAGPlP7uxZPP57fyk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~google-maps-directions-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-google-maps-directions-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/khadinakbar~google-maps-directions-api/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-google-maps-directions-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/khadinakbar~google-maps-directions-api/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-google-maps-directions-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "origin",
          "destination"
        ],
        "properties": {
          "routeProvider": {
            "title": "Route provider",
            "enum": [
              "SERPAPI_GOOGLE_MAPS",
              "GOOGLE_ROUTES_BYOK"
            ],
            "type": "string",
            "description": "Select the route provider used for this request. `SERPAPI_GOOGLE_MAPS` is the default and uses the Actor owner's SerpApi Google Maps Directions account, so no customer map key is needed. `GOOGLE_ROUTES_BYOK` calls Google Routes API directly with your secret Google key and unlocks Place IDs, ordered stops, and traffic preferences. This is not a free-form provider name.",
            "default": "SERPAPI_GOOGLE_MAPS"
          },
          "googleMapsApiKey": {
            "title": "Google Maps Routes API key",
            "type": "string",
            "description": "Secret key used only when Route provider is `GOOGLE_ROUTES_BYOK`. Paste a restricted, billing-enabled server key such as `AIza...`; it is sent only to Google and never written to the dataset, output records, or logs. Leave it empty for the included SerpApi Google Maps provider. This is not an Apify token."
          },
          "origin": {
            "title": "Origin",
            "type": "string",
            "description": "Starting point for one route request. Use a street address such as `Times Square, New York, NY`, or coordinates such as `40.7580,-73.9855`; `placeId:ChIJ...` is supported only by Google Routes BYOK. Plain text is treated as an address, not a place-search query. This field is required."
          },
          "destination": {
            "title": "Destination",
            "type": "string",
            "description": "Ending point for one route request. Use an address or latitude-longitude pair, for example `Central Park, New York, NY`; `placeId:` values require Google Routes BYOK. Submit one origin-destination pair so route options stay bounded and predictable. This field is not a Google Maps directions URL."
          },
          "intermediates": {
            "title": "Intermediate stops",
            "maxItems": 10,
            "type": "array",
            "description": "Optional ordered stops between Origin and Destination for Google Routes BYOK. Use the same address, coordinate, or `placeId:` formats; the maximum is ten and the Actor does not optimize the order. SerpApi Google Maps accepts only one start and one end point, so leave this empty with the default provider. This is not a fleet-route optimizer.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "travelMode": {
            "title": "Travel mode",
            "enum": [
              "DRIVE",
              "WALK",
              "BICYCLE",
              "TRANSIT"
            ],
            "type": "string",
            "description": "Transport mode for the requested route. Choose `DRIVE`, `WALK`, `BICYCLE`, or `TRANSIT`; `DRIVE` is the default. Provider coverage varies by location and Google may return no route for a valid pair. This is not a free-form vehicle name.",
            "default": "DRIVE"
          },
          "routingPreference": {
            "title": "Routing preference",
            "enum": [
              "TRAFFIC_UNAWARE",
              "TRAFFIC_AWARE",
              "TRAFFIC_AWARE_OPTIMAL"
            ],
            "type": "string",
            "description": "Controls traffic-aware timing when using Google Routes BYOK for driving. `TRAFFIC_UNAWARE` is the default; the two traffic-aware choices require Google Routes BYOK and can change the Google SKU charged to your project. SerpApi Google Maps has no equivalent selector. This setting is not an ETA guarantee.",
            "default": "TRAFFIC_UNAWARE"
          },
          "computeAlternativeRoutes": {
            "title": "Include route alternatives",
            "type": "boolean",
            "description": "Allow the selected provider to return available alternatives in addition to its default route. The Actor still respects Maximum route options, so response size and event pricing remain bounded. Providers may return fewer options than requested. This switch does not create separate provider calls.",
            "default": true
          },
          "maxRouteOptions": {
            "title": "Maximum route options",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "Maximum route options written from one completed provider request. Choose one through three; the default route is first and the default value is one. This bound does not force a provider to invent alternatives. It is not a number of requests.",
            "default": 1
          },
          "avoidTolls": {
            "title": "Avoid toll roads",
            "type": "boolean",
            "description": "Ask the provider to avoid toll roads when a reasonable route exists. The default is false and a true value is a route preference rather than a guarantee. Toll price estimates remain outside this contract. This option does not refund real-world tolls.",
            "default": false
          },
          "avoidHighways": {
            "title": "Avoid highways",
            "type": "boolean",
            "description": "Ask the provider to avoid highways when feasible. The default is false and the resulting route can be longer. This changes route selection only and does not guarantee local-road-only travel. It is not a manual driving instruction.",
            "default": false
          },
          "languageCode": {
            "title": "Response language",
            "type": "string",
            "description": "Two-letter response language code such as `en`, `es`, or `fr`. The default is `en`; a provider can fall back when a localization is unavailable. This changes instruction text, not the origin or destination country. It is not a locale display name.",
            "default": "en"
          },
          "units": {
            "title": "Distance units",
            "enum": [
              "METRIC",
              "IMPERIAL"
            ],
            "type": "string",
            "description": "Select `METRIC` or `IMPERIAL` for provider-formatted distance values. Normalized `distanceMeters` remains meters in every dataset item. The default is `METRIC` and it does not alter route geometry. This is not a currency selector.",
            "default": "METRIC"
          },
          "includeSteps": {
            "title": "Include turn-by-turn steps",
            "type": "boolean",
            "description": "Include bounded plain-text turn steps in route legs. The default is false to keep agent responses compact; turn it on for workflows that need maneuvers. Steps are historical route content, not live navigation instructions. This field does not request toll prices.",
            "default": false
          },
          "maxStepsPerRoute": {
            "title": "Maximum steps per route",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum turn-by-turn steps kept across each route when steps are enabled. The default is 50 and accepted values are one through 100; truncation is reported through warnings. This value has no effect while steps are disabled. It is not a distance or time limit.",
            "default": 50
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}