{
  "openapi": "3.0.1",
  "info": {
    "title": "AllTrails Scraper: Extract Hiking Trails, Reviews & Geo Data",
    "description": "Extract detailed hiking trail data from AllTrails. Fast and reliable scraper to collect trail length, difficulty, GPS coordinates, elevation, user ratings, reviews, activities, and photos. Perfect for outdoor apps, travel planning, and geographic research!",
    "version": "0.0",
    "x-build-id": "QoMkUiHsoEeudryxF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/saregaa~alltrails-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-saregaa-alltrails-scraper",
        "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/saregaa~alltrails-scraper/runs": {
      "post": {
        "operationId": "runs-sync-saregaa-alltrails-scraper",
        "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/saregaa~alltrails-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-saregaa-alltrails-scraper",
        "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": {
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "List of direct AllTrails trail URLs to scrape (e.g. https://www.alltrails.com/trail/us/california/half-dome-trail). When provided, the actor ignores all search parameters and fetches data for these specific trails only. Increases precision but reduces flexibility.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchBy": {
            "title": "Search Mode",
            "enum": [
              "coordinates",
              "city"
            ],
            "type": "string",
            "description": "Choose how to discover trails. 'coordinates' searches around a GPS point within a radius — good for precise area targeting. 'city' searches by city and state name — easier but less precise. Ignored when Start URLs are provided.",
            "default": "coordinates"
          },
          "latitude": {
            "title": "Latitude",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "Latitude of the search center point. Required when Search Mode is 'coordinates'. Use decimal degrees (e.g. 37.8651 for Yosemite Valley)."
          },
          "longitude": {
            "title": "Longitude",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "Longitude of the search center point. Required when Search Mode is 'coordinates'. Use decimal degrees (e.g. -119.5383 for Yosemite Valley)."
          },
          "searchRadius": {
            "title": "Search Radius (km)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Radius in kilometers around the GPS point to search for trails. Larger values return more results but may include trails far from your target area. Only used when Search Mode is 'coordinates'.",
            "default": 50
          },
          "city": {
            "title": "City",
            "type": "string",
            "description": "Name of the city to search trails in (e.g. 'Moab', 'Asheville'). Used together with State. Only applies when Search Mode is 'city'."
          },
          "state": {
            "title": "State / Region",
            "type": "string",
            "description": "State or region name (e.g. 'Utah', 'North Carolina'). Helps narrow city lookup. Only applies when Search Mode is 'city'."
          },
          "difficulty": {
            "title": "Difficulty Filter",
            "enum": [
              "",
              "easy",
              "moderate",
              "hard"
            ],
            "type": "string",
            "description": "Filter results by trail difficulty. Leave empty to return all difficulties. Restricting difficulty reduces result count.",
            "default": ""
          },
          "minRating": {
            "title": "Minimum Average Rating",
            "minimum": 0,
            "maximum": 5,
            "type": "number",
            "description": "Only return trails with an average user rating at or above this value (1.0–5.0). Leave at 0 to disable. Raising this value reduces result count but improves quality.",
            "default": 0
          },
          "minLength": {
            "title": "Minimum Trail Length (meters)",
            "minimum": 0,
            "type": "integer",
            "description": "Only return trails longer than this value in meters (e.g. 5000 = 5 km). Leave at 0 to disable. Useful for filtering out very short walks.",
            "default": 0
          },
          "maxLength": {
            "title": "Maximum Trail Length (meters)",
            "minimum": 0,
            "type": "integer",
            "description": "Only return trails shorter than this value in meters (e.g. 20000 = 20 km). Leave at 0 to disable. Useful for filtering out very long routes.",
            "default": 0
          },
          "maxItems": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of trails to return per run. Higher values increase run time and compute cost. The API returns results in a single request, so this mainly controls output size.",
            "default": 10
          },
          "proxy": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Configure Apify proxy to route requests. Recommended if you encounter IP blocks or rate limits. Using residential proxies increases reliability but adds cost.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}