{
  "openapi": "3.0.1",
  "info": {
    "title": "AllTrails Scraper — Hiking Trail Data API",
    "description": "Scrape AllTrails hiking trail data by keyword, park, city or URL: name, link, length, elevation, rating and location as JSON. USD 15 per 1,000 trails.",
    "version": "1.0",
    "x-build-id": "nv0qtp3x4A1gdwKcR"
  },
  "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": "AllTrails URLs to read: trail pages (one record each), park pages, city pages, state pages (for example https://www.alltrails.com/us/colorado) and country pages. Explore, list and home pages are not supported. Use this field when the user provides specific URLs; use Search Query or Search Mode when the user describes a place or a kind of trail.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL",
                  "description": "An AllTrails trail, park, city, state or country URL."
                }
              }
            }
          },
          "mode": {
            "title": "🔍 Search Mode",
            "enum": [
              "byUrl",
              "search",
              "byPark",
              "byCity",
              "byCountry",
              "byTrail"
            ],
            "type": "string",
            "description": "How trails are found when you do not paste URLs. search: keyword search across AllTrails trails. byPark: trails that mention a national park. byCity: trails that mention a city in a state, or the top trails (about 100) of a state when City is empty. byCountry: the top trails (about 100) of one country. byTrail: one trail by its slug. If you leave it empty, the mode is inferred from the fields you fill in."
          },
          "searchQuery": {
            "title": "🔎 Search Query",
            "type": "string",
            "description": "Free-text search for trails, for example 'yosemite' or 'waterfall hike'. Used when the mode is search. Do NOT use this when the user provides URLs; use Start URLs instead."
          },
          "country": {
            "title": "🌍 Country",
            "type": "string",
            "description": "AllTrails country slug, for example us, canada, england, italy or new-zealand. With keyword search, the default 'us' searches every country; any other value keeps the search inside that country.",
            "default": "us"
          },
          "state": {
            "title": "🗺️ State / Region",
            "type": "string",
            "description": "AllTrails state or region slug, for example 'california' or 'utah'. For a region outside the US, also set Country (for example country 'italy' with state 'south-tyrol'). Narrows keyword search, park and city modes to that region, and is required with a bare trail slug."
          },
          "city": {
            "title": "🏙️ City",
            "type": "string",
            "description": "City slug, for example 'san-francisco' or 'denver'. Used when the mode is byCity; returns trails whose AllTrails page mentions the city."
          },
          "park": {
            "title": "🏞️ National Park",
            "type": "string",
            "description": "Park slug, for example 'yosemite-national-park' or 'zion-national-park'. Used when the mode is byPark; returns trails whose AllTrails page mentions the park."
          },
          "trailSlug": {
            "title": "🥾 Trail Slug",
            "type": "string",
            "description": "The last part of an AllTrails trail URL, for example 'angels-landing-trail' with State 'utah', or the full path 'us/utah/angels-landing-trail'. Used when the mode is byTrail."
          },
          "difficulty": {
            "title": "⛰️ Difficulty Filter",
            "enum": [
              "",
              "easy",
              "moderate",
              "hard",
              "strenuous",
              "expert"
            ],
            "type": "string",
            "description": "Keep only trails at this AllTrails difficulty level. Trails whose difficulty is not stated in their summary are left out when this is set. Leave empty for all difficulties.",
            "default": ""
          },
          "routeType": {
            "title": "🗺️ Route Type Filter",
            "enum": [
              "",
              "loop",
              "out-and-back",
              "point-to-point"
            ],
            "type": "string",
            "description": "Keep only trails whose summary states this route shape. Most AllTrails summaries do not state the route shape, so this filter returns far fewer trails. Leave empty for all route types.",
            "default": ""
          },
          "activity": {
            "title": "🚶 Activity Keyword",
            "enum": [
              "",
              "hiking",
              "trail-running",
              "backpacking",
              "mountain-biking",
              "rock-climbing",
              "horseback-riding",
              "walking",
              "birding",
              "scenic-driving",
              "fishing",
              "snowshoeing"
            ],
            "type": "string",
            "description": "Adds the activity to the search as a keyword, for example trail running. AllTrails summaries do not list activities, so trails are not checked one by one. Leave empty for all activities.",
            "default": ""
          },
          "minRating": {
            "title": "⭐ Minimum Rating",
            "minimum": 0,
            "maximum": 5,
            "type": "number",
            "description": "Keep only trails with at least this average star rating (0 to 5). Leave at 0 for no minimum.",
            "default": 0
          },
          "minLengthKm": {
            "title": "📏 Min Length (km)",
            "minimum": 0,
            "type": "number",
            "description": "Keep only trails at least this long, in kilometers. Trails without a stated length are left out when this is set. Leave empty for no minimum."
          },
          "maxLengthKm": {
            "title": "📏 Max Length (km)",
            "minimum": 0,
            "type": "number",
            "description": "Keep only trails no longer than this, in kilometers. Trails without a stated length are left out when this is set. Leave empty for no maximum."
          },
          "maxItems": {
            "title": "📊 Max Items",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of trail rows to save across all sources. Set 0 for every trail found, which is at most about 100 per keyword, park, city, state or country.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}