{
  "openapi": "3.0.1",
  "info": {
    "title": "AllTrails Scraper — Trails, Reviews & GPS Data",
    "description": "Scrape AllTrails hiking routes, difficulty, distance, elevation, ratings, reviews, maps, and GPS data for travel and outdoor research.",
    "version": "1.0",
    "x-build-id": "I1lPJ9bWJzPwFfiBU"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/muhammadafzal~alltrails-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-muhammadafzal-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/muhammadafzal~alltrails-scraper/runs": {
      "post": {
        "operationId": "runs-sync-muhammadafzal-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/muhammadafzal~alltrails-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-muhammadafzal-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": "Paste AllTrails URLs directly. Supports trail pages, park/area pages, city pages, or explore URLs. Use this field when the user provides specific URLs. Use searchQuery or mode instead when the user describes a location or trail type.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL",
                  "description": "An AllTrails URL (trail, park, city, or country page)."
                }
              }
            }
          },
          "mode": {
            "title": "🔍 Search Mode",
            "enum": [
              "byUrl",
              "search",
              "byPark",
              "byCity",
              "byCountry",
              "byTrail"
            ],
            "type": "string",
            "description": "How to discover trails when not pasting URLs. byUrl: scrape provided URLs. search: free-text search via Algolia. byPark: browse a national park. byCity: browse trails in a city. byCountry: top trails in a country. byTrail: fetch a single trail by slug.",
            "default": "byUrl"
          },
          "searchQuery": {
            "title": "🔎 Search Query",
            "type": "string",
            "description": "Free-text search query for trails (e.g. 'yosemite', 'coastal hike california'). Used when mode is 'search'. Do NOT use this when the user provides URLs — use startUrls instead.",
            "default": ""
          },
          "country": {
            "title": "🌍 Country",
            "type": "string",
            "description": "Country slug for AllTrails URLs and search index. 'us' is default. Examples: us, canada, united-kingdom, france, germany, australia.",
            "default": "us"
          },
          "state": {
            "title": "🗺️ State / Region",
            "type": "string",
            "description": "State or region slug (e.g. 'california', 'new-york'). Used with byPark, byCity, and byTrail modes.",
            "default": ""
          },
          "city": {
            "title": "🏙️ City",
            "type": "string",
            "description": "City slug (e.g. 'san-francisco', 'denver'). Used when mode is 'byCity'.",
            "default": ""
          },
          "park": {
            "title": "🏞️ National Park",
            "type": "string",
            "description": "Park slug (e.g. 'yosemite-national-park', 'zion-national-park'). Used when mode is 'byPark'.",
            "default": ""
          },
          "trailSlug": {
            "title": "🥾 Trail Slug",
            "type": "string",
            "description": "The trail slug — the part of the AllTrails URL after the state. Used when mode is 'byTrail'.",
            "default": ""
          },
          "difficulty": {
            "title": "⛰️ Difficulty Filter",
            "enum": [
              "",
              "easy",
              "moderate",
              "hard",
              "expert"
            ],
            "type": "string",
            "description": "Only include trails at this difficulty level. Leave empty for all difficulties.",
            "default": ""
          },
          "routeType": {
            "title": "🗺️ Route Type Filter",
            "enum": [
              "",
              "loop",
              "out-and-back",
              "point-to-point"
            ],
            "type": "string",
            "description": "Only include trails with this route shape. Leave empty for all route types.",
            "default": ""
          },
          "activity": {
            "title": "🚶 Activity Filter",
            "enum": [
              "",
              "hiking",
              "trail-running",
              "backpacking",
              "mountain-biking",
              "rock-climbing",
              "horseback-riding",
              "walking",
              "birding",
              "scenic-driving",
              "fishing",
              "snowshoeing"
            ],
            "type": "string",
            "description": "Only include trails suited to this activity. Leave empty for all activities.",
            "default": ""
          },
          "minRating": {
            "title": "⭐ Minimum Rating",
            "type": "number",
            "description": "Only include trails with at least this average rating (0 to 5 stars). Leave at 0 for no minimum.",
            "default": 0
          },
          "minLengthKm": {
            "title": "📏 Min Length (km)",
            "type": "number",
            "description": "Only include trails at least this long (in kilometers). Leave empty for no minimum."
          },
          "maxLengthKm": {
            "title": "📏 Max Length (km)",
            "type": "number",
            "description": "Only include trails no longer than this (in kilometers). Leave empty for no maximum."
          },
          "fetchTrailDetails": {
            "title": "📥 Fetch Full Trail Details",
            "type": "boolean",
            "description": "When enabled, the actor fetches the full trail detail page for each trail found in search results, giving richer data (description, reviews, ratings breakdown). Disable for faster, lighter results.",
            "default": true
          },
          "useProxy": {
            "title": "🌐 Use Proxy",
            "type": "boolean",
            "description": "Route requests through Apify proxy. AllTrails blocks direct requests without a proxy. Enabled by default. Disable only if you have a custom proxy setup.",
            "default": true
          },
          "proxyGroups": {
            "title": "🔧 Proxy Groups",
            "type": "array",
            "description": "Apify proxy groups to use (e.g. ['RESIDENTIAL']). Leave empty for default datacenter proxies.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "📊 Max Items",
            "type": "integer",
            "description": "Maximum number of trails to extract. Set to 0 for all available trails. Tip: start with 10-50 to test, then increase.",
            "default": 10
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}