{
  "openapi": "3.0.1",
  "info": {
    "title": "AllTrails Scraper",
    "description": "Scrape AllTrails, the world's largest hiking, biking, and running trail database. Search trails by keyword/location; fetch full trail detail (difficulty, distance, elevation, GPS coordinates, photos, recent reviews); browse trails by park, city, or country.",
    "version": "1.1",
    "x-build-id": "Cuds6baHSlcYCXdlA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~alltrails-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-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/crawlerbros~alltrails-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-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/crawlerbros~alltrails-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "byTrail",
              "byUrl",
              "searchTrails",
              "byPark",
              "byCity",
              "topTrailsByCountry"
            ],
            "type": "string",
            "description": "Which discovery axis to use.",
            "default": "byTrail"
          },
          "url": {
            "title": "URL",
            "type": "string",
            "description": "An alltrails.com URL — trail, park, city, or country page. Used by mode=byTrail/byPark/byCity/byUrl/topTrailsByCountry.",
            "default": "https://www.alltrails.com/trail/us/california/half-dome-trail"
          },
          "urls": {
            "title": "URLs (mode=byUrl, batch)",
            "type": "array",
            "description": "Multiple alltrails.com URLs. Trail/park/city/country URLs are auto-routed.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Search query (mode=searchTrails)",
            "type": "string",
            "description": "Free-text query, e.g. `yosemite`, `coastal hike california`."
          },
          "country": {
            "title": "Country",
            "enum": [
              "us",
              "canada",
              "mexico",
              "united-kingdom",
              "ireland",
              "france",
              "germany",
              "spain",
              "portugal",
              "italy",
              "switzerland",
              "austria",
              "netherlands",
              "belgium",
              "denmark",
              "sweden",
              "norway",
              "finland",
              "iceland",
              "poland",
              "czech-republic",
              "greece",
              "australia",
              "new-zealand",
              "japan",
              "south-korea",
              "thailand",
              "vietnam",
              "indonesia",
              "philippines",
              "india",
              "south-africa",
              "morocco",
              "egypt",
              "kenya",
              "tanzania",
              "argentina",
              "brazil",
              "chile",
              "colombia",
              "costa-rica",
              "peru",
              "ecuador",
              "uae",
              "turkey",
              "israel",
              "russia",
              "china"
            ],
            "type": "string",
            "description": "Country slug used by AllTrails URLs and for search index selection. `us` is the default.",
            "default": "us"
          },
          "state": {
            "title": "State / region slug",
            "type": "string",
            "description": "State slug (e.g. `california`, `new-york`). Used with byPark/byCity/byTrail."
          },
          "city": {
            "title": "City slug (mode=byCity)",
            "type": "string",
            "description": "City slug (e.g. `san-francisco`, `los-angeles`)."
          },
          "trailSlug": {
            "title": "Trail slug (mode=byTrail)",
            "type": "string",
            "description": "Trail slug — the part after the state in the URL."
          },
          "parkSlug": {
            "title": "Park slug (mode=byPark)",
            "type": "string",
            "description": "Park slug, e.g. `yosemite-national-park`."
          },
          "difficulty": {
            "title": "Difficulty",
            "enum": [
              "",
              "easy",
              "moderate",
              "hard"
            ],
            "type": "string",
            "description": "Filter by AllTrails difficulty band.",
            "default": ""
          },
          "routeType": {
            "title": "Route type",
            "enum": [
              "",
              "out_and_back",
              "loop",
              "point_to_point"
            ],
            "type": "string",
            "description": "Filter by trail route type.",
            "default": ""
          },
          "activity": {
            "title": "Activity",
            "enum": [
              "",
              "hiking",
              "trail-running",
              "running",
              "mountain-biking",
              "biking",
              "road-biking",
              "walking",
              "backpacking",
              "camping",
              "rock-climbing",
              "via-ferrata",
              "horseback-riding",
              "snowshoeing",
              "cross-country-skiing",
              "skiing",
              "fishing",
              "birding",
              "off-road-driving",
              "scenic-driving",
              "paddle-sports",
              "nature-trips",
              "bike-touring"
            ],
            "type": "string",
            "description": "Filter by primary activity. Trails matching this activity in their `activities` array pass.",
            "default": ""
          },
          "minRating": {
            "title": "Minimum rating",
            "minimum": 0,
            "maximum": 5,
            "type": "number",
            "description": "Drop trails with avgRating below this (0-5)."
          },
          "minLengthKm": {
            "title": "Minimum length (km)",
            "minimum": 0,
            "maximum": 1000,
            "type": "number",
            "description": "Drop trails shorter than this length (km)."
          },
          "maxLengthKm": {
            "title": "Maximum length (km)",
            "minimum": 0,
            "maximum": 1000,
            "type": "number",
            "description": "Drop trails longer than this length (km)."
          },
          "fetchTrailDetails": {
            "title": "Fetch full trail detail per result",
            "type": "boolean",
            "description": "For listing modes (byPark/byCity/topTrailsByCountry/byUrl-listing), fetch the full trail detail page for every trail. Disable to emit lightweight stubs faster.",
            "default": true
          },
          "useProxy": {
            "title": "Use Apify proxy",
            "type": "boolean",
            "description": "Route requests through Apify proxy. AllTrails works without a proxy in most cases; auto-escalation handles 403/429 transparently.",
            "default": false
          },
          "autoEscalateOnBlock": {
            "title": "Auto-escalate to proxy on block",
            "type": "boolean",
            "description": "If direct fetches return 403/429/Cloudflare-challenge, retry through Apify (residential first) proxy automatically.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional Apify proxy configuration override.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": []
            }
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on emitted records.",
            "default": 25
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}