{
  "openapi": "3.0.1",
  "info": {
    "title": "Multi-Stop Route, Geocoder & 2-Opt TSP Distance Optimizer",
    "description": "Geocode addresses with OpenStreetMap, order stops with nearest-neighbour + 2-opt on estimated distances (straight line x road factor), apply a shift time budget and export a Google Maps multi-stop link. Not a road-routing engine.",
    "version": "0.0",
    "x-build-id": "c2hC7vVucLpkKgids"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/thanh81646~apify-multi-stop-route-and-distance-optimizer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-thanh81646-apify-multi-stop-route-and-distance-optimizer",
        "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/thanh81646~apify-multi-stop-route-and-distance-optimizer/runs": {
      "post": {
        "operationId": "runs-sync-thanh81646-apify-multi-stop-route-and-distance-optimizer",
        "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/thanh81646~apify-multi-stop-route-and-distance-optimizer/run-sync": {
      "post": {
        "operationId": "run-sync-thanh81646-apify-multi-stop-route-and-distance-optimizer",
        "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": [
          "stops"
        ],
        "properties": {
          "origin": {
            "title": "Start Location (Address or 'lat, lng')",
            "type": "string",
            "description": "Starting depot, office address, or 'latitude, longitude' coordinate pair.",
            "default": "Union Station, 30 W Pershing Rd, Kansas City, MO 64108"
          },
          "destination": {
            "title": "End Location (Address, 'lat, lng', or blank for open route)",
            "type": "string",
            "description": "Ending depot address or 'latitude, longitude'. Set identical to Start Location for a closed round-trip, or leave empty for an open-ended route.",
            "default": "Union Station, 30 W Pershing Rd, Kansas City, MO 64108"
          },
          "stops": {
            "title": "Stops to Optimize (Addresses or Coordinate Objects)",
            "type": "array",
            "description": "Array of stop objects ({label, address, lat, lng, priority, serviceMinutes}) or plain street address strings from Google Sheets, HubSpot, Airtable, or CSV.",
            "default": [
              {
                "label": "Stop A - River Market",
                "address": "20 E 5th St, Kansas City, MO 64106",
                "lat": 39.1088,
                "lng": -94.5818,
                "priority": 90,
                "serviceMinutes": 12
              },
              {
                "label": "Stop B - Country Club Plaza",
                "address": "4706 Broadway Blvd, Kansas City, MO 64112",
                "lat": 39.0419,
                "lng": -94.5908,
                "priority": 100,
                "serviceMinutes": 15
              },
              {
                "label": "Stop C - Brookside",
                "address": "6300 Brookside Plaza, Kansas City, MO 64113",
                "lat": 39.0132,
                "lng": -94.5919,
                "priority": 80,
                "serviceMinutes": 12
              },
              {
                "label": "Stop D - Westport",
                "address": "4050 Pennsylvania Ave, Kansas City, MO 64111",
                "lat": 39.0531,
                "lng": -94.5905,
                "priority": 85,
                "serviceMinutes": 10
              },
              {
                "label": "Stop E - Crossroads District",
                "address": "1901 Baltimore Ave, Kansas City, MO 64108",
                "lat": 39.0902,
                "lng": -94.5844,
                "priority": 95,
                "serviceMinutes": 12
              },
              {
                "label": "Stop F - 18th & Vine",
                "address": "1616 E 18th St, Kansas City, MO 64108",
                "lat": 39.0913,
                "lng": -94.5632,
                "priority": 75,
                "serviceMinutes": 10
              }
            ]
          },
          "maxStops": {
            "title": "Max Stops to Optimize",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of stops to geocode and sequence in a single run (Free-tier Apify runs are capped at 25 results).",
            "default": 25
          },
          "maxMinutes": {
            "title": "Max Shift Time Window (Minutes)",
            "minimum": 15,
            "maximum": 1440,
            "type": "integer",
            "description": "Maximum allowed cumulative minutes (driving + on-site dwell time). Stops exceeding this window are marked as Deferred.",
            "default": 120
          },
          "serviceMinutesPerStop": {
            "title": "Default On-Site Service Time per Stop (Minutes)",
            "minimum": 0,
            "maximum": 240,
            "type": "integer",
            "description": "Default dwell or appointment duration in minutes per stop when not overridden on an individual stop.",
            "default": 12
          },
          "averageSpeedMph": {
            "title": "Estimated Average Driving Speed (MPH)",
            "minimum": 5,
            "maximum": 80,
            "type": "integer",
            "description": "Average urban/suburban road travel speed in miles per hour used for travel-time estimation.",
            "default": 28
          },
          "roadCircuityPercent": {
            "title": "Road Circuity Multiplier (%)",
            "minimum": 100,
            "maximum": 200,
            "type": "integer",
            "description": "Multiplier applied to straight-line Haversine distance to approximate real street grids (128 = 1.28x Haversine distance).",
            "default": 128
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}