{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Maps Directions, Traffic & Distance Matrix",
    "description": "Gets Google Maps routes, travel times, live and predicted traffic, distance matrices, traffic time series and transit itineraries with fares for driving, transit, walking and cycling. No API key.",
    "version": "1.0",
    "x-build-id": "nfHYEIP7uMBLsUbqx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rastriq~google-maps-directions-traffic/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rastriq-google-maps-directions-traffic",
        "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/rastriq~google-maps-directions-traffic/runs": {
      "post": {
        "operationId": "runs-sync-rastriq-google-maps-directions-traffic",
        "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/rastriq~google-maps-directions-traffic/run-sync": {
      "post": {
        "operationId": "run-sync-rastriq-google-maps-directions-traffic",
        "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",
        "properties": {
          "routes": {
            "title": "🛣️ Routes",
            "type": "array",
            "description": "Add one row per trip. <b>Origin</b> and <b>Destination</b> accept addresses, place names or <code>lat,lng</code> coordinates — add the city and country for best results (e.g. <i>Gran Vía 1, Madrid, Spain</i>).<br>Have many routes? Paste them in <b>📋 Bulk routes</b> below.",
            "items": {
              "type": "object",
              "properties": {
                "origin": {
                  "title": "Origin",
                  "type": "string",
                  "editor": "textfield",
                  "description": "Start point: address, place name or lat,lng."
                },
                "destination": {
                  "title": "Destination",
                  "type": "string",
                  "editor": "textfield",
                  "description": "End point: address, place name or lat,lng."
                },
                "travelMode": {
                  "title": "Mode",
                  "type": "string",
                  "editor": "select",
                  "description": "Travel mode for this route. 'Default' uses the 🚗 Travel modes setting below.",
                  "enum": [
                    "default",
                    "driving",
                    "transit",
                    "walking",
                    "cycling"
                  ],
                  "enumTitles": [
                    "Default (Travel modes setting)",
                    "🚗 Driving",
                    "🚆 Public transit",
                    "🚶 Walking",
                    "🚲 Cycling"
                  ],
                  "default": "default"
                },
                "waypoints": {
                  "title": "Stops in between",
                  "type": "array",
                  "editor": "stringList",
                  "description": "Optional intermediate stops, in order (up to 8).",
                  "items": {
                    "type": "string"
                  }
                },
                "label": {
                  "title": "Label",
                  "type": "string",
                  "editor": "textfield",
                  "description": "Optional tag copied to the results (e.g. a store ID or 'Commute A')."
                }
              },
              "required": [
                "origin",
                "destination"
              ]
            }
          },
          "travelModes": {
            "title": "🚗 Travel modes",
            "uniqueItems": true,
            "type": "array",
            "description": "Mode(s) used for routes set to <i>Default</i>, for the distance matrix and for links without a mode. Pick several to compare car vs public transport side by side — each mode is one result.",
            "items": {
              "type": "string",
              "enum": [
                "driving",
                "transit",
                "walking",
                "cycling"
              ],
              "enumTitles": [
                "🚗 Driving",
                "🚆 Public transit",
                "🚶 Walking",
                "🚲 Cycling"
              ]
            },
            "default": [
              "driving"
            ]
          },
          "timeMode": {
            "title": "🕒 When",
            "enum": [
              "now",
              "depart_at",
              "arrive_by"
            ],
            "type": "string",
            "description": "<b>Leave now</b>: live traffic and next departures.<br><b>Depart at</b> / <b>Arrive by</b>: pick a date and time below — ideal for predicted rush-hour traffic or timetables.",
            "default": "now"
          },
          "travelDate": {
            "title": "📅 Date",
            "pattern": "^$|^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^[+-]?(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Used with <i>Depart at</i> / <i>Arrive by</i>. Pick a day in the calendar, or use a relative value like <code>1 day</code> (= tomorrow) — handy for scheduled runs."
          },
          "travelTime": {
            "title": "⏰ Time",
            "pattern": "^([01]?\\d|2[0-3]):[0-5]\\d$",
            "type": "string",
            "description": "Local time at the origin (24h). Pick from the list or type any time, e.g. <code>08:45</code>."
          },
          "routesBulk": {
            "title": "Routes, one per line",
            "type": "array",
            "description": "One route per line: <code>Origin -> Destination</code>. Also accepted: two columns pasted from a spreadsheet (tab-separated), <code>Origin | Destination</code> or <code>Origin; Destination</code>. Add stops in between with more arrows: <code>Madrid -> Zaragoza -> Barcelona</code>.",
            "items": {
              "type": "string"
            }
          },
          "origins": {
            "title": "Origins",
            "type": "array",
            "description": "One place per line (addresses, place names or <code>lat,lng</code>). 10 origins × 20 destinations = 200 results.",
            "items": {
              "type": "string"
            }
          },
          "destinations": {
            "title": "Destinations",
            "type": "array",
            "description": "One place per line.",
            "items": {
              "type": "string"
            }
          },
          "directionsUrls": {
            "title": "Google Maps links",
            "type": "array",
            "description": "Paste Google Maps directions links, e.g. <code>https://www.google.com/maps/dir/Bilbao/San+Sebastián/...</code> or <code>https://www.google.com/maps/dir/?api=1&origin=...&destination=...</code>. Stops and travel mode are read from the link.",
            "items": {
              "type": "string"
            }
          },
          "trafficProfileStartDate": {
            "title": "From date",
            "pattern": "^$|^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^[+-]?(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "First day. Pick it in the calendar or use a relative value like <code>1 day</code> (tomorrow) for scheduled runs. Use future dates for Google's predicted traffic."
          },
          "trafficProfileEndDate": {
            "title": "To date",
            "pattern": "^$|^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^[+-]?(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Last day (optional — defaults to <i>From date</i>). Up to 93 days."
          },
          "trafficProfileWeekdays": {
            "title": "Only these weekdays",
            "uniqueItems": true,
            "type": "array",
            "description": "Optional: keep only these days of the week within the date range (e.g. Monday + Friday). Empty = every day.",
            "items": {
              "type": "string",
              "enum": [
                "mon",
                "tue",
                "wed",
                "thu",
                "fri",
                "sat",
                "sun"
              ],
              "enumTitles": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
                "Sunday"
              ]
            }
          },
          "trafficProfileStartTime": {
            "title": "From (local time)",
            "pattern": "^([01]?\\d|2[0-3]):[0-5]\\d$",
            "type": "string",
            "description": "First departure of each day.",
            "default": "06:00"
          },
          "trafficProfileEndTime": {
            "title": "To (local time)",
            "pattern": "^([01]?\\d|2[0-3]):[0-5]\\d$",
            "type": "string",
            "description": "Last departure of each day.",
            "default": "22:00"
          },
          "trafficProfileInterval": {
            "title": "Every",
            "enum": [
              "15",
              "30",
              "60",
              "120",
              "180"
            ],
            "type": "string",
            "description": "Time between departures. Example: 06:00–22:00 every hour = 17 results per route and day.",
            "default": "60"
          },
          "avoidTolls": {
            "title": "Tolls",
            "type": "boolean",
            "description": "Driving: prefer routes without toll roads.",
            "default": false
          },
          "avoidHighways": {
            "title": "Highways",
            "type": "boolean",
            "description": "Driving: prefer routes without motorways.",
            "default": false
          },
          "avoidFerries": {
            "title": "Ferries",
            "type": "boolean",
            "description": "Driving: prefer routes without ferries.",
            "default": false
          },
          "transitTypes": {
            "title": "Preferred transit vehicles",
            "uniqueItems": true,
            "type": "array",
            "description": "Transit: prefer these vehicle types (Google still falls back to others if there is no alternative). Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "bus",
                "subway",
                "train",
                "tram"
              ],
              "enumTitles": [
                "🚌 Bus",
                "🚇 Subway / metro",
                "🚆 Train",
                "🚊 Tram / light rail"
              ]
            }
          },
          "transitRoutePreference": {
            "title": "Transit route preference",
            "enum": [
              "best",
              "fewer_transfers",
              "less_walking",
              "wheelchair"
            ],
            "type": "string",
            "description": "Transit: how Google should rank itineraries.",
            "default": "best"
          },
          "maxRoutes": {
            "title": "Alternative routes",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum number of route alternatives kept per request (Google returns up to ~6 for transit, ~3 for driving, 1 for multi-stop trips).",
            "default": 3
          },
          "outputFormat": {
            "title": "Output rows",
            "enum": [
              "request",
              "route"
            ],
            "type": "string",
            "description": "<b>One row per request</b>: best route flattened into columns + all alternatives in <code>routes</code>. <b>One row per route</b>: every alternative is its own row (handy for spreadsheets).",
            "default": "request"
          },
          "includeSteps": {
            "title": "Turn-by-turn steps",
            "type": "boolean",
            "description": "Instructions, maneuvers, distances, durations and coordinates for each step; for transit: line, colour, headsign, stops, times, agency and service alerts. Included for the best route only unless 'Steps for all routes' is on.",
            "default": true
          },
          "stepsForAllRoutes": {
            "title": "Steps for alternative routes too",
            "type": "boolean",
            "description": "Also include steps for alternative routes (bigger output).",
            "default": false
          },
          "includePolyline": {
            "title": "Route line for maps (polyline)",
            "type": "boolean",
            "description": "Encoded polyline (Google format) to draw each route on a map.",
            "default": true
          },
          "includeDetailedPolyline": {
            "title": "High-resolution route line (larger output)",
            "type": "boolean",
            "description": "Adds <code>detailedPolyline</code>: the full-resolution route geometry (every curve, points ≥5 m apart) for map matching, geofencing or distance-along-route analysis. Makes responses larger and runs slower — leave off unless you need it.",
            "default": false
          },
          "includeSpeedProfile": {
            "title": "Traffic speed along the route",
            "type": "boolean",
            "description": "Driving: segment-by-segment traffic-aware speeds along the route (fromMeters, toMeters, seconds, speedKmh). A summary by speed band is always included.",
            "default": false
          },
          "includeStreetView": {
            "title": "Street View thumbnails",
            "type": "boolean",
            "description": "Add a Street View thumbnail URL to each maneuver.",
            "default": false
          },
          "language": {
            "title": "Language",
            "enum": [
              "en",
              "es",
              "fr",
              "de",
              "it",
              "pt",
              "pt-BR",
              "nl",
              "pl",
              "ru",
              "uk",
              "cs",
              "sk",
              "hu",
              "ro",
              "bg",
              "hr",
              "sr",
              "sl",
              "el",
              "tr",
              "sv",
              "da",
              "no",
              "fi",
              "et",
              "lv",
              "lt",
              "ca",
              "eu",
              "gl",
              "ja",
              "ko",
              "zh-CN",
              "zh-TW",
              "th",
              "vi",
              "id",
              "ms",
              "hi",
              "ar",
              "he"
            ],
            "type": "string",
            "description": "Language of instructions, road names and text fields.",
            "default": "en"
          },
          "countryCode": {
            "title": "Region bias",
            "pattern": "^$|^[a-zA-Z]{2}$",
            "type": "string",
            "description": "Optional: country used to interpret ambiguous place names. Pick one or type any 2-letter code. Adding the country to each address is still the most reliable."
          },
          "fixAmbiguousPlaces": {
            "title": "Auto-fix ambiguous city names",
            "type": "boolean",
            "description": "Google sometimes resolves a bare city name to a business with that name (e.g. <code>Barcelona</code> → a restaurant in Barcelona). When detected, the request is retried once with the country added (<code>Barcelona, Spain</code>) and the change is recorded in <code>geocodeCorrections</code>. Not charged twice.",
            "default": true
          },
          "maxResults": {
            "title": "Max results (safety cap)",
            "minimum": 0,
            "type": "integer",
            "description": "Safety cap on the number of directions requests (after expanding matrix, modes and traffic slots). 0 = no cap.",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Parallel requests. The actor backs off automatically if Google slows down.",
            "default": 10
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Leave on <b>No proxy</b> (recommended): the actor connects directly — fastest and cleanest results — and <b>switches to Apify Proxy automatically</b> if Google starts blocking. Select a proxy only if you need requests from a specific country/IP type.",
            "default": {
              "useApifyProxy": false
            }
          },
          "dateTime": {
            "title": "Date & time (legacy)",
            "type": "string",
            "description": "Legacy: YYYY-MM-DDTHH:MM. Use Date + Time instead."
          },
          "trafficProfileIntervalMinutes": {
            "title": "Interval minutes (legacy)",
            "minimum": 5,
            "type": "integer",
            "description": "Legacy. Use 'Every' instead."
          },
          "debug": {
            "title": "Debug",
            "type": "boolean",
            "description": "Save raw Google responses of NO_ROUTE results to the key-value store.",
            "default": false
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}